mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-05 21:13:58 -06:00
Add extruder swatches to object selector
This commit is contained in:
parent
2eeabec317
commit
e13a0bca4a
3 changed files with 44 additions and 2 deletions
|
@ -23,13 +23,26 @@ Button
|
|||
width: objectItemButton.width - objectItemButton.leftPadding
|
||||
height: UM.Theme.getSize("action_button").height
|
||||
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: swatch
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
width: height
|
||||
height: parent.height - UM.Theme.getSize("narrow_margin").height
|
||||
source: UM.Theme.getIcon("extruder_button")
|
||||
color: extruderColor
|
||||
visible: showExtruderSwatches && extruderColor != ""
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
id: buttonText
|
||||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
right: perObjectSettingsInfo.left
|
||||
left: showExtruderSwatches ? swatch.right : parent.left
|
||||
leftMargin: showExtruderSwatches ? UM.Theme.getSize("narrow_margin").width : 0
|
||||
right: perObjectSettingsInfo.visible ? perObjectSettingsInfo.left : parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
text: objectItemButton.text
|
||||
|
|
|
@ -87,6 +87,17 @@ Item
|
|||
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
property var extrudersModel: CuraApplication.getExtrudersModel()
|
||||
UM.SettingPropertyProvider
|
||||
{
|
||||
id: machineExtruderCount
|
||||
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "machine_extruder_count"
|
||||
watchedProperties: [ "value" ]
|
||||
storeIndex: 0
|
||||
}
|
||||
|
||||
ListView
|
||||
{
|
||||
id: listView
|
||||
|
@ -123,6 +134,16 @@ Item
|
|||
property bool outsideBuildArea: model.outside_build_area
|
||||
property int perObjectSettingsCount: model.per_object_settings_count
|
||||
property string meshType: model.mesh_type
|
||||
property int extruderNumber: model.extruder_number
|
||||
property string extruderColor:
|
||||
{
|
||||
if (model.extruder_number == -1)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return contents.extrudersModel.getItem(model.extruder_number).color;
|
||||
}
|
||||
property bool showExtruderSwatches: machineExtruderCount.properties.value > 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue