diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index af6f08c175..02c5c04203 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -266,6 +266,7 @@ class CuraApplication(QtApplication): self.getController().getScene().sceneChanged.connect(self.updatePlatformActivity) self.getController().toolOperationStopped.connect(self._onToolOperationStopped) self.getController().contextMenuRequested.connect(self._onContextMenuRequested) + self.getCuraSceneController().activeBuildPlateChanged.connect(self.updatePlatformActivity) Resources.addType(self.ResourceTypes.QmlFiles, "qml") Resources.addType(self.ResourceTypes.Firmware, "firmware") @@ -890,12 +891,18 @@ class CuraApplication(QtApplication): def getSceneBoundingBoxString(self): return self._i18n_catalog.i18nc("@info 'width', 'depth' and 'height' are variable names that must NOT be translated; just translate the format of ##x##x## mm.", "%(width).1f x %(depth).1f x %(height).1f mm") % {'width' : self._scene_bounding_box.width.item(), 'depth': self._scene_bounding_box.depth.item(), 'height' : self._scene_bounding_box.height.item()} + ## Update scene bounding box for current build plate def updatePlatformActivity(self, node = None): count = 0 scene_bounding_box = None is_block_slicing_node = False + active_build_plate = self.getBuildPlateModel().activeBuildPlate for node in DepthFirstIterator(self.getController().getScene().getRoot()): - if not isinstance(node, SceneNode) or (not node.getMeshData() and not node.callDecoration("getLayerData")): + if ( + not issubclass(type(node), CuraSceneNode) or + (not node.getMeshData() and not node.callDecoration("getLayerData")) or + (node.callDecoration("getBuildPlateNumber") != active_build_plate)): + continue if node.callDecoration("isBlockSlicing"): is_block_slicing_node = True @@ -915,7 +922,7 @@ class CuraApplication(QtApplication): if not scene_bounding_box: scene_bounding_box = AxisAlignedBox.Null - if repr(self._scene_bounding_box) != repr(scene_bounding_box) and scene_bounding_box.isValid(): + if repr(self._scene_bounding_box) != repr(scene_bounding_box): self._scene_bounding_box = scene_bounding_box self.sceneBoundingBoxChanged.emit() diff --git a/cura/Scene/CuraSceneController.py b/cura/Scene/CuraSceneController.py index 652dc78841..a93a8769d0 100644 --- a/cura/Scene/CuraSceneController.py +++ b/cura/Scene/CuraSceneController.py @@ -10,9 +10,12 @@ from UM.Application import Application from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator from UM.Scene.SceneNode import SceneNode from UM.Scene.Selection import Selection +from UM.Signal import Signal class CuraSceneController(QObject): + activeBuildPlateChanged = Signal() + def __init__(self, objects_model: ObjectsModel, build_plate_model: BuildPlateModel): super().__init__() @@ -101,6 +104,7 @@ class CuraSceneController(QObject): self._build_plate_model.setActiveBuildPlate(nr) self._objects_model.setActiveBuildPlate(nr) + self.activeBuildPlateChanged.emit() @staticmethod def createCuraSceneController():