Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfieldOfView <aldo@fieldofview.com>2020-03-22 20:51:43 +0300
committerfieldOfView <aldo@fieldofview.com>2020-03-22 20:51:43 +0300
commit138dbddb1076bd1b0215dc574011505cd8ce295a (patch)
treedae60da1df5f49bf93bc599c7611eefb4d9a42e0 /cura/Scene
parent4600ee9355f1e0feda3e138a9987e31ccfb73569 (diff)
Restore the SettingDefinition relations without killing a puppy
Diffstat (limited to 'cura/Scene')
-rw-r--r--cura/Scene/CuraSceneController.py12
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()