Arch: Arch_Project avoid ghosts of objects in Group

This commit is contained in:
Roy-043
2024-01-01 15:38:29 +01:00
committed by Yorik van Havre
parent 1630c44067
commit 72aaf182ea

View File

@@ -200,5 +200,24 @@ class _ViewProviderProject(ArchIFCView.IfcContextView):
import Arch_rc
return ":/icons/Arch_Project_Tree.svg"
def removeDisplaymodeChildNodes(self,vobj):
"""Remove all child nodes from the 4 default display modes.
This avoids 'ghosts' of the objects in the Group property.
See:
ArchSite.py
https://forum.freecad.org/viewtopic.php?f=10&t=74731
"""
if not hasattr(self, "displaymodes_cleaned"):
main_switch = vobj.RootNode.getChild(2) # The display mode switch.
if main_switch is not None and main_switch.getNumChildren() == 4: # Check if all display modes are available.
for node in tuple(main_switch.getChildren()):
node.removeAllChildren()
self.displaymodes_cleaned = True
def onChanged(self,vobj,prop):
self.removeDisplaymodeChildNodes(vobj)
if FreeCAD.GuiUp:
FreeCADGui.addCommand('Arch_Project', _CommandProject())