Added preference for disabling shaded override draw style when entering sketch edit mode.
Storing previous override draw style and applying it when leaving the sketch.
This commit is contained in:
@@ -107,6 +107,7 @@ void SketcherSettings::saveSettings()
|
||||
ui->checkBoxAdvancedSolverTaskBox->onSave();
|
||||
ui->checkBoxRecalculateInitialSolutionWhileDragging->onSave();
|
||||
ui->checkBoxEnableEscape->onSave();
|
||||
ui->checkBoxDisableShading->onSave();
|
||||
ui->checkBoxNotifyConstraintSubstitutions->onSave();
|
||||
ui->checkBoxAutoRemoveRedundants->onSave();
|
||||
ui->checkBoxUnifiedCoincident->onSave();
|
||||
@@ -178,6 +179,7 @@ void SketcherSettings::loadSettings()
|
||||
ui->checkBoxAdvancedSolverTaskBox->onRestore();
|
||||
ui->checkBoxRecalculateInitialSolutionWhileDragging->onRestore();
|
||||
ui->checkBoxEnableEscape->onRestore();
|
||||
ui->checkBoxDisableShading->onRestore();
|
||||
ui->checkBoxNotifyConstraintSubstitutions->onRestore();
|
||||
ui->checkBoxAutoRemoveRedundants->onRestore();
|
||||
ui->checkBoxUnifiedCoincident->onRestore();
|
||||
|
||||
@@ -140,6 +140,25 @@ Requires to re-enter edit mode to take effect.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="checkBoxDisableShading">
|
||||
<property name="toolTip">
|
||||
<string>Disables the shaded view when entering the sketch edit mode.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Disable shading in edit mode</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="1">
|
||||
<cstring>DisableShadedView</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="1">
|
||||
<cstring>Mod/Sketcher/General</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="checkBoxNotifyConstraintSubstitutions">
|
||||
<property name="toolTip">
|
||||
|
||||
@@ -3226,14 +3226,24 @@ void ViewProviderSketch::unsetEdit(int ModNum)
|
||||
deactivateHandler();
|
||||
|
||||
// Resets the override draw style mode when leaving the sketch edit mode.
|
||||
// TODO: This could maybe also be a preference (enable auto switch of draw style). Additionally the previous override draw style could be saved and applied when leaving the edit mode.
|
||||
Gui::MDIView* mdi = Gui::Application::Instance->editViewOfNode(editCoinManager->getRootEditNode());
|
||||
Gui::View3DInventorViewer* viewer = static_cast<Gui::View3DInventor*>(mdi)->getViewer();
|
||||
if (viewer)
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath(
|
||||
"User parameter:BaseApp/Preferences/Mod/Sketcher/General");
|
||||
auto disableShadedView = hGrp->GetBool("DisableShadedView", true);
|
||||
if (disableShadedView) {
|
||||
Gui::Document* doc = Gui::Application::Instance->activeDocument();
|
||||
Gui::MDIView* mdi = doc->getActiveView();
|
||||
Gui::View3DInventorViewer* viewer = static_cast<Gui::View3DInventor*>(mdi)->getViewer();
|
||||
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath(
|
||||
"User parameter:BaseApp/Preferences/Mod/Sketcher/General");
|
||||
auto OverrideMode = hGrp->GetASCII("OverrideMode", "As Is");
|
||||
|
||||
if (viewer)
|
||||
{
|
||||
viewer->updateOverrideMode("As Is");
|
||||
viewer->setOverrideMode("As Is");
|
||||
viewer->updateOverrideMode(OverrideMode);
|
||||
viewer->setOverrideMode(OverrideMode);
|
||||
}
|
||||
}
|
||||
|
||||
editCoinManager = nullptr;
|
||||
snapManager = nullptr;
|
||||
@@ -3312,13 +3322,23 @@ void ViewProviderSketch::setEditViewer(Gui::View3DInventorViewer* viewer, int Mo
|
||||
}
|
||||
|
||||
// Sets the view mode to no shading to prevent visibility issues against parallel surfaces with shininess when entering the sketch mode.
|
||||
// TODO: This could maybe also be a preference (enable auto switch of draw style) and further improved if the user has already an override draw style enabled which has no shading (e.g. wireframe). Additionally the current override draw style could be saved and applied when leaving the edit mode.
|
||||
if (viewer)
|
||||
{
|
||||
viewer->updateOverrideMode("No Shading");
|
||||
viewer->setOverrideMode("No Shading");
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath(
|
||||
"User parameter:BaseApp/Preferences/Mod/Sketcher/General");
|
||||
auto disableShadedView = hGrp->GetBool("DisableShadedView", true);
|
||||
|
||||
hGrp = App::GetApplication().GetParameterGroupByPath(
|
||||
"User parameter:BaseApp/Preferences/Mod/Sketcher/General");
|
||||
hGrp->SetASCII("OverrideMode", viewer->getOverrideMode());
|
||||
|
||||
if (disableShadedView) {
|
||||
|
||||
|
||||
viewer->updateOverrideMode("No Shading");
|
||||
viewer->setOverrideMode("No Shading");
|
||||
|
||||
}
|
||||
|
||||
|
||||
auto editDoc = Gui::Application::Instance->editDocument();
|
||||
editDocName.clear();
|
||||
if (editDoc) {
|
||||
|
||||
Reference in New Issue
Block a user