Take node groups into account when computing the centre of the mesh group

These groups were not considered because they are not sliceable. Their children are sliceable, so I could just use a DepthFirstIterator. However their group computes the AABB correctly also, so taking the AABB of the group is more efficient.

Contributes to issue CURA-7118.
This commit is contained in:
Ghostkeeper 2020-09-08 17:54:09 +02:00
parent d3e5f9ec93
commit 765004cd68
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

@ -5,7 +5,6 @@ from PyQt5.QtCore import QTimer
from UM.Application import Application from UM.Application import Application
from UM.Math.Polygon import Polygon from UM.Math.Polygon import Polygon
from UM.Scene.SceneNodeDecorator import SceneNodeDecorator from UM.Scene.SceneNodeDecorator import SceneNodeDecorator
from UM.Settings.ContainerRegistry import ContainerRegistry from UM.Settings.ContainerRegistry import ContainerRegistry
@ -398,7 +397,7 @@ class ConvexHullDecorator(SceneNodeDecorator):
# Find the bounding box of the entire scene, which is all one mesh group then. # Find the bounding box of the entire scene, which is all one mesh group then.
aabb = None aabb = None
for printed_node in self._root.getChildren(): for printed_node in self._root.getChildren():
if not printed_node.callDecoration("isSliceable"): if not printed_node.callDecoration("isSliceable") and not printed_node.callDecoration("isGroup"):
continue # Not a printed node. continue # Not a printed node.
if aabb is None: if aabb is None:
aabb = printed_node.getBoundingBox() aabb = printed_node.getBoundingBox()