From 2d25bdb51f339dd0384a3fc1615f07da392876c7 Mon Sep 17 00:00:00 2001 From: whitequark Date: Sun, 10 Apr 2016 11:25:26 +0000 Subject: [PATCH] When choosing color for a new group, consider active, not last, group. --- src/group.cpp | 2 +- src/solvespace.cpp | 5 ++--- src/solvespace.h | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/group.cpp b/src/group.cpp index 73a437d..db0cf4b 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 30f3775..13fffda 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 7948a09..a3fa2a9 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