diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index a4a7ab592f..a53b20c453 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -56,6 +56,7 @@ # include # include # include +# include /// Qt Include Files # include @@ -249,7 +250,7 @@ struct EditData { SoText2 *textX; SoTranslation *textPos; - SoGroup *constrGroup; + SmSwitchboard *constrGroup; SoGroup *infoGroup; SoPickStyle *pickStyleAxes; }; @@ -276,7 +277,8 @@ ViewProviderSketch::ViewProviderSketch() : edit(0), Mode(STATUS_NONE), visibleInformationChanged(true), - combrepscalehyst(0) + combrepscalehyst(0), + isShowVirtualSpace(false) { ADD_PROPERTY_TYPE(Autoconstraints,(true),"Auto Constraints",(App::PropertyType)(App::Prop_None),"Create auto constraints"); ADD_PROPERTY_TYPE(TempoVis,(Py::None()),"Visibility automation",(App::PropertyType)(App::Prop_None),"Object that handles hiding and showing other objects when entering/leaving sketch."); @@ -5130,8 +5132,30 @@ void ViewProviderSketch::rebuildConstraintsVisual(void) sep->unref(); mat->unref(); } + + updateVirtualSpace(); } +void ViewProviderSketch::updateVirtualSpace(void) +{ + const std::vector &constrlist = getSketchObject()->Constraints.getValues(); + + if(constrlist.size() == edit->vConstrType.size()) { + + edit->constrGroup->enable.setNum(constrlist.size()); + + SbBool *sws = edit->constrGroup->enable.startEditing(); + + for (size_t i = 0; i < constrlist.size(); i++) { + //for (size_t i = 0; i < 15; i++) { + sws[i] = !constrlist[i]->isInVirtualSpace; + } + + edit->constrGroup->enable.finishEditing(); + } +} + + void ViewProviderSketch::drawEdit(const std::vector &EditCurve) { assert(edit); @@ -5633,7 +5657,7 @@ void ViewProviderSketch::createEditInventorNodes(void) edit->EditRoot->addChild(DrawStyle); // add the group where all the constraints has its SoSeparator - edit->constrGroup = new SoGroup(); + edit->constrGroup = new SmSwitchboard(); edit->constrGroup->setName("ConstraintGroup"); edit->EditRoot->addChild(edit->constrGroup); diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.h b/src/Mod/Sketcher/Gui/ViewProviderSketch.h index 228837c34e..8aa595bfda 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.h +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.h @@ -225,6 +225,8 @@ public: virtual bool mouseButtonPressed(int Button, bool pressed, const SbVec2s& cursorPos, const Gui::View3DInventorViewer* viewer); //@} + /// updates the visibility of the virtual space + void updateVirtualSpace(void); friend class DrawSketchHandler; friend struct ::EditData; @@ -408,6 +410,9 @@ protected: // information layer variables bool visibleInformationChanged; double combrepscalehyst; + + // Virtual space variables + bool isShowVirtualSpace; }; } // namespace PartGui