From 5ec9fdc6e56742d0009c0dec946c03805e0cffee Mon Sep 17 00:00:00 2001 From: Braden Jennings Date: Mon, 11 Mar 2024 16:30:50 +1300 Subject: [PATCH] initial prototype --- .../ayon_core/hosts/maya/plugins/create/create_render.py | 6 ++++++ client/ayon_core/pipeline/create/context.py | 9 +++++++++ client/ayon_core/pipeline/create/creator_plugins.py | 8 ++++++++ .../tools/publisher/widgets/card_view_widgets.py | 5 ++++- 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/client/ayon_core/hosts/maya/plugins/create/create_render.py b/client/ayon_core/hosts/maya/plugins/create/create_render.py index 213d5b543e..98eb446eb6 100644 --- a/client/ayon_core/hosts/maya/plugins/create/create_render.py +++ b/client/ayon_core/hosts/maya/plugins/create/create_render.py @@ -106,3 +106,9 @@ def get_instance_attr_defs(self): default=self.render_settings.get("enable_all_lights", False)) ] + + def get_extra_label(self): + """A label that can be made custom for a creator""" + print("get_extra_label() dir(self)", dir(self)) + # TODO: How do you get to the instance attributes from here, such as frameStart and frameEnd? + return "{}-{}".format(1001, 1010) \ No newline at end of file diff --git a/client/ayon_core/pipeline/create/context.py b/client/ayon_core/pipeline/create/context.py index 425de4305f..1e479782b5 100644 --- a/client/ayon_core/pipeline/create/context.py +++ b/client/ayon_core/pipeline/create/context.py @@ -871,6 +871,7 @@ class CreatedInstance: creator_identifier (str): Identifier of creator plugin. creator_label (str): Creator plugin label. group_label (str): Default group label from creator plugin. + extra_label (str): Extra label that can be made custom for a creator creator_attr_defs (List[AbstractAttrDef]): Attribute definitions from creator. """ @@ -897,11 +898,13 @@ def __init__( creator_identifier=None, creator_label=None, group_label=None, + extra_label=None, creator_attr_defs=None, ): if creator is not None: creator_identifier = creator.identifier group_label = creator.get_group_label() + extra_label = creator.get_extra_label() creator_label = creator.label creator_attr_defs = creator.get_instance_attr_defs() @@ -949,6 +952,7 @@ def __init__( self._data["productName"] = product_name self._data["active"] = data.get("active", True) self._data["creator_identifier"] = creator_identifier + self._data["extra_label"] = extra_label # Pop from source data all keys that are defined in `_data` before # this moment and through their values away @@ -1053,6 +1057,11 @@ def group_label(self): return label return self._group_label + @property + def extra_label(self): + extra_label = self._data.get("extra_label") + return extra_label + @property def origin_data(self): output = copy.deepcopy(self._orig_data) diff --git a/client/ayon_core/pipeline/create/creator_plugins.py b/client/ayon_core/pipeline/create/creator_plugins.py index cb8e4a2d1c..d0193457fe 100644 --- a/client/ayon_core/pipeline/create/creator_plugins.py +++ b/client/ayon_core/pipeline/create/creator_plugins.py @@ -792,6 +792,10 @@ def get_pre_create_attr_defs(self): """ return self.pre_create_attr_defs + def get_extra_label(self): + """Extra label that can be made custom for a creator""" + return + class HiddenCreator(BaseCreator): @abstractmethod @@ -809,6 +813,10 @@ def remove_instances(self, instances): """Skip removement.""" pass + def get_extra_label(self): + """Extra label that can be made custom for a creator""" + return + def discover_creator_plugins(*args, **kwargs): return discover(BaseCreator, *args, **kwargs) diff --git a/client/ayon_core/tools/publisher/widgets/card_view_widgets.py b/client/ayon_core/tools/publisher/widgets/card_view_widgets.py index 47c5399cf7..35fc8431f4 100644 --- a/client/ayon_core/tools/publisher/widgets/card_view_widgets.py +++ b/client/ayon_core/tools/publisher/widgets/card_view_widgets.py @@ -496,7 +496,10 @@ def _update_product_name(self): for part in found_parts: replacement = "{}".format(part) label = label.replace(part, replacement) - + # Add the extra label (if any) + extra_label = self.instance.extra_label + if extra_label: + label = "{} - {}".format(label, extra_label) self._label_widget.setText(label) # HTML text will cause that label start catch mouse clicks # - disabling with changing interaction flag