From 3bbd29dafc262d8984e83e4cf638e6a8b8a033e2 Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Sun, 6 Oct 2024 15:14:22 +0200 Subject: [PATCH 01/15] Show/hide attributes per instance based on status of other toggles --- .../extract_usd_layer_contributions.py | 73 ++++++++++++++++--- 1 file changed, 62 insertions(+), 11 deletions(-) diff --git a/client/ayon_core/plugins/publish/extract_usd_layer_contributions.py b/client/ayon_core/plugins/publish/extract_usd_layer_contributions.py index acdc5276f7..a67c6ec702 100644 --- a/client/ayon_core/plugins/publish/extract_usd_layer_contributions.py +++ b/client/ayon_core/plugins/publish/extract_usd_layer_contributions.py @@ -458,7 +458,22 @@ class CollectUSDLayerContributions(pyblish.api.InstancePlugin, return new_instance @classmethod - def get_attribute_defs(cls): + def get_attr_defs_for_instance(cls, create_context, instance): + # Filtering of instance, if needed, can be customized + if not cls.instance_matches_plugin_families(instance): + return [] + + # Attributes logic + disabled = False + publish_attributes = instance["publish_attributes"].get( + cls.__name__, {}) + + enabled = publish_attributes.get("contribution_enabled", True) + variant_enabled = enabled and publish_attributes.get( + "contribution_apply_as_variant", True) + + disabled = not enabled + variant_disabled = not variant_enabled return [ UISeparatorDef("usd_container_settings1"), @@ -484,7 +499,8 @@ class CollectUSDLayerContributions(pyblish.api.InstancePlugin, "the contribution itself will be added to the " "department layer." ), - default="usdAsset"), + default="usdAsset", + hidden=disabled), EnumDef("contribution_target_product_init", label="Initialize as", tooltip=( @@ -495,7 +511,8 @@ class CollectUSDLayerContributions(pyblish.api.InstancePlugin, "setting will do nothing." ), items=["asset", "shot"], - default="asset"), + default="asset", + hidden=disabled), # Asset layer, e.g. model.usd, look.usd, rig.usd EnumDef("contribution_layer", @@ -507,7 +524,8 @@ class CollectUSDLayerContributions(pyblish.api.InstancePlugin, "the list) will contribute as a stronger opinion." ), items=list(cls.contribution_layers.keys()), - default="model"), + default="model", + hidden=disabled), BoolDef("contribution_apply_as_variant", label="Add as variant", tooltip=( @@ -518,13 +536,16 @@ class CollectUSDLayerContributions(pyblish.api.InstancePlugin, "appended to as a sublayer to the department layer " "instead." ), - default=True), + default=True, + hidden=disabled), TextDef("contribution_variant_set_name", label="Variant Set Name", - default="{layer}"), + default="{layer}", + hidden=variant_disabled), TextDef("contribution_variant", label="Variant Name", - default="{variant}"), + default="{variant}", + hidden=variant_disabled), BoolDef("contribution_variant_is_default", label="Set as default variant selection", tooltip=( @@ -535,10 +556,41 @@ class CollectUSDLayerContributions(pyblish.api.InstancePlugin, "The behavior is unpredictable if multiple instances " "for the same variant set have this enabled." ), - default=False), + default=False, + hidden=variant_disabled), UISeparatorDef("usd_container_settings3"), ] + @classmethod + def register_create_context_callbacks(cls, create_context): + create_context.add_value_changed_callback(cls.on_values_changed) + + @classmethod + def on_values_changed(cls, event): + """Update instance attribute definitions on attribute changes.""" + + # Update attributes if any of the following plug-in attributes + # change: + keys = ["contribution_enabled", "contribution_apply_as_variant"] + + for instance_change in event["changes"]: + instance = instance_change["instance"] + if not cls.instance_matches_plugin_families(instance): + continue + value_changes = instance_change["changes"] + plugin_attribute_changes = ( + value_changes.get("publish_attributes", {}) + .get(cls.__name__, {})) + + if not any(key in plugin_attribute_changes for key in keys): + continue + + # Update the attribute definitions + new_attrs = cls.get_attr_defs_for_instance( + event["create_context"], instance + ) + instance.set_publish_plugin_attr_defs(cls.__name__, new_attrs) + class CollectUSDLayerContributionsHoudiniLook(CollectUSDLayerContributions): """ @@ -551,9 +603,8 @@ class CollectUSDLayerContributionsHoudiniLook(CollectUSDLayerContributions): label = CollectUSDLayerContributions.label + " (Look)" @classmethod - def get_attribute_defs(cls): - defs = super(CollectUSDLayerContributionsHoudiniLook, - cls).get_attribute_defs() + def get_attr_defs_for_instance(cls, create_context, instance): + defs = super().get_attr_defs_for_instance(create_context, instance) # Update default for department layer to look layer_def = next(d for d in defs if d.key == "contribution_layer") From 0e8b129d6af008397e48a850544b18b75065722b Mon Sep 17 00:00:00 2001 From: Ynbot Date: Wed, 23 Oct 2024 14:49:16 +0000 Subject: [PATCH 02/15] [Automated] Add generated package files to main --- client/ayon_core/version.py | 2 +- package.py | 2 +- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/ayon_core/version.py b/client/ayon_core/version.py index 9a951d7fd4..47da5b3a1b 100644 --- a/client/ayon_core/version.py +++ b/client/ayon_core/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- """Package declaring AYON addon 'core' version.""" -__version__ = "1.0.3+dev" +__version__ = "1.0.4" diff --git a/package.py b/package.py index 5d5218748c..0ba9303182 100644 --- a/package.py +++ b/package.py @@ -1,6 +1,6 @@ name = "core" title = "Core" -version = "1.0.3+dev" +version = "1.0.4" client_dir = "ayon_core" diff --git a/pyproject.toml b/pyproject.toml index ebf08be4a8..64b389ea3e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ [tool.poetry] name = "ayon-core" -version = "1.0.3+dev" +version = "1.0.4" description = "" authors = ["Ynput Team "] readme = "README.md" From d2ee4167ae0151908eda349d582663bf193efdd9 Mon Sep 17 00:00:00 2001 From: Ynbot Date: Wed, 23 Oct 2024 14:49:58 +0000 Subject: [PATCH 03/15] [Automated] Update version in package.py for develop --- client/ayon_core/version.py | 2 +- package.py | 2 +- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/ayon_core/version.py b/client/ayon_core/version.py index 47da5b3a1b..8a7065c93c 100644 --- a/client/ayon_core/version.py +++ b/client/ayon_core/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- """Package declaring AYON addon 'core' version.""" -__version__ = "1.0.4" +__version__ = "1.0.4+dev" diff --git a/package.py b/package.py index 0ba9303182..7c5bffe81f 100644 --- a/package.py +++ b/package.py @@ -1,6 +1,6 @@ name = "core" title = "Core" -version = "1.0.4" +version = "1.0.4+dev" client_dir = "ayon_core" diff --git a/pyproject.toml b/pyproject.toml index 64b389ea3e..c686d685fb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ [tool.poetry] name = "ayon-core" -version = "1.0.4" +version = "1.0.4+dev" description = "" authors = ["Ynput Team "] readme = "README.md" From 92e43fc45b81a9305589be85871011cf3236012c Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Wed, 23 Oct 2024 23:44:24 +0200 Subject: [PATCH 04/15] Fix variable names + simplify logic --- .../extract_usd_layer_contributions.py | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/client/ayon_core/plugins/publish/extract_usd_layer_contributions.py b/client/ayon_core/plugins/publish/extract_usd_layer_contributions.py index a67c6ec702..0ffce8b643 100644 --- a/client/ayon_core/plugins/publish/extract_usd_layer_contributions.py +++ b/client/ayon_core/plugins/publish/extract_usd_layer_contributions.py @@ -464,17 +464,13 @@ class CollectUSDLayerContributions(pyblish.api.InstancePlugin, return [] # Attributes logic - disabled = False publish_attributes = instance["publish_attributes"].get( cls.__name__, {}) - enabled = publish_attributes.get("contribution_enabled", True) - variant_enabled = enabled and publish_attributes.get( + visible = publish_attributes.get("contribution_enabled", True) + variant_visible = visible and publish_attributes.get( "contribution_apply_as_variant", True) - disabled = not enabled - variant_disabled = not variant_enabled - return [ UISeparatorDef("usd_container_settings1"), UILabelDef(label="USD Contribution"), @@ -500,7 +496,7 @@ class CollectUSDLayerContributions(pyblish.api.InstancePlugin, "department layer." ), default="usdAsset", - hidden=disabled), + visible=visible), EnumDef("contribution_target_product_init", label="Initialize as", tooltip=( @@ -512,7 +508,7 @@ class CollectUSDLayerContributions(pyblish.api.InstancePlugin, ), items=["asset", "shot"], default="asset", - hidden=disabled), + visible=visible), # Asset layer, e.g. model.usd, look.usd, rig.usd EnumDef("contribution_layer", @@ -525,7 +521,7 @@ class CollectUSDLayerContributions(pyblish.api.InstancePlugin, ), items=list(cls.contribution_layers.keys()), default="model", - hidden=disabled), + visible=visible), BoolDef("contribution_apply_as_variant", label="Add as variant", tooltip=( @@ -537,15 +533,15 @@ class CollectUSDLayerContributions(pyblish.api.InstancePlugin, "instead." ), default=True, - hidden=disabled), + visible=visible), TextDef("contribution_variant_set_name", label="Variant Set Name", default="{layer}", - hidden=variant_disabled), + visible=variant_visible), TextDef("contribution_variant", label="Variant Name", default="{variant}", - hidden=variant_disabled), + visible=variant_visible), BoolDef("contribution_variant_is_default", label="Set as default variant selection", tooltip=( @@ -557,7 +553,7 @@ class CollectUSDLayerContributions(pyblish.api.InstancePlugin, "for the same variant set have this enabled." ), default=False, - hidden=variant_disabled), + visible=variant_visible), UISeparatorDef("usd_container_settings3"), ] From 9c9f02f0d264536bb1acdb6ee7f02cd3e5ed990c Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Thu, 24 Oct 2024 14:51:31 +0200 Subject: [PATCH 05/15] implemented iter --- client/ayon_core/pipeline/create/structures.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/ayon_core/pipeline/create/structures.py b/client/ayon_core/pipeline/create/structures.py index bcc9a87c49..ba4a373597 100644 --- a/client/ayon_core/pipeline/create/structures.py +++ b/client/ayon_core/pipeline/create/structures.py @@ -132,6 +132,10 @@ class AttributeValues: def __contains__(self, key): return key in self._attr_defs_by_key + def __iter__(self): + for key in self._attr_defs_by_key: + yield key + def get(self, key, default=None): if key in self._attr_defs_by_key: return self[key] From 11bb657d35921c42759339937ee8b82230235e98 Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Thu, 24 Oct 2024 22:10:25 +0200 Subject: [PATCH 06/15] Do not try to continue with logic if the instance isn't valid for the plug-in anyway --- .../plugins/publish/extract_usd_layer_contributions.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/ayon_core/plugins/publish/extract_usd_layer_contributions.py b/client/ayon_core/plugins/publish/extract_usd_layer_contributions.py index 0ffce8b643..180cb8bbf1 100644 --- a/client/ayon_core/plugins/publish/extract_usd_layer_contributions.py +++ b/client/ayon_core/plugins/publish/extract_usd_layer_contributions.py @@ -600,6 +600,10 @@ class CollectUSDLayerContributionsHoudiniLook(CollectUSDLayerContributions): @classmethod def get_attr_defs_for_instance(cls, create_context, instance): + # Filtering of instance, if needed, can be customized + if not cls.instance_matches_plugin_families(instance): + return [] + defs = super().get_attr_defs_for_instance(create_context, instance) # Update default for department layer to look From a28f4959e6daa156defac5ad379a4abaf0105237 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Fri, 25 Oct 2024 14:40:36 +0200 Subject: [PATCH 07/15] replace html tags with markdown --- server/settings/publish_plugins.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/settings/publish_plugins.py b/server/settings/publish_plugins.py index cdcd28a9ce..16b1f37187 100644 --- a/server/settings/publish_plugins.py +++ b/server/settings/publish_plugins.py @@ -459,8 +459,8 @@ class ExtractReviewFilterModel(BaseSettingsModel): single_frame_filter: str = SettingsField( "everytime", # codespell:ignore everytime description=( - "Use output always / only if input is 1 frame" - " image / only if has 2+ frames or is video" + "Use output **always** / only if input **is 1 frame**" + " image / only if has **2+ frames** or **is video**" ), enum_resolver=extract_review_filter_enum ) From 54bb5c51b9eb58252f28987eeed5db6aec30a3a9 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Fri, 25 Oct 2024 17:00:27 +0200 Subject: [PATCH 08/15] udated release trigger action --- .github/workflows/release_trigger.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/release_trigger.yml b/.github/workflows/release_trigger.yml index 01a3b3a682..4293e4a8e9 100644 --- a/.github/workflows/release_trigger.yml +++ b/.github/workflows/release_trigger.yml @@ -2,10 +2,23 @@ name: 🚀 Release Trigger on: workflow_dispatch: + inputs: + draft: + type: boolean + description: "Create Release Draft" + required: false + default: false + release_overwrite: + type: string + description: "Set Version Release Tag" + required: false jobs: call-release-trigger: uses: ynput/ops-repo-automation/.github/workflows/release_trigger.yml@main + with: + draft: ${{ inputs.draft }} + release_overwrite: ${{ inputs.release_overwrite }} secrets: token: ${{ secrets.YNPUT_BOT_TOKEN }} email: ${{ secrets.CI_EMAIL }} From 9595d8fe91e27cb046f053eb86711520826c5848 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Sun, 27 Oct 2024 09:39:08 +0100 Subject: [PATCH 09/15] fix serialize of regex --- client/ayon_core/lib/attribute_definitions.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/ayon_core/lib/attribute_definitions.py b/client/ayon_core/lib/attribute_definitions.py index 4877a45118..5daf646873 100644 --- a/client/ayon_core/lib/attribute_definitions.py +++ b/client/ayon_core/lib/attribute_definitions.py @@ -523,7 +523,10 @@ class TextDef(AbstractAttrDef): def serialize(self): data = super().serialize() - data["regex"] = self.regex.pattern + regex = None + if self.regex is not None: + regex = self.regex.pattern + data["regex"] = regex data["multiline"] = self.multiline data["placeholder"] = self.placeholder return data From ea2a9e0221bbfff11ce1c75e9f000ec5d4f1d33b Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Mon, 28 Oct 2024 14:56:22 +0100 Subject: [PATCH 10/15] fix also label clone --- client/ayon_core/lib/attribute_definitions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/ayon_core/lib/attribute_definitions.py b/client/ayon_core/lib/attribute_definitions.py index 5daf646873..34956fd33f 100644 --- a/client/ayon_core/lib/attribute_definitions.py +++ b/client/ayon_core/lib/attribute_definitions.py @@ -327,8 +327,8 @@ class UISeparatorDef(UIDef): class UILabelDef(UIDef): type = "label" - def __init__(self, label, key=None): - super().__init__(label=label, key=key) + def __init__(self, label, key=None, *args, **kwargs): + super().__init__(label=label, key=key, *args, **kwargs) def _def_type_compare(self, other: "UILabelDef") -> bool: return self.label == other.label From 37f2a6bb33931d2b8c536ab0c2831c8987d58648 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Mon, 28 Oct 2024 17:43:06 +0100 Subject: [PATCH 11/15] use kwarg to pass subtype --- .../ayon_core/plugins/publish/extract_hierarchy_to_ayon.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/ayon_core/plugins/publish/extract_hierarchy_to_ayon.py b/client/ayon_core/plugins/publish/extract_hierarchy_to_ayon.py index 60c92aa8b1..a169affc66 100644 --- a/client/ayon_core/plugins/publish/extract_hierarchy_to_ayon.py +++ b/client/ayon_core/plugins/publish/extract_hierarchy_to_ayon.py @@ -154,7 +154,9 @@ class ExtractHierarchyToAYON(pyblish.api.ContextPlugin): # TODO check if existing entity have 'task' type if task_entity is None: task_entity = entity_hub.add_new_task( - task_info["type"], + task_type=task_info["type"], + # TODO change 'parent_id' to 'folder_id' when ayon api + # is updated parent_id=entity.id, name=task_name ) @@ -182,7 +184,7 @@ class ExtractHierarchyToAYON(pyblish.api.ContextPlugin): folder_type = "Folder" child_entity = entity_hub.add_new_folder( - folder_type, + folder_type=folder_type, parent_id=entity.id, name=child_name ) From 90a9ffa4758e841251af398004326748c71df9f8 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Tue, 29 Oct 2024 10:20:03 +0100 Subject: [PATCH 12/15] fix representation entity --- client/ayon_core/pipeline/delivery.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client/ayon_core/pipeline/delivery.py b/client/ayon_core/pipeline/delivery.py index 2a2adf984a..de89c8eec2 100644 --- a/client/ayon_core/pipeline/delivery.py +++ b/client/ayon_core/pipeline/delivery.py @@ -383,6 +383,13 @@ def get_representations_delivery_template_data( continue template_data = repre_entity["context"] + # Bug in 'ayon_api', 'get_representations_hierarchy' did not fully + # convert representation entity. Fixed in 'ayon_api' 1.0.10 . + if isinstance(template_data, str): + con = ayon_api.get_server_api_connection() + repre_entity = con._representation_conversion(repre_entity) + template_data = repre_entity["context"] + template_data.update(copy.deepcopy(general_template_data)) template_data.update(get_folder_template_data( repre_hierarchy.folder, project_name From 30a3aeaa86c4a6d6496b7887269069a2ea543691 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Tue, 29 Oct 2024 11:31:00 +0100 Subject: [PATCH 13/15] remove space between version and dot --- client/ayon_core/pipeline/delivery.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/pipeline/delivery.py b/client/ayon_core/pipeline/delivery.py index de89c8eec2..1a8a8498b9 100644 --- a/client/ayon_core/pipeline/delivery.py +++ b/client/ayon_core/pipeline/delivery.py @@ -384,7 +384,7 @@ def get_representations_delivery_template_data( template_data = repre_entity["context"] # Bug in 'ayon_api', 'get_representations_hierarchy' did not fully - # convert representation entity. Fixed in 'ayon_api' 1.0.10 . + # convert representation entity. Fixed in 'ayon_api' 1.0.10. if isinstance(template_data, str): con = ayon_api.get_server_api_connection() repre_entity = con._representation_conversion(repre_entity) From e3022d01786a6cd8ff90ae5816c658cd91f467c2 Mon Sep 17 00:00:00 2001 From: Ynbot Date: Wed, 30 Oct 2024 12:24:12 +0000 Subject: [PATCH 14/15] [Automated] Add generated package files to main --- client/ayon_core/version.py | 2 +- package.py | 2 +- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/ayon_core/version.py b/client/ayon_core/version.py index 8a7065c93c..5a3281ed01 100644 --- a/client/ayon_core/version.py +++ b/client/ayon_core/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- """Package declaring AYON addon 'core' version.""" -__version__ = "1.0.4+dev" +__version__ = "1.0.5" diff --git a/package.py b/package.py index 7c5bffe81f..ec21628d04 100644 --- a/package.py +++ b/package.py @@ -1,6 +1,6 @@ name = "core" title = "Core" -version = "1.0.4+dev" +version = "1.0.5" client_dir = "ayon_core" diff --git a/pyproject.toml b/pyproject.toml index c686d685fb..6bdffc663e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ [tool.poetry] name = "ayon-core" -version = "1.0.4+dev" +version = "1.0.5" description = "" authors = ["Ynput Team "] readme = "README.md" From 1af3b2d242ee10e13712afc101523a46703c9eef Mon Sep 17 00:00:00 2001 From: Ynbot Date: Wed, 30 Oct 2024 12:25:01 +0000 Subject: [PATCH 15/15] [Automated] Update version in package.py for develop --- client/ayon_core/version.py | 2 +- package.py | 2 +- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/ayon_core/version.py b/client/ayon_core/version.py index 5a3281ed01..b2480af462 100644 --- a/client/ayon_core/version.py +++ b/client/ayon_core/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- """Package declaring AYON addon 'core' version.""" -__version__ = "1.0.5" +__version__ = "1.0.5+dev" diff --git a/package.py b/package.py index ec21628d04..38d930189f 100644 --- a/package.py +++ b/package.py @@ -1,6 +1,6 @@ name = "core" title = "Core" -version = "1.0.5" +version = "1.0.5+dev" client_dir = "ayon_core" diff --git a/pyproject.toml b/pyproject.toml index 6bdffc663e..31acb3f8b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ [tool.poetry] name = "ayon-core" -version = "1.0.5" +version = "1.0.5+dev" description = "" authors = ["Ynput Team "] readme = "README.md"