Use handles instead of pointers in GenerateAll(). NFC.

This commit is contained in:
Ryan Pavlik 2019-09-09 15:27:22 -05:00 committed by whitequark
parent f5415b3fe6
commit e51fdf6fba

View File

@ -216,31 +216,31 @@ void SolveSpaceUI::GenerateAll(Generate type, bool andFindFree, bool genForBBox)
// Not using range-for because we're using the index inside the loop. // Not using range-for because we're using the index inside the loop.
for(i = 0; i < SK.groupOrder.n; i++) { for(i = 0; i < SK.groupOrder.n; i++) {
Group *g = SK.GetGroup(SK.groupOrder[i]); hGroup hg = SK.groupOrder[i];
// The group may depend on entities or other groups, to define its // The group may depend on entities or other groups, to define its
// workplane geometry or for its operands. Those must already exist // workplane geometry or for its operands. Those must already exist
// in a previous group, so check them before generating. // in a previous group, so check them before generating.
if(PruneGroups(g->h)) if(PruneGroups(hg))
goto pruned; goto pruned;
for(auto &req : SK.request) { for(auto &req : SK.request) {
Request *r = &req; Request *r = &req;
if(r->group != g->h) continue; if(r->group != hg) continue;
r->Generate(&(SK.entity), &(SK.param)); r->Generate(&(SK.entity), &(SK.param));
} }
for(auto &con : SK.constraint) { for(auto &con : SK.constraint) {
Constraint *c = &con; Constraint *c = &con;
if(c->group != g->h) continue; if(c->group != hg) continue;
c->Generate(&(SK.param)); c->Generate(&(SK.param));
} }
g->Generate(&(SK.entity), &(SK.param)); SK.GetGroup(hg)->Generate(&(SK.entity), &(SK.param));
// The requests and constraints depend on stuff in this or the // The requests and constraints depend on stuff in this or the
// previous group, so check them after generating. // previous group, so check them after generating.
if(PruneRequests(g->h) || PruneConstraints(g->h)) if(PruneRequests(hg) || PruneConstraints(hg))
goto pruned; goto pruned;
// Use the previous values for params that we've seen before, as // Use the previous values for params that we've seen before, as
@ -256,8 +256,9 @@ void SolveSpaceUI::GenerateAll(Generate type, bool andFindFree, bool genForBBox)
} }
} }
if(g->h == Group::HGROUP_REFERENCES) { if(hg == Group::HGROUP_REFERENCES) {
ForceReferences(); ForceReferences();
Group *g = SK.GetGroup(hg);
g->solved.how = SolveResult::OKAY; g->solved.how = SolveResult::OKAY;
g->clean = true; g->clean = true;
} else { } else {
@ -265,8 +266,9 @@ void SolveSpaceUI::GenerateAll(Generate type, bool andFindFree, bool genForBBox)
if(i >= first && i <= last) { if(i >= first && i <= last) {
// The group falls inside the range, so really solve it, // The group falls inside the range, so really solve it,
// and then regenerate the mesh based on the solved stuff. // and then regenerate the mesh based on the solved stuff.
Group *g = SK.GetGroup(hg);
if(genForBBox) { if(genForBBox) {
SolveGroupAndReport(g->h, andFindFree); SolveGroupAndReport(hg, andFindFree);
g->GenerateLoops(); g->GenerateLoops();
} else { } else {
g->GenerateShellAndMesh(); g->GenerateShellAndMesh();