mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-12 01:07:52 -06:00
Remove cache of material manager
It doesn't make the code much simpler because the cache is also not a local variable. Contributes to issue CURA-6679.
This commit is contained in:
parent
33739ea7a8
commit
be4e754984
4 changed files with 8 additions and 11 deletions
|
@ -13,7 +13,6 @@ Item
|
|||
{
|
||||
id: base
|
||||
|
||||
property QtObject materialManager: CuraApplication.getMaterialManager()
|
||||
// Keep PreferencesDialog happy
|
||||
property var resetEnabled: false
|
||||
property var currentItem: null
|
||||
|
@ -119,7 +118,7 @@ Item
|
|||
onClicked:
|
||||
{
|
||||
forceActiveFocus();
|
||||
base.newRootMaterialIdToSwitchTo = base.materialManager.createMaterial();
|
||||
base.newRootMaterialIdToSwitchTo = CuraApplication.getMaterialManager().createMaterial();
|
||||
base.toActivateNewMaterial = true;
|
||||
}
|
||||
}
|
||||
|
@ -134,7 +133,7 @@ Item
|
|||
onClicked:
|
||||
{
|
||||
forceActiveFocus();
|
||||
base.newRootMaterialIdToSwitchTo = base.materialManager.duplicateMaterial(base.currentItem.container_node);
|
||||
base.newRootMaterialIdToSwitchTo = CuraApplication.getMaterialManager().duplicateMaterial(base.currentItem.container_node);
|
||||
base.toActivateNewMaterial = true;
|
||||
}
|
||||
}
|
||||
|
@ -145,7 +144,7 @@ Item
|
|||
id: removeMenuButton
|
||||
text: catalog.i18nc("@action:button", "Remove")
|
||||
iconName: "list-remove"
|
||||
enabled: base.hasCurrentItem && !base.currentItem.is_read_only && !base.isCurrentItemActivated && base.materialManager.canMaterialBeRemoved(base.currentItem.container_node)
|
||||
enabled: base.hasCurrentItem && !base.currentItem.is_read_only && !base.isCurrentItemActivated && CuraApplication.getMaterialManager().canMaterialBeRemoved(base.currentItem.container_node)
|
||||
onClicked:
|
||||
{
|
||||
forceActiveFocus();
|
||||
|
@ -294,7 +293,7 @@ Item
|
|||
{
|
||||
// Set the active material as the fallback. It will be selected when the current material is deleted
|
||||
base.newRootMaterialIdToSwitchTo = base.active_root_material_id
|
||||
base.materialManager.removeMaterial(base.currentItem.container_node);
|
||||
CuraApplication.getMaterialManager().removeMaterial(base.currentItem.container_node);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -82,10 +82,10 @@ Rectangle
|
|||
{
|
||||
if (materialSlot.is_favorite)
|
||||
{
|
||||
base.materialManager.removeFavorite(material.root_material_id)
|
||||
CuraApplication.getMaterialManager().removeFavorite(material.root_material_id)
|
||||
return
|
||||
}
|
||||
base.materialManager.addFavorite(material.root_material_id)
|
||||
CuraApplication.getMaterialManager().addFavorite(material.root_material_id)
|
||||
return
|
||||
}
|
||||
style: ButtonStyle
|
||||
|
|
|
@ -14,8 +14,6 @@ TabView
|
|||
{
|
||||
id: base
|
||||
|
||||
property QtObject materialManager: CuraApplication.getMaterialManager()
|
||||
|
||||
property QtObject properties
|
||||
property var currentMaterialNode: null
|
||||
|
||||
|
@ -567,7 +565,7 @@ TabView
|
|||
}
|
||||
|
||||
// update the values
|
||||
base.materialManager.setMaterialName(base.currentMaterialNode, new_name)
|
||||
CuraApplication.getMaterialManager().setMaterialName(base.currentMaterialNode, new_name)
|
||||
properties.name = new_name
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue