mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Update mesh type dropdown when to reflect the selected object
This commit is contained in:
parent
9c3e50c494
commit
a1320939e8
2 changed files with 37 additions and 1 deletions
|
@ -67,9 +67,32 @@ Item {
|
||||||
type: "cutting_mesh",
|
type: "cutting_mesh",
|
||||||
text: catalog.i18nc("@label", "Modify extruder or settings for overlap with other models")
|
text: catalog.i18nc("@label", "Modify extruder or settings for overlap with other models")
|
||||||
});
|
});
|
||||||
|
|
||||||
|
meshTypeSelection.updateCurrentIndex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateCurrentIndex()
|
||||||
|
{
|
||||||
|
var mesh_type = UM.ActiveTool.properties.getValue("MeshType");
|
||||||
|
for(var index=0; index < meshTypeSelection.model.count; index++)
|
||||||
|
{
|
||||||
|
if(meshTypeSelection.model.get(index).type == mesh_type)
|
||||||
|
{
|
||||||
|
meshTypeSelection.currentIndex = index;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
meshTypeSelection.currentIndex = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections
|
||||||
|
{
|
||||||
|
target: UM.Selection
|
||||||
|
onSelectionChanged: meshTypeSelection.updateCurrentIndex()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Column
|
Column
|
||||||
|
|
|
@ -19,7 +19,7 @@ class PerObjectSettingsTool(Tool):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._model = None
|
self._model = None
|
||||||
|
|
||||||
self.setExposedProperties("SelectedObjectId", "ContainerID", "SelectedActiveExtruder")
|
self.setExposedProperties("SelectedObjectId", "ContainerID", "SelectedActiveExtruder", "MeshType")
|
||||||
|
|
||||||
self._advanced_mode = False
|
self._advanced_mode = False
|
||||||
self._multi_extrusion = False
|
self._multi_extrusion = False
|
||||||
|
@ -91,6 +91,19 @@ class PerObjectSettingsTool(Tool):
|
||||||
new_instance.resetState() # Ensure that the state is not seen as a user state.
|
new_instance.resetState() # Ensure that the state is not seen as a user state.
|
||||||
settings.addInstance(new_instance)
|
settings.addInstance(new_instance)
|
||||||
|
|
||||||
|
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.
|
||||||
|
if not stack:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
settings = stack.getTop()
|
||||||
|
for property_key in ["infill_mesh", "cutting_mesh", "support_mesh", "anti_overhang_mesh"]:
|
||||||
|
if settings.getInstance(property_key) and settings.getProperty(property_key, "value"):
|
||||||
|
return property_key
|
||||||
|
|
||||||
|
return ""
|
||||||
|
|
||||||
def _onPreferenceChanged(self, preference):
|
def _onPreferenceChanged(self, preference):
|
||||||
if preference == "cura/active_mode":
|
if preference == "cura/active_mode":
|
||||||
self._advanced_mode = Preferences.getInstance().getValue(preference) == 1
|
self._advanced_mode = Preferences.getInstance().getValue(preference) == 1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue