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.
This commit is contained in:
Ghostkeeper 2016-11-15 13:10:48 +01:00
parent 2492b03c4f
commit 35a01435d5
No known key found for this signature in database
GPG key ID: C5F96EE2BC0F7E75

View file

@ -112,7 +112,7 @@ class BuildVolume(SceneNode):
per_mesh_stack.propertyChanged.disconnect(self._onSettingPropertyChanged) per_mesh_stack.propertyChanged.disconnect(self._onSettingPropertyChanged)
active_extruder_changed = node.callDecoration("getActiveExtruderChangedSignal") active_extruder_changed = node.callDecoration("getActiveExtruderChangedSignal")
if active_extruder_changed is not None: if active_extruder_changed is not None:
node.callDecoration("getActiveExtruderChangedSignal").disconnect(self._updateDisallowedAreas) node.callDecoration("getActiveExtruderChangedSignal").disconnect(self._updateDisallowedAreasAndRebuild)
node.decoratorsChanged.disconnect(self._onNodeDecoratorChanged) node.decoratorsChanged.disconnect(self._onNodeDecoratorChanged)
self._scene_objects = new_scene_objects self._scene_objects = new_scene_objects
@ -127,8 +127,8 @@ class BuildVolume(SceneNode):
per_mesh_stack.propertyChanged.connect(self._onSettingPropertyChanged) per_mesh_stack.propertyChanged.connect(self._onSettingPropertyChanged)
active_extruder_changed = node.callDecoration("getActiveExtruderChangedSignal") active_extruder_changed = node.callDecoration("getActiveExtruderChangedSignal")
if active_extruder_changed is not None: if active_extruder_changed is not None:
active_extruder_changed.connect(self._updateDisallowedAreas) active_extruder_changed.connect(self._updateDisallowedAreasAndRebuild)
self._updateDisallowedAreas() self._updateDisallowedAreasAndRebuild()
def setWidth(self, width): def setWidth(self, width):
if width: self._width = width if width: self._width = width
@ -391,6 +391,17 @@ class BuildVolume(SceneNode):
def hasErrors(self): def hasErrors(self):
return self._has_errors 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): def _updateDisallowedAreas(self):
if not self._global_container_stack: if not self._global_container_stack:
return return