From 871b945cf6c052bdd85794d16abc745f62bac708 Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Fri, 13 Jul 2018 11:21:33 +0800 Subject: [PATCH] assembly: use new API canAddToSceneGraph() --- assembly.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/assembly.py b/assembly.py index a25bcd3..417d377 100644 --- a/assembly.py +++ b/assembly.py @@ -90,7 +90,8 @@ class ViewProviderAsmBase(object): vobj.Proxy = self self.attach(vobj) - _addToSceneGraph = False + def canAddToSceneGraph(self): + return False def attach(self,vobj): if hasattr(self,'ViewObject'): @@ -98,8 +99,6 @@ class ViewProviderAsmBase(object): self.ViewObject = vobj vobj.signalChangeIcon() vobj.setPropertyStatus('Visibility','Hidden') - if not self._addToSceneGraph: - vobj.Document.ActiveView.getSceneGraph().removeChild(vobj.RootNode) def __getstate__(self): return None @@ -2358,7 +2357,6 @@ class Assembly(AsmGroup): class ViewProviderAssembly(ViewProviderAsmGroup): _iconName = 'Assembly_Assembly_Frozen_Tree.svg' - _addToSceneGraph = True def __init__(self,vobj): self._movingPart = None @@ -2369,6 +2367,9 @@ class ViewProviderAssembly(ViewProviderAsmGroup): if not hasattr(vobj,'ShowParts'): vobj.addProperty("App::PropertyBool","ShowParts"," Link") + def canAddToSceneGraph(self): + return True + def onDelete(self,vobj,_subs): assembly = vobj.Object.Proxy for o in assembly.getPartGroup().Group: