From ff99c4e45f5a88ab303740a46b6fca0a5b36b2df Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 26 Mar 2019 10:00:10 +0100 Subject: [PATCH] Don't include group nodes in AABB In fact, don't include any node that would just have a position rather than actual data. The rest of the code is robust anyway against there being no AABB. Contributes to issue CURA-6416. --- cura/Scene/CuraSceneNode.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cura/Scene/CuraSceneNode.py b/cura/Scene/CuraSceneNode.py index 259c273329..4fd8f2b983 100644 --- a/cura/Scene/CuraSceneNode.py +++ b/cura/Scene/CuraSceneNode.py @@ -112,21 +112,21 @@ class CuraSceneNode(SceneNode): ## Override of SceneNode._calculateAABB to exclude non-printing-meshes from bounding box def _calculateAABB(self) -> None: + self._aabb = None if self._mesh_data: - aabb = self._mesh_data.getExtents(self.getWorldTransformation()) - else: # If there is no mesh_data, use a boundingbox that encompasses the local (0,0,0) - position = self.getWorldPosition() - aabb = AxisAlignedBox(minimum = position, maximum = position) + self._aabb = self._mesh_data.getExtents(self.getWorldTransformation()) for child in self._children: if child.callDecoration("isNonPrintingMesh"): # Non-printing-meshes inside a group should not affect push apart or drop to build plate continue - if aabb is None: - aabb = child.getBoundingBox() + if not child._mesh_data: + # Nodes without mesh data should not affect bounding boxes of their parents. + continue + if self._aabb is None: + self._aabb = child.getBoundingBox() else: - aabb = aabb + child.getBoundingBox() - self._aabb = aabb + self._aabb = self._aabb + child.getBoundingBox() ## Taken from SceneNode, but replaced SceneNode with CuraSceneNode def __deepcopy__(self, memo: Dict[int, object]) -> "CuraSceneNode":