mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-10 08:17:49 -06:00
Search for instance containers with type material
CURA-4129
This commit is contained in:
parent
b9cdeb68d6
commit
bb1475d1fd
1 changed files with 6 additions and 10 deletions
|
@ -336,19 +336,15 @@ class ContainerManager(QObject):
|
||||||
# check if this is a material container. If so, check if any material with the same GUID is being used by any
|
# check if this is a material container. If so, check if any material with the same GUID is being used by any
|
||||||
# stacks.
|
# stacks.
|
||||||
container_ids_to_check = [container_id]
|
container_ids_to_check = [container_id]
|
||||||
container_results = self._container_registry.findInstanceContainers(id = container_id)
|
container_results = self._container_registry.findInstanceContainers(id = container_id, type = "material")
|
||||||
if container_results:
|
if container_results:
|
||||||
this_container = container_results[0]
|
this_container = container_results[0]
|
||||||
container_guid = this_container.getMetaDataEntry("GUID")
|
container_guid = this_container.getMetaDataEntry("GUID")
|
||||||
# FIXME: only material containers have GUIDs, but to make it safer, metadata/material is also checked.
|
# check all material container IDs with the same GUID
|
||||||
# but note that this is not a proper way to check whether a container is a material container.
|
material_containers = self._container_registry.findInstanceContainers(GUID = container_guid,
|
||||||
# there should be a better way to do this
|
type = "material")
|
||||||
is_material = container_guid and this_container.getMetaDataEntry("material")
|
if material_containers:
|
||||||
if is_material:
|
container_ids_to_check = [container.getId() for container in material_containers]
|
||||||
# check all material container IDs with the same guid
|
|
||||||
material_containers = self._container_registry.findInstanceContainers(GUID = container_guid)
|
|
||||||
if material_containers:
|
|
||||||
container_ids_to_check = [container.getId() for container in material_containers]
|
|
||||||
|
|
||||||
all_stacks = self._container_registry.findContainerStacks()
|
all_stacks = self._container_registry.findContainerStacks()
|
||||||
for stack in all_stacks:
|
for stack in all_stacks:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue