Gradual infill stepping 1 by 1 and remembering previous value - CURA-4397

This commit is contained in:
Diego Prado Gesto 2017-10-05 15:22:39 +02:00
parent f2ecf41ab1
commit 17183316db

View File

@ -413,7 +413,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
@ -454,7 +454,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 +548,17 @@ Item
hoverEnabled: true hoverEnabled: true
enabled: true enabled: true
property var previousInfillDensity: infillDensity.properties.value
onClicked: { onClicked: {
// Restore to 90% only when enabling gradual infill // Restore to 90% only when enabling gradual infill
if (parseInt(infillSteps.properties.value) == 0) { if (parseInt(infillSteps.properties.value) == 0) {
previousInfillDensity = infillDensity.properties.value
infillDensity.setPropertyValue("value", 90) infillDensity.setPropertyValue("value", 90)
} }
else {
infillDensity.setPropertyValue("value", previousInfillDensity)
}
infillSteps.setPropertyValue("value", (parseInt(infillSteps.properties.value) == 0) ? 5 : 0) infillSteps.setPropertyValue("value", (parseInt(infillSteps.properties.value) == 0) ? 5 : 0)
} }
@ -891,7 +897,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 +906,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 +915,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 +924,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" ]