diff options
author | fieldOfView <aldo@fieldofview.com> | 2020-03-22 20:51:43 +0300 |
---|---|---|
committer | fieldOfView <aldo@fieldofview.com> | 2020-03-22 20:51:43 +0300 |
commit | 138dbddb1076bd1b0215dc574011505cd8ce295a (patch) | |
tree | dae60da1df5f49bf93bc599c7611eefb4d9a42e0 /cura/Scene | |
parent | 4600ee9355f1e0feda3e138a9987e31ccfb73569 (diff) |
Restore the SettingDefinition relations without killing a puppy
Diffstat (limited to 'cura/Scene')
-rw-r--r-- | cura/Scene/CuraSceneController.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/cura/Scene/CuraSceneController.py b/cura/Scene/CuraSceneController.py index f97fde0f7e..2857ef4ca9 100644 --- a/cura/Scene/CuraSceneController.py +++ b/cura/Scene/CuraSceneController.py @@ -48,19 +48,21 @@ class CuraSceneController(QObject): global_stack = Application.getInstance().getGlobalContainerStack() if global_stack: scene_has_support_meshes = self._sceneHasSupportMeshes() # TODO: see if this can be cached + if scene_has_support_meshes != global_stack.getProperty("support_meshes_present", "value"): - # adjust the setting without having the setting value in an InstanceContainer + # Adjust the setting without having the setting value in an InstanceContainer setting_definitions = global_stack.definition.findDefinitions(key="support_meshes_present") if setting_definitions: - relations = setting_definitions[0].relations + # Recreate the setting definition because the default_value is readonly definition_dict = setting_definitions[0].serialize_to_dict() - definition_dict["enabled"] = False + definition_dict["enabled"] = False # The enabled property has a value that would need to be evaluated definition_dict["default_value"] = scene_has_support_meshes + relations = setting_definitions[0].relations # Relations are wiped when deserializing from a dict setting_definitions[0].deserialize(definition_dict) - setting_definitions[0]._relations = relations # TODO: find a better way to restore relations - # notify relations that the setting has changed + # Restore relations and notify them that the setting has changed for relation in relations: + setting_definitions[0].relations.append(relation) global_stack.propertyChanged.emit(relation.target.key, "enabled") max_build_plate = self._calcMaxBuildPlate() |