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 }} diff --git a/client/ayon_core/lib/attribute_definitions.py b/client/ayon_core/lib/attribute_definitions.py index 4877a45118..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 @@ -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 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] diff --git a/client/ayon_core/pipeline/delivery.py b/client/ayon_core/pipeline/delivery.py index 2a2adf984a..366c261e08 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 @@ -402,5 +409,9 @@ def get_representations_delivery_template_data( "version": version_entity["version"], }) _merge_data(template_data, repre_entity["context"]) + + # Remove roots from template data to auto-fill them with anatomy data + template_data.pop("root", None) + output[repre_id] = template_data return output 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 ) 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..180cb8bbf1 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,18 @@ 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 + publish_attributes = instance["publish_attributes"].get( + cls.__name__, {}) + + visible = publish_attributes.get("contribution_enabled", True) + variant_visible = visible and publish_attributes.get( + "contribution_apply_as_variant", True) return [ UISeparatorDef("usd_container_settings1"), @@ -484,7 +495,8 @@ class CollectUSDLayerContributions(pyblish.api.InstancePlugin, "the contribution itself will be added to the " "department layer." ), - default="usdAsset"), + default="usdAsset", + visible=visible), EnumDef("contribution_target_product_init", label="Initialize as", tooltip=( @@ -495,7 +507,8 @@ class CollectUSDLayerContributions(pyblish.api.InstancePlugin, "setting will do nothing." ), items=["asset", "shot"], - default="asset"), + default="asset", + visible=visible), # Asset layer, e.g. model.usd, look.usd, rig.usd EnumDef("contribution_layer", @@ -507,7 +520,8 @@ class CollectUSDLayerContributions(pyblish.api.InstancePlugin, "the list) will contribute as a stronger opinion." ), items=list(cls.contribution_layers.keys()), - default="model"), + default="model", + visible=visible), BoolDef("contribution_apply_as_variant", label="Add as variant", tooltip=( @@ -518,13 +532,16 @@ class CollectUSDLayerContributions(pyblish.api.InstancePlugin, "appended to as a sublayer to the department layer " "instead." ), - default=True), + default=True, + visible=visible), TextDef("contribution_variant_set_name", label="Variant Set Name", - default="{layer}"), + default="{layer}", + visible=variant_visible), TextDef("contribution_variant", label="Variant Name", - default="{variant}"), + default="{variant}", + visible=variant_visible), BoolDef("contribution_variant_is_default", label="Set as default variant selection", tooltip=( @@ -535,10 +552,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, + visible=variant_visible), 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 +599,12 @@ 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): + # 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 layer_def = next(d for d in defs if d.key == "contribution_layer") diff --git a/client/ayon_core/version.py b/client/ayon_core/version.py index 9a951d7fd4..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.3+dev" +__version__ = "1.0.5+dev" diff --git a/package.py b/package.py index 5d5218748c..38d930189f 100644 --- a/package.py +++ b/package.py @@ -1,6 +1,6 @@ name = "core" title = "Core" -version = "1.0.3+dev" +version = "1.0.5+dev" client_dir = "ayon_core" diff --git a/pyproject.toml b/pyproject.toml index ebf08be4a8..31acb3f8b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ [tool.poetry] name = "ayon-core" -version = "1.0.3+dev" +version = "1.0.5+dev" description = "" authors = ["Ynput Team "] readme = "README.md" 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 )