Arch: Added preferences to leave some subcomponents unclaimed by their host object (allows to place them in groups)

This commit is contained in:
Yorik van Havre 2016-08-17 13:21:17 -03:00
parent e739613173
commit 639cb0460a
2 changed files with 82 additions and 4 deletions

View File

@ -751,6 +751,10 @@ class ViewProviderComponent:
def claimChildren(self):
if hasattr(self,"Object"):
prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
swalA = prefs.GetBool("swallowAdditions",True)
swalS = prefs.GetBool("swallowSubtractions",True)
swalW = prefs.GetBool("swallowWindows",True)
c = []
if hasattr(self.Object,"Base"):
if Draft.getType(self.Object) != "Wall":
@ -759,13 +763,16 @@ class ViewProviderComponent:
c = []
else:
c = [self.Object.Base]
if hasattr(self.Object,"Additions"):
if hasattr(self.Object,"Additions") and swalA:
c.extend(self.Object.Additions)
if hasattr(self.Object,"Subtractions"):
if hasattr(self.Object,"Subtractions") and swalS:
for s in self.Object.Subtractions:
if Draft.getType(self.Object) == "Wall":
if Draft.getType(s) == "Roof":
continue
if (Draft.getType(s) == "Window") or Draft.isCloneOf(s,"Window"):
if not swalW:
continue
c.append(s)
if hasattr(self.Object,"Armatures"):
c.extend(self.Object.Armatures)

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>460</width>
<height>602</height>
<width>414</width>
<height>696</height>
</rect>
</property>
<property name="windowTitle">
@ -118,6 +118,77 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_7">
<property name="title">
<string>Tree behaviour</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_14">
<item>
<widget class="QLabel" name="label_4">
<property name="toolTip">
<string>If these options are checked, the respective components will appear under their host object in the tree view. Otherwise, next to them.</string>
</property>
<property name="text">
<string>Swallow </string>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefCheckBox" name="checkBox_5">
<property name="text">
<string>Additions</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>swallowAdditions</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Arch</cstring>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefCheckBox" name="checkBox_6">
<property name="text">
<string>Subtractions</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>swallowSubtractions</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Arch</cstring>
</property>
</widget>
</item>
<item>
<widget class="Gui::PrefCheckBox" name="checkBox_4">
<property name="text">
<string>Windows</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>swallowWindows</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Arch</cstring>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">