mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-11 16:57:51 -06:00
Don't use material groups to find just the root container
Just look it up in the container registry. If you know the ID, this look-up is just a dictionary look-up as well. Contributes to issue CURA-6600.
This commit is contained in:
parent
882e60bf95
commit
bb0c9c80dc
2 changed files with 19 additions and 22 deletions
|
@ -81,7 +81,7 @@ class UFPWriter(MeshWriter):
|
|||
# Store the material.
|
||||
application = CuraApplication.getInstance()
|
||||
machine_manager = application.getMachineManager()
|
||||
material_manager = application.getMaterialManager()
|
||||
container_registry = application.getContainerRegistry()
|
||||
global_stack = machine_manager.activeMachine
|
||||
|
||||
material_extension = "xml.fdm_material"
|
||||
|
@ -107,12 +107,12 @@ class UFPWriter(MeshWriter):
|
|||
continue
|
||||
|
||||
material_root_id = material.getMetaDataEntry("base_file")
|
||||
material_group = material_manager.getMaterialGroup(material_root_id)
|
||||
if material_group is None:
|
||||
Logger.log("e", "Cannot find material container with root id [%s]", material_root_id)
|
||||
material_root_query = container_registry.findContainers(id = material_root_id)
|
||||
if not material_root_query:
|
||||
Logger.log("e", "Cannot find material container with root id {root_id}".format(root_id = material_root_id))
|
||||
return False
|
||||
material_container = material_root_query[0]
|
||||
|
||||
material_container = material_group.root_material_node.container
|
||||
try:
|
||||
serialized_material = material_container.serialize()
|
||||
except NotImplementedError:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue