When creating a new group, use the color of last requested solid.

pull/4/head
EvilSpirit 2016-04-02 19:34:17 +06:00 committed by whitequark
parent 29296447a9
commit 55e3162a05
5 changed files with 34 additions and 0 deletions

View File

@ -222,6 +222,15 @@ void Group::MenuGroup(int id) {
default: oops(); default: oops();
} }
// Copy color from the previous mesh-contributing group.
if(g.IsMeshGroup() && SK.groupOrder.n > 0) {
Group *running = SK.GetRunningMeshGroup();
if(running != NULL) {
g.color = running->color;
}
}
SS.GW.ClearSelection(); SS.GW.ClearSelection();
SS.UndoRemember(); SS.UndoRemember();

View File

@ -430,6 +430,17 @@ Group *Group::RunningMeshGroup(void) {
} }
} }
bool Group::IsMeshGroup() {
switch(type) {
case Group::EXTRUDE:
case Group::LATHE:
case Group::ROTATE:
case Group::TRANSLATE:
return true;
}
return false;
}
void Group::DrawDisplayItems(int t) { void Group::DrawDisplayItems(int t) {
RgbaColor specColor; RgbaColor specColor;
bool useSpecColor; bool useSpecColor;

View File

@ -243,6 +243,7 @@ public:
// And the mesh stuff // And the mesh stuff
Group *PreviousGroup(void); Group *PreviousGroup(void);
Group *RunningMeshGroup(void); Group *RunningMeshGroup(void);
bool IsMeshGroup();
void GenerateShellAndMesh(void); void GenerateShellAndMesh(void);
template<class T> void GenerateForStepAndRepeat(T *steps, T *outs); template<class T> void GenerateForStepAndRepeat(T *steps, T *outs);
template<class T> void GenerateForBoolean(T *a, T *b, T *o, int how); template<class T> void GenerateForBoolean(T *a, T *b, T *o, int how);

View File

@ -852,3 +852,15 @@ BBox Sketch::CalculateEntityBBox(bool includingInvisible) {
} }
return box; return box;
} }
Group *Sketch::GetRunningMeshGroup() {
if(groupOrder.n < 1) return NULL;
Group *g = GetGroup(groupOrder.elem[groupOrder.n - 1]);
while(g != NULL) {
if(g->IsMeshGroup()) {
return g;
}
g = g->PreviousGroup();
}
return NULL;
}

View File

@ -672,6 +672,7 @@ public:
void Clear(void); void Clear(void);
BBox CalculateEntityBBox(bool includingInvisible); BBox CalculateEntityBBox(bool includingInvisible);
Group *GetRunningMeshGroup();
}; };
#undef ENTITY #undef ENTITY
#undef CONSTRAINT #undef CONSTRAINT