From 96c11e6a332a5d3d5a2476c8428136fe7259ed19 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 31 May 2024 12:47:00 +0200 Subject: [PATCH] AY-5539 - used labels instead of identifiers Identifiers are bit hard to get to fill them into Settings, labels are visible in Publisher and can by Copy&Pasted. --- client/ayon_core/tools/publisher/control.py | 20 ++++++++++---------- server/settings/tools.py | 10 +++++++--- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/client/ayon_core/tools/publisher/control.py b/client/ayon_core/tools/publisher/control.py index 61bd74de5a..1ded279aa2 100644 --- a/client/ayon_core/tools/publisher/control.py +++ b/client/ayon_core/tools/publisher/control.py @@ -1838,14 +1838,14 @@ class PublisherController(BasePublisherController): def _collect_creator_items(self): # TODO add crashed initialization of create plugins to report output = {} - allowed_creator_identifiers = self._get_allowed_creator_identifiers() + allowed_creator_labels = self._get_allowed_creator_labels() for identifier, creator in self._create_context.creators.items(): try: if ( - allowed_creator_identifiers is not None - and identifier not in allowed_creator_identifiers + allowed_creator_labels is not None + and creator.label not in allowed_creator_labels ): - self.log.debug(f"{identifier} not allowed for context") + self.log.debug(f"{creator.label} not allowed for context") continue output[identifier] = CreatorItem.from_creator(creator) except Exception: @@ -1857,16 +1857,16 @@ class PublisherController(BasePublisherController): return output - def _get_allowed_creator_identifiers(self): - """Provide configured creator identifier in this context + def _get_allowed_creator_labels(self): + """Provide configured creator label in this context - If no profile provided for current context, it shows all creators + If no profile matches current context, it shows all creators """ task_type = self._create_context.get_current_task_type() project_settings = self._get_current_project_settings() - allowed_creator_identifiers = None + allowed_creator_labels = None filter_creator_profiles = ( project_settings ["core"] @@ -1886,8 +1886,8 @@ class PublisherController(BasePublisherController): ) if profile: - allowed_creator_identifiers = profile["creator_identifiers"] - return allowed_creator_identifiers + allowed_creator_labels = profile["creator_labels"] + return allowed_creator_labels def _reset_instances(self): """Reset create instances.""" diff --git a/server/settings/tools.py b/server/settings/tools.py index f1ee44168f..ed0c723bac 100644 --- a/server/settings/tools.py +++ b/server/settings/tools.py @@ -50,9 +50,11 @@ class FilterCreatorProfile(BaseSettingsModel): task_names: list[str] = SettingsField( default_factory=list, title="Task names") - creator_identifiers: list[str] = SettingsField( + creator_labels: list[str] = SettingsField( default_factory=list, - title="Allowed Creator Identifiers") + title="Allowed Creator Labels", + description="Copy creator label from Publisher, regex supported." + ) class CreatorToolModel(BaseSettingsModel): @@ -70,7 +72,9 @@ class CreatorToolModel(BaseSettingsModel): filter_creator_profiles: list[FilterCreatorProfile] = SettingsField( default_factory=list, - title="Filter creator profiles" + title="Filter creator profiles", + description="White list of creator labels that will be only shown if " + "profile matches context." ) @validator("product_types_smart_select")