mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 23:25:53 +08:00
Update the single setting components to optionally update all extruders when a setting is settable per extruder or limited to extruder.
This forces all extruders to have their settings updated but only displays the value from a single extruder. CURA-9793
This commit is contained in:
parent
540d810293
commit
d7e1aa08ac
@ -39,6 +39,7 @@ RecommendedSettingSection
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
settingName: "infill_sparse_density"
|
settingName: "infill_sparse_density"
|
||||||
roundToNearestTen: true
|
roundToNearestTen: true
|
||||||
|
updateAllExtruders: true
|
||||||
// disable slider when gradual support is enabled
|
// disable slider when gradual support is enabled
|
||||||
enabled: parseInt(infillSteps.properties.value) == 0
|
enabled: parseInt(infillSteps.properties.value) == 0
|
||||||
|
|
||||||
@ -58,11 +59,6 @@ RecommendedSettingSection
|
|||||||
{
|
{
|
||||||
width: parent.width
|
width: parent.width
|
||||||
settingName: "infill_pattern"
|
settingName: "infill_pattern"
|
||||||
|
|
||||||
function updateSetting(value)
|
|
||||||
{
|
|
||||||
Cura.MachineManager.setSettingForAllExtruders("infill_pattern", "value", value)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
RecommendedSettingItem
|
RecommendedSettingItem
|
||||||
|
@ -11,10 +11,17 @@ import Cura 1.7 as Cura
|
|||||||
// This ComboBox allows changing of a single setting. Only the setting name has to be passed in to "settingName".
|
// This ComboBox allows changing of a single setting. Only the setting name has to be passed in to "settingName".
|
||||||
// All of the setting updating logic is handled by this component.
|
// All of the setting updating logic is handled by this component.
|
||||||
// This uses the "options" value of a setting to populate the drop down. This will only work for settings with "options"
|
// This uses the "options" value of a setting to populate the drop down. This will only work for settings with "options"
|
||||||
|
// If the setting is limited to a single extruder or is settable with different values per extruder use "updateAllExtruders: true"
|
||||||
Cura.ComboBox {
|
Cura.ComboBox {
|
||||||
textRole: "text"
|
textRole: "text"
|
||||||
property alias settingName: propertyProvider.key
|
property alias settingName: propertyProvider.key
|
||||||
|
|
||||||
|
// If true, all extruders will have "settingName" property updated.
|
||||||
|
// The displayed value will be read from the extruder with index "defaultExtruderIndex" instead of the machine.
|
||||||
|
property bool updateAllExtruders: false
|
||||||
|
// This is only used if updateAllExtruders == true
|
||||||
|
property int defaultExtruderIndex: 0
|
||||||
|
|
||||||
model: ListModel {
|
model: ListModel {
|
||||||
id: comboboxModel
|
id: comboboxModel
|
||||||
|
|
||||||
@ -47,8 +54,8 @@ Cura.ComboBox {
|
|||||||
property UM.SettingPropertyProvider propertyProvider: UM.SettingPropertyProvider
|
property UM.SettingPropertyProvider propertyProvider: UM.SettingPropertyProvider
|
||||||
{
|
{
|
||||||
id: propertyProvider
|
id: propertyProvider
|
||||||
containerStack: Cura.MachineManager.activeMachine
|
containerStackId: updateAllExtruders ? Cura.ExtruderManager.extruderIds[defaultExtruderIndex] : Cura.MachineManager.activeMachine.id
|
||||||
watchedProperties: [ "value" , "options"]
|
watchedProperties: ["value" , "options"]
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections
|
Connections
|
||||||
@ -71,6 +78,13 @@ Cura.ComboBox {
|
|||||||
|
|
||||||
function updateSetting(value)
|
function updateSetting(value)
|
||||||
{
|
{
|
||||||
propertyProvider.setPropertyValue("value", value)
|
if (updateAllExtruders)
|
||||||
|
{
|
||||||
|
Cura.MachineManager.setSettingForAllExtruders(propertyProvider.key, "value", value)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
propertyProvider.setPropertyValue("value", value)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import QtQuick.Layouts 1.3
|
|||||||
// This silder allows changing of a single setting. Only the setting name has to be passed in to "settingName".
|
// This silder allows changing of a single setting. Only the setting name has to be passed in to "settingName".
|
||||||
// All of the setting updating logic is handled by this component.
|
// All of the setting updating logic is handled by this component.
|
||||||
// This component allows you to choose values between minValue -> maxValue and rounds them to the nearest 10.
|
// This component allows you to choose values between minValue -> maxValue and rounds them to the nearest 10.
|
||||||
|
// If the setting is limited to a single extruder or is settable with different values per extruder use "updateAllExtruders: true"
|
||||||
RowLayout
|
RowLayout
|
||||||
{
|
{
|
||||||
height: childrenRect.height
|
height: childrenRect.height
|
||||||
@ -20,6 +20,12 @@ RowLayout
|
|||||||
property alias settingName: propertyProvider.key
|
property alias settingName: propertyProvider.key
|
||||||
property alias enabled: settingSlider.enabled
|
property alias enabled: settingSlider.enabled
|
||||||
|
|
||||||
|
// If true, all extruders will have "settingName" property updated.
|
||||||
|
// The displayed value will be read from the extruder with index "defaultExtruderIndex" instead of the machine.
|
||||||
|
property bool updateAllExtruders: false
|
||||||
|
// This is only used if updateAllExtruders == true
|
||||||
|
property int defaultExtruderIndex: 0
|
||||||
|
|
||||||
property bool roundToNearestTen: false
|
property bool roundToNearestTen: false
|
||||||
property int maxValue: 100
|
property int maxValue: 100
|
||||||
property int minValue: 0
|
property int minValue: 0
|
||||||
@ -28,8 +34,8 @@ RowLayout
|
|||||||
UM.SettingPropertyProvider
|
UM.SettingPropertyProvider
|
||||||
{
|
{
|
||||||
id: propertyProvider
|
id: propertyProvider
|
||||||
containerStackId: Cura.MachineManager.activeStackId
|
containerStackId: updateAllExtruders ? Cura.ExtruderManager.extruderIds[defaultExtruderIndex] : Cura.MachineManager.activeMachine.id
|
||||||
watchedProperties: [ "value" ]
|
watchedProperties: ["value"]
|
||||||
storeIndex: 0
|
storeIndex: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,6 +105,13 @@ RowLayout
|
|||||||
|
|
||||||
// Override this function to update a setting differently
|
// Override this function to update a setting differently
|
||||||
function updateSetting(value) {
|
function updateSetting(value) {
|
||||||
propertyProvider.setPropertyValue("value", value)
|
if (updateAllExtruders)
|
||||||
|
{
|
||||||
|
Cura.MachineManager.setSettingForAllExtruders(propertyProvider.key, "value", value)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
propertyProvider.setPropertyValue("value", value)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,14 +10,17 @@ import Cura 1.7 as Cura
|
|||||||
|
|
||||||
// This text field allows you to edit a single setting. The setting can be passed by "settingName".
|
// This text field allows you to edit a single setting. The setting can be passed by "settingName".
|
||||||
// You must specify a validator with Validator. We store our default setting validators in qml/Validators
|
// You must specify a validator with Validator. We store our default setting validators in qml/Validators
|
||||||
|
// If the setting is limited to a single extruder or is settable with different values per extruder use "updateAllExtruders: true"
|
||||||
UM.TextField
|
UM.TextField
|
||||||
{
|
{
|
||||||
id: control
|
id: control
|
||||||
property alias settingName: propertyProvider.key
|
property alias settingName: propertyProvider.key
|
||||||
|
|
||||||
// If true, all extruders will have "settingName" property updated.
|
// If true, all extruders will have "settingName" property updated.
|
||||||
// The displayed value will be read from the first extruder instead of the machine.
|
// The displayed value will be read from the extruder with index "defaultExtruderIndex" instead of the machine.
|
||||||
property bool updateAllExtruders: false
|
property bool updateAllExtruders: false
|
||||||
|
// This is only used if updateAllExtruders == true
|
||||||
|
property int defaultExtruderIndex: 0
|
||||||
|
|
||||||
// Resolving the value in the textField.
|
// Resolving the value in the textField.
|
||||||
Binding
|
Binding
|
||||||
@ -49,8 +52,8 @@ UM.TextField
|
|||||||
property UM.SettingPropertyProvider propertyProvider: UM.SettingPropertyProvider
|
property UM.SettingPropertyProvider propertyProvider: UM.SettingPropertyProvider
|
||||||
{
|
{
|
||||||
id: propertyProvider
|
id: propertyProvider
|
||||||
watchedProperties: [ "value", "validationState", "resolve" ]
|
watchedProperties: ["value", "validationState", "resolve"]
|
||||||
containerStackId: updateAllExtruders ? Cura.ExtruderManager.extruderIds[0] : Cura.MachineManager.activeMachine
|
containerStackId: updateAllExtruders ? Cura.ExtruderManager.extruderIds[defaultExtruderIndex] : Cura.MachineManager.activeMachine.id
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections
|
Connections
|
||||||
|
Loading…
x
Reference in New Issue
Block a user