Merge pull request #14386 from maxwxyz/sketcher-draw-style
Sketcher: Changes override draw style when entering sketch edit mode.
This commit is contained in:
@@ -69,14 +69,6 @@ int View3DSettings::stopAnimatingIfDeactivated() const
|
||||
|
||||
void View3DSettings::applySettings()
|
||||
{
|
||||
// Check if Sketcher Edit Mode exited cleanly
|
||||
const int overMaxHeadlightIntensity = 101;
|
||||
int sketcherEditLastExit = hGrp->GetInt("HeadlightIntensityExisting", overMaxHeadlightIntensity);
|
||||
if (sketcherEditLastExit != overMaxHeadlightIntensity) {
|
||||
// must mean a seg fault or abnormal exit last time
|
||||
hGrp->SetInt("HeadlightIntensity", sketcherEditLastExit);
|
||||
hGrp->RemoveInt("HeadlightIntensityExisting");
|
||||
}
|
||||
// apply the user settings
|
||||
OnChange(*hGrp,"EyeDistance");
|
||||
OnChange(*hGrp,"CornerCoordSystem");
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -3312,19 +3312,32 @@ void ViewProviderSketch::unsetEdit(int ModNum)
|
||||
if (sketchHandler)
|
||||
deactivateHandler();
|
||||
|
||||
// Resets the override draw style mode when leaving the sketch edit mode.
|
||||
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(OverrideMode);
|
||||
viewer->setOverrideMode(OverrideMode);
|
||||
}
|
||||
}
|
||||
|
||||
editCoinManager = nullptr;
|
||||
snapManager = nullptr;
|
||||
preselection.reset();
|
||||
selection.reset();
|
||||
this->detachSelection();
|
||||
|
||||
ParameterGrp::handle hGrpView = App::GetApplication().GetParameterGroupByPath(
|
||||
"User parameter:BaseApp/Preferences/View");
|
||||
|
||||
auto headlightIntensityExisting = hGrpView->GetInt("HeadlightIntensityExisting", 100);
|
||||
hGrpView->SetInt("HeadlightIntensity", headlightIntensityExisting);
|
||||
hGrpView->RemoveInt("HeadlightIntensityExisting");
|
||||
|
||||
App::AutoTransaction trans("Sketch recompute");
|
||||
try {
|
||||
// and update the sketch
|
||||
@@ -3395,13 +3408,23 @@ void ViewProviderSketch::setEditViewer(Gui::View3DInventorViewer* viewer, int Mo
|
||||
}
|
||||
}
|
||||
|
||||
ParameterGrp::handle hGrpView = App::GetApplication().GetParameterGroupByPath(
|
||||
"User parameter:BaseApp/Preferences/View");
|
||||
// Sets the view mode to no shading to prevent visibility issues against parallel surfaces with shininess when entering the sketch mode.
|
||||
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 headlightIntensityExisting = hGrpView->GetInt("HeadlightIntensity", 100);
|
||||
auto headlightIntensityTemp = 50;
|
||||
hGrpView->SetInt("HeadlightIntensity", headlightIntensityTemp);
|
||||
hGrpView->SetInt("HeadlightIntensityExisting", headlightIntensityExisting);
|
||||
|
||||
auto editDoc = Gui::Application::Instance->editDocument();
|
||||
editDocName.clear();
|
||||
|
||||
Reference in New Issue
Block a user