Add colour scheme for line width

Implements CURA-7741.
This commit is contained in:
Ghostkeeper 2021-02-18 14:09:17 +01:00
parent 0c9175d7f7
commit dc68fbc94a
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A
5 changed files with 68 additions and 3 deletions

View file

@ -89,6 +89,7 @@ Cura.ExpandableComponent
property bool show_gradient: UM.SimulationView.compatibilityMode ? false : UM.Preferences.getValue("layerview/layer_view_type") == 2 || UM.Preferences.getValue("layerview/layer_view_type") == 3
property bool show_feedrate_gradient: show_gradient && UM.Preferences.getValue("layerview/layer_view_type") == 2
property bool show_thickness_gradient: show_gradient && UM.Preferences.getValue("layerview/layer_view_type") == 3
property bool show_line_width_gradient: show_gradient && UM.Preferences.getValue("layerview/layer_view_type") == 4
property bool only_show_top_layers: UM.Preferences.getValue("view/only_show_top_layers")
property int top_layer_count: UM.Preferences.getValue("view/top_layer_count")
@ -117,9 +118,13 @@ Cura.ExpandableComponent
type_id: 2
})
layerViewTypes.append({
text: catalog.i18nc("@label:listbox", "Layer thickness"),
text: catalog.i18nc("@label:listbox", "Layer Thickness"),
type_id: 3 // these ids match the switching in the shader
})
layerViewTypes.append({
text: catalog.i18nc("@label:listbox", "Line Width"),
type_id: 4
})
}
ComboBox
@ -145,9 +150,10 @@ Cura.ExpandableComponent
{
// Update the visibility of the legends.
viewSettings.show_legend = UM.SimulationView.compatibilityMode || (type_id == 1);
viewSettings.show_gradient = !UM.SimulationView.compatibilityMode && (type_id == 2 || type_id == 3);
viewSettings.show_gradient = !UM.SimulationView.compatibilityMode && (type_id == 2 || type_id == 3 || type_id == 4);
viewSettings.show_feedrate_gradient = viewSettings.show_gradient && (type_id == 2);
viewSettings.show_thickness_gradient = viewSettings.show_gradient && (type_id == 3);
viewSettings.show_line_width_gradient = viewSettings.show_gradient && (type_id == 4);
}
}
@ -390,6 +396,11 @@ Cura.ExpandableComponent
{
return parseFloat(UM.SimulationView.getMinThickness()).toFixed(2)
}
//Line width selected
if(UM.Preferences.getValue("layerview/layer_view_type") == 4)
{
return parseFloat(UM.SimulationView.getMinLineWidth()).toFixed(2);
}
}
return catalog.i18nc("@label","min")
}
@ -415,6 +426,11 @@ Cura.ExpandableComponent
{
return "mm"
}
//Line width selected
if(UM.Preferences.getValue("layerview/layer_view_type") == 4)
{
return "mm"
}
}
return ""
}
@ -439,6 +455,11 @@ Cura.ExpandableComponent
{
return parseFloat(UM.SimulationView.getMaxThickness()).toFixed(2)
}
//Line width selected
if(UM.Preferences.getValue("layerview/layer_view_type") == 4)
{
return parseFloat(UM.SimulationView.getMaxLineWidth()).toFixed(2);
}
}
return catalog.i18nc("@label","max")
}
@ -453,7 +474,7 @@ Cura.ExpandableComponent
Rectangle
{
id: feedrateGradient
visible: viewSettings.show_feedrate_gradient
visible: viewSettings.show_feedrate_gradient || viewSettings.show_line_width_gradient
anchors.left: parent.left
anchors.right: parent.right
height: Math.round(UM.Theme.getSize("layerview_row").height * 1.5)