From 35a01435d59499b9471c9063eb9d8b5ffa36aa80 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 15 Nov 2016 13:10:48 +0100 Subject: [PATCH] Also rebuild when mesh extruder changes I do not want to add the rebuild() call to the update function itself since there may be other changes to the build volume before we should rebuild (such as raft). Contributes to issue CURA-2625. --- cura/BuildVolume.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/cura/BuildVolume.py b/cura/BuildVolume.py index 42ec6886f7..b45f878a36 100644 --- a/cura/BuildVolume.py +++ b/cura/BuildVolume.py @@ -112,7 +112,7 @@ class BuildVolume(SceneNode): per_mesh_stack.propertyChanged.disconnect(self._onSettingPropertyChanged) active_extruder_changed = node.callDecoration("getActiveExtruderChangedSignal") if active_extruder_changed is not None: - node.callDecoration("getActiveExtruderChangedSignal").disconnect(self._updateDisallowedAreas) + node.callDecoration("getActiveExtruderChangedSignal").disconnect(self._updateDisallowedAreasAndRebuild) node.decoratorsChanged.disconnect(self._onNodeDecoratorChanged) self._scene_objects = new_scene_objects @@ -127,8 +127,8 @@ class BuildVolume(SceneNode): per_mesh_stack.propertyChanged.connect(self._onSettingPropertyChanged) active_extruder_changed = node.callDecoration("getActiveExtruderChangedSignal") if active_extruder_changed is not None: - active_extruder_changed.connect(self._updateDisallowedAreas) - self._updateDisallowedAreas() + active_extruder_changed.connect(self._updateDisallowedAreasAndRebuild) + self._updateDisallowedAreasAndRebuild() def setWidth(self, width): if width: self._width = width @@ -391,6 +391,17 @@ class BuildVolume(SceneNode): def hasErrors(self): return self._has_errors + ## Calls _updateDisallowedAreas and makes sure the changes appear in the + # scene. + # + # This is required for a signal to trigger the update in one go. The + # ``_updateDisallowedAreas`` method itself shouldn't call ``rebuild``, + # since there may be other changes before it needs to be rebuilt, which + # would hit performance. + def _updateDisallowedAreasAndRebuild(self): + self._updateDisallowedAreas() + self.rebuild() + def _updateDisallowedAreas(self): if not self._global_container_stack: return