Bind current_mesh_type to UM.ActiveTool.properties.getValue("MeshType")

CURA-6683
This commit is contained in:
Nino van Hooff 2019-09-13 10:55:05 +02:00
parent 5db122aff6
commit 184a72f7ab
2 changed files with 15 additions and 14 deletions

View file

@ -66,7 +66,11 @@ class PerObjectSettingsTool(Tool):
selected_object.addDecorator(SettingOverrideDecorator())
selected_object.callDecoration("setActiveExtruder", extruder_stack_id)
def setMeshType(self, mesh_type):
## Returns True when the mesh_type was changed, False when current mesh_type == mesh_type
def setMeshType(self, mesh_type) -> bool:
if self.getMeshType() == mesh_type:
return False
selected_object = Selection.getSelectedObject(0)
stack = selected_object.callDecoration("getStack") #Don't try to get the active extruder since it may be None anyway.
if not stack:
@ -86,6 +90,9 @@ class PerObjectSettingsTool(Tool):
new_instance.resetState() # Ensure that the state is not seen as a user state.
settings.addInstance(new_instance)
self.propertyChanged.emit()
return True
def getMeshType(self):
selected_object = Selection.getSelectedObject(0)
stack = selected_object.callDecoration("getStack") #Don't try to get the active extruder since it may be None anyway.