From ad1b1e04555f9b563968ad866ace615a82c00a27 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 5 May 2017 17:13:32 +0200 Subject: [PATCH] Detect whether the current infill is gradual And highlight the correct infill button in that case. Contributes to issue CURA-3732. --- resources/qml/SidebarSimple.qml | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index 7dd7c9e25d..683b5eb716 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -64,10 +64,11 @@ Item id: infillListView property int activeIndex: { - var density = parseInt(infillDensity.properties.value) + var density = parseInt(infillDensity.properties.value); + var steps = parseInt(infillSteps.properties.value); for(var i = 0; i < infillModel.count; ++i) { - if(density > infillModel.get(i).percentageMin && density <= infillModel.get(i).percentageMax ) + if(density > infillModel.get(i).percentageMin && density <= infillModel.get(i).percentageMax && steps > infillModel.get(i).stepsMin && steps <= infillModel.get(i).stepsMax) { return i; } @@ -187,6 +188,8 @@ Item steps: 0, percentageMin: -1, percentageMax: 0, + stepsMin: -1, + stepsMax: 0, text: catalog.i18nc("@label", "Empty infill will leave your model hollow with low strength"), icon: "hollow" }) @@ -196,6 +199,8 @@ Item steps: 0, percentageMin: 0, percentageMax: 30, + stepsMin: -1, + stepsMax: 0, text: catalog.i18nc("@label", "Light (20%) infill will give your model an average strength"), icon: "sparse" }) @@ -205,6 +210,8 @@ Item steps: 0, percentageMin: 30, percentageMax: 70, + stepsMin: -1, + stepsMax: 0, text: catalog.i18nc("@label", "Dense (50%) infill will give your model an above average strength"), icon: "dense" }) @@ -213,7 +220,9 @@ Item percentage: 100, steps: 0, percentageMin: 70, - percentageMax: 100, + percentageMax: 9999999999, + stepsMin: -1, + stepsMax: 0, text: catalog.i18nc("@label", "Solid (100%) infill will make your model completely solid"), icon: "solid" }) @@ -221,6 +230,10 @@ Item name: catalog.i18nc("@label", "Gradual"), percentage: 90, steps: 5, + percentageMin: 0, + percentageMax: 9999999999, + stepsMin: 0, + stepsMax: 9999999999, infill_layer_height: 1.5, text: catalog.i18nc("@label", "This will gradually increase the amount of infill towards the top"), icon: "gradual" @@ -511,6 +524,16 @@ Item storeIndex: 0 } + UM.SettingPropertyProvider + { + id: infillSteps + + containerStackId: Cura.MachineManager.activeStackId + key: "gradual_infill_steps" + watchedProperties: [ "value" ] + storeIndex: 0 + } + UM.SettingPropertyProvider { id: platformAdhesionType