Fix UM2 upgrade regarding the variant

CURA-4482

UM2 by default doesn't have variants, but if the user enables Olsson
Block, the variant option will become available. This commit fixes the
following cases:

- Make sure that the variant is set on the extruder stack but not the
  global stack
- Extruder stacks don't contain information such as has_variant. Such
  info should be retrieved from the global stack and not just from the
  definition container because they can be overriden by other
  containers.
This commit is contained in:
Lipu Fei 2017-11-17 12:47:28 +01:00
parent e246784df2
commit 2c39612bc8
4 changed files with 14 additions and 4 deletions

View file

@ -443,7 +443,10 @@ class CuraContainerRegistry(ContainerRegistry):
extruder_stack.setUserChanges(user_container)
self.addContainer(user_container)
extruder_stack.setVariantById("default")
variant_id = "default"
if machine.variant.getId() != "empty_variant":
variant_id = machine.variant.getId()
extruder_stack.setVariantById(variant_id)
extruder_stack.setMaterialById("default")
extruder_stack.setQualityById("default")