From 78b5ae149a89223cb2f5c8a59464510685a8d67a Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Fri, 1 Sep 2023 15:54:42 +0200 Subject: [PATCH] only project settings are passed by default to create plugin --- openpype/pipeline/create/context.py | 19 ++++++++++------- openpype/pipeline/create/creator_plugins.py | 23 ++++++++++++++------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/openpype/pipeline/create/context.py b/openpype/pipeline/create/context.py index 3076efcde7..e0e2c09f96 100644 --- a/openpype/pipeline/create/context.py +++ b/openpype/pipeline/create/context.py @@ -16,6 +16,7 @@ from openpype.settings import ( get_system_settings, get_project_settings ) +from openpype.lib import is_func_signature_supported from openpype.lib.attribute_definitions import ( UnknownDef, serialize_attr_defs, @@ -1774,7 +1775,7 @@ class CreateContext: self.creator_discover_result = report for creator_class in report.plugins: if inspect.isabstract(creator_class): - self.log.info( + self.log.debug( "Skipping abstract Creator {}".format(str(creator_class)) ) continue @@ -1798,12 +1799,16 @@ class CreateContext: ).format(creator_class.host_name, self.host_name)) continue - creator = creator_class( - project_settings, - system_settings, - self, - self.headless - ) + if is_func_signature_supported( + creator_class, project_settings, self, self.headless + ): + creator = creator_class(project_settings, self, self.headless) + else: + # Backwards compatibility to pass system settings to creators + creator = creator_class( + project_settings, system_settings, self, self.headless + ) + if not creator.enabled: disabled_creators[creator_identifier] = creator continue diff --git a/openpype/pipeline/create/creator_plugins.py b/openpype/pipeline/create/creator_plugins.py index 38d6b6f465..a1a6a73236 100644 --- a/openpype/pipeline/create/creator_plugins.py +++ b/openpype/pipeline/create/creator_plugins.py @@ -10,7 +10,7 @@ from abc import ( import six from openpype.settings import get_system_settings, get_project_settings -from openpype.lib import Logger +from openpype.lib import Logger, is_func_signature_supported from openpype.pipeline.plugin_discover import ( discover, register_plugin, @@ -161,7 +161,6 @@ class BaseCreator: Args: project_settings (Dict[str, Any]): Project settings. - system_settings (Dict[str, Any]): System settings. create_context (CreateContext): Context which initialized creator. headless (bool): Running in headless mode. """ @@ -197,9 +196,7 @@ class BaseCreator: # QUESTION make this required? host_name = None - def __init__( - self, project_settings, system_settings, create_context, headless=False - ): + def __init__(self, project_settings, create_context, headless=False): # Reference to CreateContext self.create_context = create_context self.project_settings = project_settings @@ -208,10 +205,20 @@ class BaseCreator: # - we may use UI inside processing this attribute should be checked self.headless = headless - self.apply_settings(project_settings, system_settings) + if is_func_signature_supported( + self.apply_settings, project_settings + ): + self.apply_settings(project_settings) + else: + # Backwards compatibility for system settings + self.apply_settings(project_settings, {}) - def apply_settings(self, project_settings, system_settings): - """Method called on initialization of plugin to apply settings.""" + def apply_settings(self, project_settings): + """Method called on initialization of plugin to apply settings. + + Args: + project_settings (dict[str, Any]): Project settings. + """ pass