mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Don't crash when finding duplicated materials
Only report it to the user. Contributes to issue CURA-5045.
This commit is contained in:
parent
593c80225d
commit
027f4b44bb
1 changed files with 5 additions and 6 deletions
|
|
@ -9,6 +9,7 @@ from typing import Optional, TYPE_CHECKING
|
|||
from PyQt5.Qt import QTimer, QObject, pyqtSignal, pyqtSlot
|
||||
|
||||
from UM.Application import Application
|
||||
from UM.ConfigurationErrorMessage import ConfigurationErrorMessage
|
||||
from UM.Logger import Logger
|
||||
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||
from UM.Settings.SettingFunction import SettingFunction
|
||||
|
|
@ -205,12 +206,10 @@ class MaterialManager(QObject):
|
|||
machine_node.children_map[variant_name] = MaterialNode()
|
||||
|
||||
variant_node = machine_node.children_map[variant_name]
|
||||
if root_material_id not in variant_node.material_map:
|
||||
variant_node.material_map[root_material_id] = MaterialNode(material_metadata)
|
||||
else:
|
||||
# Sanity check: make sure we don't have duplicated variant-specific materials for the same machine
|
||||
raise RuntimeError("Found duplicate variant name [%s] for machine [%s] in material [%s]" %
|
||||
(variant_name, definition, material_metadata["id"]))
|
||||
if root_material_id in variant_node.material_map: #We shouldn't have duplicated variant-specific materials for the same machine.
|
||||
ConfigurationErrorMessage.getInstance().addFaultyContainers(root_material_id)
|
||||
continue
|
||||
variant_node.material_map[root_material_id] = MaterialNode(material_metadata)
|
||||
|
||||
self.materialsUpdated.emit()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue