Set a property for non-printing-meshes

Remove code duplication
This commit is contained in:
fieldOfView 2017-11-09 12:28:55 +01:00
parent ff14db9133
commit 0b11117d6d
3 changed files with 14 additions and 18 deletions

View file

@ -22,6 +22,14 @@ class SettingOverrideDecorator(SceneNodeDecorator):
## Event indicating that the user selected a different extruder.
activeExtruderChanged = Signal()
## Non-printing meshes
#
# If these settings are True for any mesh, the mesh does not need a convex hull,
# and is sent to the slicer regardless of whether it fits inside the build volume.
# Note that Support Mesh is not in here because it actually generates
# g-code in the volume of the mesh.
_non_printing_mesh_settings = {"anti_overhang_mesh", "infill_mesh", "cutting_mesh"}
def __init__(self):
super().__init__()
self._stack = PerObjectContainerStack(stack_id = id(self))
@ -82,6 +90,8 @@ class SettingOverrideDecorator(SceneNodeDecorator):
Application.getInstance().getBackend().needsSlicing()
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
# kept up to date.
def _updateNextStack(self):