Improve the bindings for the material menu

This way the evaluation is significantly faster.
This commit is contained in:
Jaime van Kessel 2019-02-21 15:26:25 +01:00
parent b2df5c3445
commit 27370dd45d

View file

@ -13,7 +13,8 @@ Menu
title: catalog.i18nc("@label:category menu label", "Material")
property int extruderIndex: 0
property string currentRootMaterialId: Cura.MachineManager.currentRootMaterialId[extruderIndex]
property string activeMaterialId: Cura.MachineManager.allActiveMaterialIds[Cura.ExtruderManager.extruderIds[extruderIndex]]
Cura.FavoriteMaterialsModel
{
id: favoriteMaterialsModel
@ -45,7 +46,7 @@ Menu
{
text: model.brand + " " + model.name
checkable: true
checked: model.root_material_id == Cura.MachineManager.currentRootMaterialId[extruderIndex]
checked: model.root_material_id === menu.currentRootMaterialId
onTriggered: Cura.MachineManager.setMaterial(extruderIndex, model.container_node)
exclusiveGroup: group
}
@ -67,7 +68,7 @@ Menu
{
text: model.name
checkable: true
checked: model.root_material_id == Cura.MachineManager.currentRootMaterialId[extruderIndex]
checked: model.root_material_id === menu.currentRootMaterialId
exclusiveGroup: group
onTriggered: Cura.MachineManager.setMaterial(extruderIndex, model.container_node)
}
@ -105,7 +106,7 @@ Menu
{
text: model.name
checkable: true
checked: model.id == Cura.MachineManager.allActiveMaterialIds[Cura.ExtruderManager.extruderIds[extruderIndex]]
checked: model.id === menu.activeMaterialId
exclusiveGroup: group
onTriggered: Cura.MachineManager.setMaterial(extruderIndex, model.container_node)
}