mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-17 15:35:59 +08:00
Speed up QMl binding evaluation for MaterialMenu
This commit is contained in:
parent
eb1ae9f18d
commit
6afd669389
@ -14,11 +14,11 @@ Menu
|
|||||||
|
|
||||||
property int extruderIndex: 0
|
property int extruderIndex: 0
|
||||||
property string currentRootMaterialId: Cura.MachineManager.currentRootMaterialId[extruderIndex]
|
property string currentRootMaterialId: Cura.MachineManager.currentRootMaterialId[extruderIndex]
|
||||||
property string activeMaterialId:
|
property var activeExtruder: Cura.MachineManager.activeMachine.extruderList[extruderIndex]
|
||||||
{
|
property bool isActiveExtruderEnabled: activeExtruder === undefined ? false : activeExtruder.isEnabled
|
||||||
var extruder = Cura.MachineManager.activeMachine.extruderList[extruderIndex]
|
|
||||||
return (extruder === undefined) ? "" : extruder.material.id
|
property string activeMaterialId: activeExtruder === undefined ? false : activeExtruder.material.id
|
||||||
}
|
|
||||||
property bool updateModels: true
|
property bool updateModels: true
|
||||||
Cura.FavoriteMaterialsModel
|
Cura.FavoriteMaterialsModel
|
||||||
{
|
{
|
||||||
@ -54,7 +54,7 @@ Menu
|
|||||||
{
|
{
|
||||||
text: model.brand + " " + model.name
|
text: model.brand + " " + model.name
|
||||||
checkable: true
|
checkable: true
|
||||||
enabled: Cura.MachineManager.activeMachine.extruderList[extruderIndex].isEnabled
|
enabled: isActiveExtruderEnabled
|
||||||
checked: model.root_material_id === menu.currentRootMaterialId
|
checked: model.root_material_id === menu.currentRootMaterialId
|
||||||
onTriggered: Cura.MachineManager.setMaterial(extruderIndex, model.container_node)
|
onTriggered: Cura.MachineManager.setMaterial(extruderIndex, model.container_node)
|
||||||
exclusiveGroup: favoriteGroup // One favorite and one item from the others can be active at the same time.
|
exclusiveGroup: favoriteGroup // One favorite and one item from the others can be active at the same time.
|
||||||
@ -77,11 +77,7 @@ Menu
|
|||||||
{
|
{
|
||||||
text: model.name
|
text: model.name
|
||||||
checkable: true
|
checkable: true
|
||||||
enabled:
|
enabled: isActiveExtruderEnabled
|
||||||
{
|
|
||||||
var extruder = Cura.MachineManager.activeMachine.extruderList[extruderIndex]
|
|
||||||
return (extruder === undefined) ? false : extruder.isEnabled
|
|
||||||
}
|
|
||||||
checked: model.root_material_id === menu.currentRootMaterialId
|
checked: model.root_material_id === menu.currentRootMaterialId
|
||||||
exclusiveGroup: group
|
exclusiveGroup: group
|
||||||
onTriggered: Cura.MachineManager.setMaterial(extruderIndex, model.container_node)
|
onTriggered: Cura.MachineManager.setMaterial(extruderIndex, model.container_node)
|
||||||
@ -120,11 +116,7 @@ Menu
|
|||||||
{
|
{
|
||||||
text: model.name
|
text: model.name
|
||||||
checkable: true
|
checkable: true
|
||||||
enabled:
|
enabled: isActiveExtruderEnabled
|
||||||
{
|
|
||||||
var extruder = Cura.MachineManager.activeMachine.extruderList[extruderIndex]
|
|
||||||
return (extruder === undefined) ? false : extruder.isEnabled
|
|
||||||
}
|
|
||||||
checked: model.id === menu.activeMaterialId
|
checked: model.id === menu.activeMaterialId
|
||||||
exclusiveGroup: group
|
exclusiveGroup: group
|
||||||
onTriggered: Cura.MachineManager.setMaterial(extruderIndex, model.container_node)
|
onTriggered: Cura.MachineManager.setMaterial(extruderIndex, model.container_node)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user