[Arch] [Draft] Add guard for RootNode specific child

This commit is contained in:
Syres916
2024-02-05 11:00:38 +00:00
committed by GitHub
parent 963652c6a7
commit e4bb7a98e2
3 changed files with 31 additions and 28 deletions

View File

@@ -210,11 +210,12 @@ class _ViewProviderProject(ArchIFCView.IfcContextView):
"""
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
if vobj.RootNode.getNumChildren() > 2:
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)