From 7f34d7615e48e9a1fb7f2feec9fb549d62ae0523 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 8 Jun 2018 16:56:52 +0200 Subject: [PATCH] CURA-5330 Add typing to CuraSceneNode --- cura/Scene/CuraSceneNode.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cura/Scene/CuraSceneNode.py b/cura/Scene/CuraSceneNode.py index b6f9daaa67..259c273329 100644 --- a/cura/Scene/CuraSceneNode.py +++ b/cura/Scene/CuraSceneNode.py @@ -39,6 +39,9 @@ class CuraSceneNode(SceneNode): # TODO The best way to do it is by adding the setActiveExtruder decorator to every node when is loaded def getPrintingExtruder(self) -> Optional[ExtruderStack]: global_container_stack = Application.getInstance().getGlobalContainerStack() + if global_container_stack is None: + return None + per_mesh_stack = self.callDecoration("getStack") extruders = list(global_container_stack.extruders.values()) @@ -85,10 +88,10 @@ class CuraSceneNode(SceneNode): ## Return if the provided bbox collides with the bbox of this scene node def collidesWithBbox(self, check_bbox: AxisAlignedBox) -> bool: bbox = self.getBoundingBox() - - # Mark the node as outside the build volume if the bounding box test fails. - if check_bbox.intersectsBox(bbox) != AxisAlignedBox.IntersectionResult.FullIntersection: - return True + if bbox is not None: + # Mark the node as outside the build volume if the bounding box test fails. + if check_bbox.intersectsBox(bbox) != AxisAlignedBox.IntersectionResult.FullIntersection: + return True return False