mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 04:59:00 +08:00
Don't crash on editing metadata entries of non-registered materials
Sometimes we need to create a temporary material profile just to save it to file. Contributes to issue CURA-5787.
This commit is contained in:
parent
dbb8514a6a
commit
d6f116b156
@ -71,7 +71,9 @@ class XmlMaterialProfile(InstanceContainer):
|
|||||||
material_manager = CuraApplication.getInstance().getMaterialManager()
|
material_manager = CuraApplication.getInstance().getMaterialManager()
|
||||||
root_material_id = self.getMetaDataEntry("base_file") #if basefile is self.getId, this is a basefile.
|
root_material_id = self.getMetaDataEntry("base_file") #if basefile is self.getId, this is a basefile.
|
||||||
material_group = material_manager.getMaterialGroup(root_material_id)
|
material_group = material_manager.getMaterialGroup(root_material_id)
|
||||||
|
if not material_group: #If the profile is not registered in the registry but loose/temporary, it will not have a base file tree.
|
||||||
|
super().setMetaDataEntry(key, value)
|
||||||
|
return
|
||||||
# Update the root material container
|
# Update the root material container
|
||||||
root_material_container = material_group.root_material_node.getContainer()
|
root_material_container = material_group.root_material_node.getContainer()
|
||||||
if root_material_container is not None:
|
if root_material_container is not None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user