diff --git a/modules/extensions.py b/modules/extensions.py index 547fe3f4..731fe089 100644 --- a/modules/extensions.py +++ b/modules/extensions.py @@ -11,6 +11,18 @@ available_extensions = [] setup_called = set() +def apply_settings(extension, name): + if not hasattr(extension, 'params'): + return + + for param in extension.params: + _id = f"{name}-{param}" + if _id not in shared.settings: + continue + + extension.params[param] = shared.settings[_id] + + def load_extensions(): global state, setup_called for i, name in enumerate(shared.args.extensions): @@ -22,6 +34,7 @@ def load_extensions(): extension = getattr(extensions, name).script if extension not in setup_called and hasattr(extension, "setup"): setup_called.add(extension) + apply_settings(extension, name) extension.setup() state[name] = [True, i] @@ -105,18 +118,11 @@ def apply_extensions(typ, *args, **kwargs): def create_extensions_block(): global setup_called - # Updating the default values - for extension, name in iterator(): - if hasattr(extension, 'params'): - for param in extension.params: - _id = f"{name}-{param}" - if _id in shared.settings: - extension.params[param] = shared.settings[_id] - should_display_ui = False for extension, name in iterator(): if hasattr(extension, "ui"): should_display_ui = True + break # Creating the extension ui elements if should_display_ui: