Don't sync invisible materials

CURA-10953
This commit is contained in:
Jaime van Kessel 2023-09-07 13:48:36 +02:00
parent 1a41f2650a
commit fd887a877a
No known key found for this signature in database
GPG key ID: C85F7A3AF1BAA7C4
2 changed files with 4 additions and 1 deletions

View file

@ -148,6 +148,9 @@ class CloudMaterialSync(QObject):
continue
if metadata["id"] == "empty_material": # Don't export the empty material.
continue
# Ignore materials that are marked as not visible for whatever reason
if not bool(metadata.get("visible", True)):
continue
material = registry.findContainers(id = metadata["id"])[0]
suffix = registry.getMimeTypeForContainer(type(material)).preferredSuffix
filename = metadata["id"] + "." + suffix

View file

@ -173,7 +173,7 @@ class SendMaterialJob(Job):
result = {} # type: Dict[str, LocalMaterial]
all_materials = CuraApplication.getInstance().getContainerRegistry().findInstanceContainersMetadata(type = "material")
all_base_files = [material for material in all_materials if material["id"] == material.get("base_file")] # Don't send materials without base_file: The empty material doesn't need to be sent.
all_base_files = [material for material in all_materials if material["id"] == material.get("base_file") and material.get("visible", True)] # Don't send materials without base_file: The empty material doesn't need to be sent.
# Find the latest version of all material containers in the registry.
for material_metadata in all_base_files: