mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 17:39:03 +08:00
Merge branch 'gradual_infill' into 3.0
This commit is contained in:
commit
ed551cdc2b
@ -393,12 +393,19 @@ Item
|
|||||||
anchors.leftMargin: (infillSlider.value / infillSlider.stepSize) * (infillSlider.width / (infillSlider.maximumValue / infillSlider.stepSize)) - 10 * screenScaleFactor
|
anchors.leftMargin: (infillSlider.value / infillSlider.stepSize) * (infillSlider.width / (infillSlider.maximumValue / infillSlider.stepSize)) - 10 * screenScaleFactor
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
||||||
text: infillSlider.value + "%"
|
text: parseInt(infillDensity.properties.value) + "%"
|
||||||
horizontalAlignment: Text.AlignLeft
|
horizontalAlignment: Text.AlignLeft
|
||||||
|
|
||||||
color: infillSlider.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable")
|
color: infillSlider.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We use a binding to make sure that after manually setting infillSlider.value it is still bound to the property provider
|
||||||
|
Binding {
|
||||||
|
target: infillSlider
|
||||||
|
property: "value"
|
||||||
|
value: parseInt(infillDensity.properties.value)
|
||||||
|
}
|
||||||
|
|
||||||
Slider
|
Slider
|
||||||
{
|
{
|
||||||
id: infillSlider
|
id: infillSlider
|
||||||
@ -413,7 +420,7 @@ Item
|
|||||||
|
|
||||||
minimumValue: 0
|
minimumValue: 0
|
||||||
maximumValue: 100
|
maximumValue: 100
|
||||||
stepSize: (parseInt(infillDensity.properties.value) % 10 == 0) ? 10 : 1
|
stepSize: 1
|
||||||
tickmarksEnabled: true
|
tickmarksEnabled: true
|
||||||
|
|
||||||
// disable slider when gradual support is enabled
|
// disable slider when gradual support is enabled
|
||||||
@ -423,8 +430,20 @@ Item
|
|||||||
value: parseInt(infillDensity.properties.value)
|
value: parseInt(infillDensity.properties.value)
|
||||||
|
|
||||||
onValueChanged: {
|
onValueChanged: {
|
||||||
|
|
||||||
|
// Don't round the value if it's already the same
|
||||||
|
if (parseInt(infillDensity.properties.value) == infillSlider.value) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Round the slider value to the nearest multiple of 10 (simulate step size of 10)
|
||||||
|
var roundedSliderValue = Math.round(infillSlider.value / 10) * 10
|
||||||
|
|
||||||
|
// Update the slider value to represent the rounded value
|
||||||
|
infillSlider.value = roundedSliderValue
|
||||||
|
|
||||||
// Explicitly cast to string to make sure the value passed to Python is an integer.
|
// Explicitly cast to string to make sure the value passed to Python is an integer.
|
||||||
infillDensity.setPropertyValue("value", String(parseInt(infillSlider.value)))
|
infillDensity.setPropertyValue("value", String(roundedSliderValue))
|
||||||
}
|
}
|
||||||
|
|
||||||
style: SliderStyle
|
style: SliderStyle
|
||||||
@ -454,7 +473,7 @@ Item
|
|||||||
|
|
||||||
// check if a tick should be shown based on it's index and wether the infill density is a multiple of 10 (slider step size)
|
// check if a tick should be shown based on it's index and wether the infill density is a multiple of 10 (slider step size)
|
||||||
function shouldShowTick (index) {
|
function shouldShowTick (index) {
|
||||||
if ((parseInt(infillDensity.properties.value) % 10 == 0) || (index % 10 == 0)) {
|
if (index % 10 == 0) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
@ -548,11 +567,17 @@ Item
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
|
property var previousInfillDensity: parseInt(infillDensity.properties.value)
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
// Restore to 90% only when enabling gradual infill
|
// Set to 90% only when enabling gradual infill
|
||||||
if (parseInt(infillSteps.properties.value) == 0) {
|
if (parseInt(infillSteps.properties.value) == 0) {
|
||||||
infillDensity.setPropertyValue("value", 90)
|
previousInfillDensity = parseInt(infillDensity.properties.value)
|
||||||
|
infillDensity.setPropertyValue("value", String(90))
|
||||||
|
} else {
|
||||||
|
infillDensity.setPropertyValue("value", String(previousInfillDensity))
|
||||||
}
|
}
|
||||||
|
|
||||||
infillSteps.setPropertyValue("value", (parseInt(infillSteps.properties.value) == 0) ? 5 : 0)
|
infillSteps.setPropertyValue("value", (parseInt(infillSteps.properties.value) == 0) ? 5 : 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -891,7 +916,6 @@ Item
|
|||||||
UM.SettingPropertyProvider
|
UM.SettingPropertyProvider
|
||||||
{
|
{
|
||||||
id: platformAdhesionType
|
id: platformAdhesionType
|
||||||
|
|
||||||
containerStackId: Cura.MachineManager.activeMachineId
|
containerStackId: Cura.MachineManager.activeMachineId
|
||||||
key: "adhesion_type"
|
key: "adhesion_type"
|
||||||
watchedProperties: [ "value", "enabled" ]
|
watchedProperties: [ "value", "enabled" ]
|
||||||
@ -901,7 +925,6 @@ Item
|
|||||||
UM.SettingPropertyProvider
|
UM.SettingPropertyProvider
|
||||||
{
|
{
|
||||||
id: supportEnabled
|
id: supportEnabled
|
||||||
|
|
||||||
containerStackId: Cura.MachineManager.activeMachineId
|
containerStackId: Cura.MachineManager.activeMachineId
|
||||||
key: "support_enable"
|
key: "support_enable"
|
||||||
watchedProperties: [ "value", "enabled", "description" ]
|
watchedProperties: [ "value", "enabled", "description" ]
|
||||||
@ -911,7 +934,6 @@ Item
|
|||||||
UM.SettingPropertyProvider
|
UM.SettingPropertyProvider
|
||||||
{
|
{
|
||||||
id: machineExtruderCount
|
id: machineExtruderCount
|
||||||
|
|
||||||
containerStackId: Cura.MachineManager.activeMachineId
|
containerStackId: Cura.MachineManager.activeMachineId
|
||||||
key: "machine_extruder_count"
|
key: "machine_extruder_count"
|
||||||
watchedProperties: [ "value" ]
|
watchedProperties: [ "value" ]
|
||||||
@ -921,7 +943,6 @@ Item
|
|||||||
UM.SettingPropertyProvider
|
UM.SettingPropertyProvider
|
||||||
{
|
{
|
||||||
id: supportExtruderNr
|
id: supportExtruderNr
|
||||||
|
|
||||||
containerStackId: Cura.MachineManager.activeMachineId
|
containerStackId: Cura.MachineManager.activeMachineId
|
||||||
key: "support_extruder_nr"
|
key: "support_extruder_nr"
|
||||||
watchedProperties: [ "value" ]
|
watchedProperties: [ "value" ]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user