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

pull/581/head
Ryan Pavlik 2019-09-09 15:27:22 -05:00 committed by whitequark
parent f5415b3fe6
commit e51fdf6fba
1 changed files with 10 additions and 8 deletions

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.
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
// workplane geometry or for its operands. Those must already exist
// in a previous group, so check them before generating.
if(PruneGroups(g->h))
if(PruneGroups(hg))
goto pruned;
for(auto &req : SK.request) {
Request *r = &req;
if(r->group != g->h) continue;
if(r->group != hg) continue;
r->Generate(&(SK.entity), &(SK.param));
}
for(auto &con : SK.constraint) {
Constraint *c = &con;
if(c->group != g->h) continue;
if(c->group != hg) continue;
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
// previous group, so check them after generating.
if(PruneRequests(g->h) || PruneConstraints(g->h))
if(PruneRequests(hg) || PruneConstraints(hg))
goto pruned;
// 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();
Group *g = SK.GetGroup(hg);
g->solved.how = SolveResult::OKAY;
g->clean = true;
} else {
@ -265,8 +266,9 @@ void SolveSpaceUI::GenerateAll(Generate type, bool andFindFree, bool genForBBox)
if(i >= first && i <= last) {
// The group falls inside the range, so really solve it,
// and then regenerate the mesh based on the solved stuff.
Group *g = SK.GetGroup(hg);
if(genForBBox) {
SolveGroupAndReport(g->h, andFindFree);
SolveGroupAndReport(hg, andFindFree);
g->GenerateLoops();
} else {
g->GenerateShellAndMesh();