mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 22:58:58 +08:00
XML materials are now added in one batch
This commit is contained in:
parent
2a302a3e27
commit
38a2245d74
@ -416,6 +416,7 @@ class XmlMaterialProfile(InstanceContainer):
|
|||||||
|
|
||||||
## Overridden from InstanceContainer
|
## Overridden from InstanceContainer
|
||||||
def deserialize(self, serialized):
|
def deserialize(self, serialized):
|
||||||
|
containers_to_add = []
|
||||||
# update the serialized data first
|
# update the serialized data first
|
||||||
from UM.Settings.Interfaces import ContainerInterface
|
from UM.Settings.Interfaces import ContainerInterface
|
||||||
serialized = ContainerInterface.deserialize(self, serialized)
|
serialized = ContainerInterface.deserialize(self, serialized)
|
||||||
@ -573,7 +574,7 @@ class XmlMaterialProfile(InstanceContainer):
|
|||||||
new_material._dirty = False
|
new_material._dirty = False
|
||||||
|
|
||||||
if is_new_material:
|
if is_new_material:
|
||||||
ContainerRegistry.getInstance().addContainer(new_material)
|
containers_to_add.append(new_material)
|
||||||
|
|
||||||
hotends = machine.iterfind("./um:hotend", self.__namespaces)
|
hotends = machine.iterfind("./um:hotend", self.__namespaces)
|
||||||
for hotend in hotends:
|
for hotend in hotends:
|
||||||
@ -632,7 +633,10 @@ class XmlMaterialProfile(InstanceContainer):
|
|||||||
new_hotend_material._dirty = False
|
new_hotend_material._dirty = False
|
||||||
|
|
||||||
if is_new_material:
|
if is_new_material:
|
||||||
ContainerRegistry.getInstance().addContainer(new_hotend_material)
|
containers_to_add.append(new_hotend_material)
|
||||||
|
|
||||||
|
for container_to_add in containers_to_add:
|
||||||
|
ContainerRegistry.getInstance().addContainer(container_to_add)
|
||||||
|
|
||||||
def _addSettingElement(self, builder, instance):
|
def _addSettingElement(self, builder, instance):
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user