mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Instead of discarding a profile if it's not compatible, we mark it as such.
The old approach was far to naive. We actually have 3 states; - Supported (we have a profile) - Not supported (Don't have a profile) - Don't do this, lest you awaken the Old Gods (Error) In case 1 and 3 we now do have a profile. CURA-2271
This commit is contained in:
parent
e0b6e31056
commit
d68f6a4e9a
1 changed files with 4 additions and 5 deletions
|
@ -428,8 +428,8 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer):
|
||||||
for identifier in identifiers:
|
for identifier in identifiers:
|
||||||
machine_id = self.__product_id_map.get(identifier.get("product"), None)
|
machine_id = self.__product_id_map.get(identifier.get("product"), None)
|
||||||
if machine_id is None:
|
if machine_id is None:
|
||||||
Logger.log("w", "Cannot create material for unknown machine %s", identifier.get("product"))
|
# Lets try again with some naive heuristics.
|
||||||
continue
|
machine_id = identifier.get("product").replace(" ", "").lower()
|
||||||
|
|
||||||
definitions = UM.Settings.ContainerRegistry.getInstance().findDefinitionContainers(id = machine_id)
|
definitions = UM.Settings.ContainerRegistry.getInstance().findDefinitionContainers(id = machine_id)
|
||||||
if not definitions:
|
if not definitions:
|
||||||
|
@ -454,6 +454,7 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer):
|
||||||
|
|
||||||
UM.Settings.ContainerRegistry.getInstance().addContainer(new_material)
|
UM.Settings.ContainerRegistry.getInstance().addContainer(new_material)
|
||||||
|
|
||||||
|
|
||||||
hotends = machine.iterfind("./um:hotend", self.__namespaces)
|
hotends = machine.iterfind("./um:hotend", self.__namespaces)
|
||||||
for hotend in hotends:
|
for hotend in hotends:
|
||||||
hotend_id = hotend.get("id")
|
hotend_id = hotend.get("id")
|
||||||
|
@ -482,14 +483,12 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer):
|
||||||
else:
|
else:
|
||||||
Logger.log("d", "Unsupported material setting %s", key)
|
Logger.log("d", "Unsupported material setting %s", key)
|
||||||
|
|
||||||
if not hotend_compatibility:
|
|
||||||
continue
|
|
||||||
|
|
||||||
new_hotend_material = XmlMaterialProfile(self.id + "_" + machine_id + "_" + hotend_id.replace(" ", "_"))
|
new_hotend_material = XmlMaterialProfile(self.id + "_" + machine_id + "_" + hotend_id.replace(" ", "_"))
|
||||||
new_hotend_material.setName(self.getName())
|
new_hotend_material.setName(self.getName())
|
||||||
new_hotend_material.setMetaData(copy.deepcopy(self.getMetaData()))
|
new_hotend_material.setMetaData(copy.deepcopy(self.getMetaData()))
|
||||||
new_hotend_material.setDefinition(definition)
|
new_hotend_material.setDefinition(definition)
|
||||||
new_hotend_material.addMetaDataEntry("variant", variant_containers[0].id)
|
new_hotend_material.addMetaDataEntry("variant", variant_containers[0].id)
|
||||||
|
new_hotend_material.addMetaDataEntry("compatible", hotend_compatibility)
|
||||||
|
|
||||||
for key, value in global_setting_values.items():
|
for key, value in global_setting_values.items():
|
||||||
new_hotend_material.setProperty(key, "value", value, definition)
|
new_hotend_material.setProperty(key, "value", value, definition)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue