Don't get whole container to just get metadata

A performance improvement, especially in the material models.

Contributes to issue CURA-6793.
This commit is contained in:
Ghostkeeper 2019-10-16 13:56:23 +02:00
parent 9f84304829
commit 7348c70af6
No known key found for this signature in database
GPG key ID: 86BEF881AE2CF276
7 changed files with 14 additions and 15 deletions

View file

@ -18,11 +18,11 @@ class GenericMaterialsModel(BaseMaterialsModel):
for root_material_id, container_node in self._available_materials.items():
# Do not include the materials from a to-be-removed package
if bool(container_node.container.getMetaDataEntry("removed", False)):
if bool(container_node.getMetaDataEntry("removed", False)):
continue
# Only add results for generic materials
if container_node.container.getMetaDataEntry("brand", "unknown").lower() != "generic":
if container_node.getMetaDataEntry("brand", "unknown").lower() != "generic":
continue
item = self._createMaterialItem(root_material_id, container_node)