Don't reset showFaces every time a group is activated

Instead store the state separately for drawing and non-drawing group
types, and set showFaces to one of those, whenever a group is activated.
pull/1090/head
Tom Sutcliffe 2021-08-01 11:34:55 +01:00 committed by phkahler
parent 1b8e1dec65
commit 56719415de
3 changed files with 15 additions and 4 deletions

View File

@ -407,6 +407,8 @@ void GraphicsWindow::Init() {
showEdges = true; showEdges = true;
showMesh = false; showMesh = false;
showOutlines = false; showOutlines = false;
showFacesDrawing = false;
showFacesNonDrawing = true;
drawOccludedAs = DrawOccludedAs::INVISIBLE; drawOccludedAs = DrawOccludedAs::INVISIBLE;
showTextWindow = true; showTextWindow = true;
@ -1366,6 +1368,14 @@ void GraphicsWindow::ToggleBool(bool *v) {
SS.GenerateAll(SolveSpaceUI::Generate::UNTIL_ACTIVE); SS.GenerateAll(SolveSpaceUI::Generate::UNTIL_ACTIVE);
} }
if(v == &showFaces) {
if(g->type == Group::Type::DRAWING_WORKPLANE || g->type == Group::Type::DRAWING_3D) {
showFacesDrawing = showFaces;
} else {
showFacesNonDrawing = showFaces;
}
}
Invalidate(/*clearPersistent=*/true); Invalidate(/*clearPersistent=*/true);
SS.ScheduleShowTW(); SS.ScheduleShowTW();
} }

View File

@ -416,11 +416,10 @@ std::string Group::DescriptionString() {
} }
void Group::Activate() { void Group::Activate() {
if(type == Type::EXTRUDE || type == Type::LINKED || type == Type::LATHE || if(type == Type::DRAWING_WORKPLANE || type == Type::DRAWING_3D) {
type == Type::REVOLVE || type == Type::HELIX || type == Type::TRANSLATE || type == Type::ROTATE) { SS.GW.showFaces = SS.GW.showFacesDrawing;
SS.GW.showFaces = true;
} else { } else {
SS.GW.showFaces = false; SS.GW.showFaces = SS.GW.showFacesNonDrawing;
} }
SS.MarkGroupDirty(h); // for good measure; shouldn't be needed SS.MarkGroupDirty(h); // for good measure; shouldn't be needed
SS.ScheduleShowTW(); SS.ScheduleShowTW();

View File

@ -802,6 +802,8 @@ public:
bool showEdges; bool showEdges;
bool showOutlines; bool showOutlines;
bool showFaces; bool showFaces;
bool showFacesDrawing;
bool showFacesNonDrawing;
bool showMesh; bool showMesh;
void ToggleBool(bool *v); void ToggleBool(bool *v);