diff options
author | Arjen Hiemstra <ahiemstra@heimr.nl> | 2016-10-27 16:38:17 +0300 |
---|---|---|
committer | Arjen Hiemstra <ahiemstra@heimr.nl> | 2016-10-27 16:45:29 +0300 |
commit | e0b926878f732608ee3b471f8141dba975dd62fd (patch) | |
tree | 34507182b9407c8daee3e905af59e5990e820018 /plugins | |
parent | af8b7b599dc314b3964ab5d0960e5e8938c99419 (diff) |
Remove code that sets incompatible materials to invalid type
Instead use the "compatible" metadata entry like we do for nozzles.
Setting the type differently caused all code that looks for materials to
fail because "incompatible_material" is not "material". Since this is
the base file, this meant a lot of materials failed to duplicate
properly which caused crashes.
Contributes to CURA-2821
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/XmlMaterialProfile/XmlMaterialProfile.py | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index baf986067a..d6f16b08e9 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -411,6 +411,8 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): else: Logger.log("d", "Unsupported material setting %s", key) + self.addMetaDataEntry("compatible", global_compatibility) + self._dirty = False machines = data.iterfind("./um:settings/um:machine", self.__namespaces) @@ -447,6 +449,7 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): new_material.setName(self.getName()) new_material.setMetaData(copy.deepcopy(self.getMetaData())) new_material.setDefinition(definition) + new_material.setMetaDataEntry("compatible", machine_compatibility) for key, value in global_setting_values.items(): new_material.setProperty(key, "value", value, definition) @@ -492,7 +495,7 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): new_hotend_material.setMetaData(copy.deepcopy(self.getMetaData())) new_hotend_material.setDefinition(definition) new_hotend_material.addMetaDataEntry("variant", variant_containers[0].id) - new_hotend_material.addMetaDataEntry("compatible", hotend_compatibility) + new_hotend_material.setMetaDataEntry("compatible", hotend_compatibility) for key, value in global_setting_values.items(): new_hotend_material.setProperty(key, "value", value, definition) @@ -506,14 +509,6 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): new_hotend_material._dirty = False UM.Settings.ContainerRegistry.getInstance().addContainer(new_hotend_material) - if not global_compatibility: - # Change the type of this container so it is not shown as an option in menus. - # This uses InstanceContainer.setMetaDataEntry because otherwise all containers that - # share this basefile are also updated. - dirty = self.isDirty() - super().setMetaDataEntry("type", "incompatible_material") - super().setDirty(dirty) # reset dirty flag after setMetaDataEntry - def _addSettingElement(self, builder, instance): try: key = UM.Dictionary.findKey(self.__material_property_setting_map, instance.definition.key) |