diff --git a/src/group.cpp b/src/group.cpp index 73a437d3..db0cf4b8 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -225,7 +225,7 @@ void Group::MenuGroup(int id) { // Copy color from the previous mesh-contributing group. if(g.IsMeshGroup() && SK.groupOrder.n > 0) { - Group *running = SK.GetRunningMeshGroup(); + Group *running = SK.GetRunningMeshGroupFor(SS.GW.activeGroup); if(running != NULL) { g.color = running->color; } diff --git a/src/solvespace.cpp b/src/solvespace.cpp index 30f37750..13fffdaa 100644 --- a/src/solvespace.cpp +++ b/src/solvespace.cpp @@ -853,9 +853,8 @@ BBox Sketch::CalculateEntityBBox(bool includingInvisible) { return box; } -Group *Sketch::GetRunningMeshGroup() { - if(groupOrder.n < 1) return NULL; - Group *g = GetGroup(groupOrder.elem[groupOrder.n - 1]); +Group *Sketch::GetRunningMeshGroupFor(hGroup h) { + Group *g = GetGroup(h); while(g != NULL) { if(g->IsMeshGroup()) { return g; diff --git a/src/solvespace.h b/src/solvespace.h index 7948a09f..a3fa2a99 100644 --- a/src/solvespace.h +++ b/src/solvespace.h @@ -670,7 +670,7 @@ public: void Clear(void); BBox CalculateEntityBBox(bool includingInvisible); - Group *GetRunningMeshGroup(); + Group *GetRunningMeshGroupFor(hGroup h); }; #undef ENTITY #undef CONSTRAINT