mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 11:17:49 -06:00
Fix SettingOverrideDecorator for non printing meshes
CURA-4705 - Do not set a "secret" property in the SceneNode to indicate whether a node is a non-printing-mesh because SceneNode will not copy that property during a deepcopy. Store it in the SettingOverrideDecorator and make it accessible through a decorator call - Try to trigger an auto-slice AFTER the non-printing-meshes flag is updated, not before.
This commit is contained in:
parent
a860154831
commit
1a6a6f74d5
1 changed files with 9 additions and 2 deletions
|
@ -37,6 +37,8 @@ class SettingOverrideDecorator(SceneNodeDecorator):
|
||||||
self._stack.addContainer(InstanceContainer(container_id = "SettingOverrideInstanceContainer"))
|
self._stack.addContainer(InstanceContainer(container_id = "SettingOverrideInstanceContainer"))
|
||||||
self._extruder_stack = ExtruderManager.getInstance().getExtruderStack(0).getId()
|
self._extruder_stack = ExtruderManager.getInstance().getExtruderStack(0).getId()
|
||||||
|
|
||||||
|
self._is_non_printing_mesh = False
|
||||||
|
|
||||||
self._stack.propertyChanged.connect(self._onSettingChanged)
|
self._stack.propertyChanged.connect(self._onSettingChanged)
|
||||||
|
|
||||||
Application.getInstance().getContainerRegistry().addContainer(self._stack)
|
Application.getInstance().getContainerRegistry().addContainer(self._stack)
|
||||||
|
@ -57,6 +59,8 @@ class SettingOverrideDecorator(SceneNodeDecorator):
|
||||||
# Properly set the right extruder on the copy
|
# Properly set the right extruder on the copy
|
||||||
deep_copy.setActiveExtruder(self._extruder_stack)
|
deep_copy.setActiveExtruder(self._extruder_stack)
|
||||||
|
|
||||||
|
deep_copy._is_non_printing_mesh = self._is_non_printing_mesh
|
||||||
|
|
||||||
return deep_copy
|
return deep_copy
|
||||||
|
|
||||||
## Gets the currently active extruder to print this object with.
|
## Gets the currently active extruder to print this object with.
|
||||||
|
@ -80,14 +84,17 @@ class SettingOverrideDecorator(SceneNodeDecorator):
|
||||||
container_stack = containers[0]
|
container_stack = containers[0]
|
||||||
return container_stack.getMetaDataEntry("position", default=None)
|
return container_stack.getMetaDataEntry("position", default=None)
|
||||||
|
|
||||||
|
def isNonPrintingMesh(self):
|
||||||
|
return self._is_non_printing_mesh
|
||||||
|
|
||||||
def _onSettingChanged(self, instance, property_name): # Reminder: 'property' is a built-in function
|
def _onSettingChanged(self, instance, property_name): # Reminder: 'property' is a built-in function
|
||||||
# Trigger slice/need slicing if the value has changed.
|
# Trigger slice/need slicing if the value has changed.
|
||||||
if property_name == "value":
|
if property_name == "value":
|
||||||
|
self._is_non_printing_mesh = any(bool(self._stack.getProperty(setting, "value")) for setting in self._non_printing_mesh_settings)
|
||||||
|
|
||||||
Application.getInstance().getBackend().needsSlicing()
|
Application.getInstance().getBackend().needsSlicing()
|
||||||
Application.getInstance().getBackend().tickle()
|
Application.getInstance().getBackend().tickle()
|
||||||
|
|
||||||
self._node._non_printing_mesh = any(self._stack.getProperty(setting, "value") for setting in self._non_printing_mesh_settings)
|
|
||||||
|
|
||||||
## Makes sure that the stack upon which the container stack is placed is
|
## Makes sure that the stack upon which the container stack is placed is
|
||||||
# kept up to date.
|
# kept up to date.
|
||||||
def _updateNextStack(self):
|
def _updateNextStack(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue