mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-14 23:28:01 +08:00
Merge branch '4.6' of github.com:Ultimaker/Cura
This commit is contained in:
commit
7a11a183a8
@ -320,9 +320,10 @@ class MachineManager(QObject):
|
||||
# This signal might not have been emitted yet (if it didn't change) but we still want the models to update that depend on it because we changed the contents of the containers too.
|
||||
extruder_manager.activeExtruderChanged.emit()
|
||||
|
||||
# Validate if the machine has the correct variants
|
||||
# It can happen that a variant is empty, even though the machine has variants. This will ensure that that
|
||||
# that situation will be fixed (and not occur again, since it switches it out to the preferred variant instead!)
|
||||
# Validate if the machine has the correct variants and materials.
|
||||
# It can happen that a variant or material is empty, even though the machine has them. This will ensure that
|
||||
# that situation will be fixed (and not occur again, since it switches it out to the preferred variant or
|
||||
# variant instead!)
|
||||
machine_node = ContainerTree.getInstance().machines[global_stack.definition.getId()]
|
||||
for extruder in self._global_container_stack.extruderList:
|
||||
variant_name = extruder.variant.getName()
|
||||
@ -330,8 +331,12 @@ class MachineManager(QObject):
|
||||
if variant_node is None:
|
||||
Logger.log("w", "An extruder has an unknown variant, switching it to the preferred variant")
|
||||
self.setVariantByName(extruder.getMetaDataEntry("position"), machine_node.preferred_variant_name)
|
||||
self.__emitChangedSignals()
|
||||
variant_node = machine_node.variants.get(machine_node.preferred_variant_name)
|
||||
|
||||
material_node = variant_node.materials.get(extruder.material.getId())
|
||||
if material_node is None:
|
||||
Logger.log("w", "An extruder has an unknown material, switching it to the preferred material")
|
||||
self.setMaterialById(extruder.getMetaDataEntry("position"), machine_node.preferred_material)
|
||||
|
||||
## Given a definition id, return the machine with this id.
|
||||
# Optional: add a list of keys and values to filter the list of machines with the given definition id
|
||||
|
Loading…
x
Reference in New Issue
Block a user