mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
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
This commit is contained in:
parent
af8b7b599d
commit
e0b926878f
1 changed files with 4 additions and 9 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue