mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 14:37:29 -06:00
Add extruder selection to Context menu
Contributes to CURA-3609
This commit is contained in:
parent
9fd0239cd5
commit
e108bd0627
1 changed files with 30 additions and 0 deletions
|
@ -13,11 +13,32 @@ Menu
|
|||
{
|
||||
id: base
|
||||
|
||||
property bool shouldShowExtruders: machineExtruderCount.properties.value > 1;
|
||||
|
||||
// Selection-related actions.
|
||||
MenuItem { action: Cura.Actions.centerSelection; }
|
||||
MenuItem { action: Cura.Actions.deleteSelection; }
|
||||
MenuItem { action: Cura.Actions.multiplySelection; }
|
||||
|
||||
// Extruder selection - only visible if there is more than 1 extruder
|
||||
MenuSeparator { visible: base.shouldShowExtruders }
|
||||
MenuItem { id: extruderHeader; text: catalog.i18ncp("@label", "Print Selected Model With:", "Print Selected Models With:", UM.Selection.selectionCount); enabled: false; visible: base.shouldShowExtruders }
|
||||
Instantiator
|
||||
{
|
||||
model: Cura.ExtrudersModel { id: extrudersModel }
|
||||
MenuItem {
|
||||
text: "%1: %2 - %3".arg(model.name).arg(model.material).arg(model.variant)
|
||||
visible: base.shouldShowExtruders
|
||||
enabled: UM.Selection.hasSelection
|
||||
checkable: true
|
||||
checked: ExtruderManager.selectedObjectExtruders.indexOf(model.id) != -1
|
||||
onTriggered: CuraActions.setSelectionExtruder(model.id)
|
||||
shortcut: "Ctrl+" + (model.index + 1)
|
||||
}
|
||||
onObjectAdded: base.insertItem(base.findItemIndex(extruderHeader) + index, object)
|
||||
onObjectRemoved: base.removeItem(object)
|
||||
}
|
||||
|
||||
// Global actions
|
||||
MenuSeparator { }
|
||||
MenuItem { action: Cura.Actions.selectAll; }
|
||||
|
@ -45,6 +66,15 @@ Menu
|
|||
onTriggered: multiplyDialog.open()
|
||||
}
|
||||
|
||||
UM.SettingPropertyProvider
|
||||
{
|
||||
id: machineExtruderCount
|
||||
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
key: "machine_extruder_count"
|
||||
watchedProperties: [ "value" ]
|
||||
}
|
||||
|
||||
Dialog
|
||||
{
|
||||
id: multiplyDialog
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue