Force reloading the VariantNode if it exists

When the MachineNode is updated through _loadAll, it was not updating
its VariantNodes when they already existed. This caused an issue to
UM2+Olsson block printers, where changing the G-Code flavor to Marlin
was not updating the VariantNodes to search for materials (since the
variants already existed).

This commit fixes that by forcing an update to the existing Variant
nodes.

CURA-7354
This commit is contained in:
Kostas Karmas 2020-04-21 14:41:17 +02:00
parent 29b0bd1b23
commit ad6f837f44

View file

@ -171,6 +171,10 @@ class MachineNode(ContainerNode):
if variant_name not in self.variants:
self.variants[variant_name] = VariantNode(variant["id"], machine = self)
self.variants[variant_name].materialsChanged.connect(self.materialsChanged)
else:
# Force reloading the materials if the variant already exists or else materals won't be loaded
# when the G-Code flavor changes --> CURA-7354
self.variants[variant_name]._loadAll()
if not self.variants:
self.variants["empty"] = VariantNode("empty_variant", machine = self)