From 302706be386edbc8fe1b9fb51f0f55a2c0b77f57 Mon Sep 17 00:00:00 2001 From: Kacper Donat Date: Sat, 11 May 2024 16:46:32 +0200 Subject: [PATCH] Gui: Add ability to disable single-solid rule by default --- .../PreferencePages/DlgSettingsGeneral.cpp | 2 +- src/Mod/Part/Gui/DlgSettingsGeneral.cpp | 2 + src/Mod/Part/Gui/DlgSettingsGeneral.ui | 53 ++++++++++++++++--- src/Mod/PartDesign/App/Feature.cpp | 6 +++ 4 files changed, 56 insertions(+), 7 deletions(-) diff --git a/src/Gui/PreferencePages/DlgSettingsGeneral.cpp b/src/Gui/PreferencePages/DlgSettingsGeneral.cpp index 24c632801a..4e367e6c71 100644 --- a/src/Gui/PreferencePages/DlgSettingsGeneral.cpp +++ b/src/Gui/PreferencePages/DlgSettingsGeneral.cpp @@ -712,4 +712,4 @@ void DlgSettingsGeneral::attachObserver() handlers.addHandler(ParamKey(hDockWindows->GetGroup("DAGView"), "Enabled"), applyDockWidget); } -#include "moc_DlgSettingsGeneral.cpp" +#include "moc_DlgSettingsGeneral.cpp" \ No newline at end of file diff --git a/src/Mod/Part/Gui/DlgSettingsGeneral.cpp b/src/Mod/Part/Gui/DlgSettingsGeneral.cpp index f9b9545005..f02345f2c9 100644 --- a/src/Mod/Part/Gui/DlgSettingsGeneral.cpp +++ b/src/Mod/Part/Gui/DlgSettingsGeneral.cpp @@ -60,6 +60,7 @@ void DlgSettingsGeneral::saveSettings() ui->checkBooleanRefine->onSave(); ui->checkSketchBaseRefine->onSave(); ui->checkObjectNaming->onSave(); + ui->checkAllowCompoundBody->onSave(); } void DlgSettingsGeneral::loadSettings() @@ -68,6 +69,7 @@ void DlgSettingsGeneral::loadSettings() ui->checkBooleanRefine->onRestore(); ui->checkSketchBaseRefine->onRestore(); ui->checkObjectNaming->onRestore(); + ui->checkAllowCompoundBody->onRestore(); } /** diff --git a/src/Mod/Part/Gui/DlgSettingsGeneral.ui b/src/Mod/Part/Gui/DlgSettingsGeneral.ui index 8e7e540da7..931175dff1 100644 --- a/src/Mod/Part/Gui/DlgSettingsGeneral.ui +++ b/src/Mod/Part/Gui/DlgSettingsGeneral.ui @@ -13,8 +13,8 @@ General - - + + Model settings @@ -62,14 +62,17 @@ - + - - Object naming + + true false + + Object naming + @@ -87,7 +90,45 @@ - + + + + true + + + Experimental + + + false + + + + + + These settings are experimental and may result in decreased stability, more problems and undefined behaviors. + + + true + + + + + + + Allow multiple solids in Part Design Body by default (experimental) + + + AllowCompoundDefault + + + Mod/PartDesign + + + + + + + Qt::Vertical diff --git a/src/Mod/PartDesign/App/Feature.cpp b/src/Mod/PartDesign/App/Feature.cpp index fe6e1eeadd..d3c24e76d3 100644 --- a/src/Mod/PartDesign/App/Feature.cpp +++ b/src/Mod/PartDesign/App/Feature.cpp @@ -180,6 +180,12 @@ bool Feature::isSingleSolidRuleSatisfied(const TopoDS_Shape& shape, TopAbs_Shape Feature::SingleSolidRuleMode Feature::singleSolidRuleMode() { auto body = getFeatureBody(); + + // When the feature is not part of an body (which should not happen) let's stay with the default + if (!body) { + return SingleSolidRuleMode::Enforced; + } + auto areCompoundSolidsAllowed = body->AllowCompound.getValue(); return areCompoundSolidsAllowed ? SingleSolidRuleMode::Disabled : SingleSolidRuleMode::Enforced;