From 75c788c31a40272904cae2d6b093e53c42f5a94b Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 19 Sep 2016 12:40:05 +0200 Subject: [PATCH] Moved check for top container setting function up in the code Should improve performance a bit. CURA-2361 --- cura/Settings/SettingInheritanceManager.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cura/Settings/SettingInheritanceManager.py b/cura/Settings/SettingInheritanceManager.py index 763db46e57..6bc16c1628 100644 --- a/cura/Settings/SettingInheritanceManager.py +++ b/cura/Settings/SettingInheritanceManager.py @@ -128,6 +128,10 @@ class SettingInheritanceManager(QObject): if not self._active_container_stack.getProperty(key, "enabled"): return False + ## Also check if the top container is not a setting function (this happens if the inheritance is restored). + if isinstance(self._active_container_stack.getTop().getProperty(key, "value"), UM.Settings.SettingFunction): + return False + ## Mash all containers for all the stacks together. while stack: containers.extend(stack.getContainers()) @@ -146,8 +150,7 @@ class SettingInheritanceManager(QObject): if has_setting_function: break # There is a setting function somewhere, stop looking deeper. - ## Also check if the top container is not a setting function (this happens if the inheritance is restored). - return has_setting_function and not isinstance(self._active_container_stack.getTop().getProperty(key, "value"), UM.Settings.SettingFunction) and has_non_function_value + return has_setting_function and has_non_function_value def _update(self): self._settings_with_inheritance_warning = [] # Reset previous data.