From f1aed92d795b92ac2ec15a52e91a9ae37535da87 Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Fri, 5 Jul 2024 15:21:41 +0200 Subject: [PATCH 1/5] Enable asset contributions to write AYON Entity URIs --- .../publish/extract_usd_layer_contributions.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 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 162b7d3d41..58cffcd59a 100644 --- a/client/ayon_core/plugins/publish/extract_usd_layer_contributions.py +++ b/client/ayon_core/plugins/publish/extract_usd_layer_contributions.py @@ -561,6 +561,8 @@ class ExtractUSDLayerContribution(publish.Extractor): label = "Extract USD Layer Contributions (Asset/Shot)" order = pyblish.api.ExtractorOrder + 0.45 + use_ayon_entity_uri = True + def process(self, instance): folder_path = instance.data["folderPath"] @@ -578,7 +580,8 @@ def process(self, instance): contributions = instance.data.get("usd_contributions", []) for contribution in sorted(contributions, key=attrgetter("order")): - path = get_instance_uri_path(contribution.instance) + path = get_instance_uri_path(contribution.instance, + resolve=not self.use_ayon_entity_uri) if isinstance(contribution, VariantContribution): # Add contribution as a reference inside a variant self.log.debug(f"Adding variant: {contribution}") @@ -720,6 +723,8 @@ class ExtractUSDAssetContribution(publish.Extractor): label = "Extract USD Asset/Shot Contributions" order = ExtractUSDLayerContribution.order + 0.01 + use_ayon_entity_uri = True + def process(self, instance): folder_path = instance.data["folderPath"] @@ -795,15 +800,15 @@ def sort_by_order(instance): layer_id = layer_instance.data["usd_layer_id"] order = layer_instance.data["usd_layer_order"] - path = get_instance_uri_path(instance=layer_instance) + path = get_instance_uri_path(instance=layer_instance, + resolve=not self.use_ayon_entity_uri) add_ordered_sublayer(target_layer, contribution_path=path, layer_id=layer_id, order=order, # Add the sdf argument metadata which allows # us to later detect whether another path - # has the same layer id, so we can replace it - # it. + # has the same layer id, so we can replace it. add_sdf_arguments_metadata=True) # Save the file From 104e03b13d2185b97ac926992abb4f13ac9756b8 Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Fri, 5 Jul 2024 15:59:55 +0200 Subject: [PATCH 2/5] Add toggle to settings --- server/settings/publish_plugins.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/server/settings/publish_plugins.py b/server/settings/publish_plugins.py index 36bb3f7340..930fa9d0a3 100644 --- a/server/settings/publish_plugins.py +++ b/server/settings/publish_plugins.py @@ -84,6 +84,17 @@ def validate_unique_outputs(cls, value): return value +class AyonEntityURIModel(BaseSettingsModel): + use_ayon_entity_uri: bool = SettingsField( + title="Use AYON Entity URI", + description=( + "When enabled the USD paths written using the contribution " + "workflow will use ayon entity URIs instead of resolved published " + "paths. You can only load these if you use the AYON USD Resolver." + ) + ) + + class PluginStateByHostModelProfile(BaseSettingsModel): _layout = "expanded" # Filtering @@ -857,6 +868,14 @@ class PublishPuginsModel(BaseSettingsModel): default_factory=ExtractBurninModel, title="Extract Burnin" ) + ExtractUSDAssetContribution: AyonEntityURIModel = SettingsField( + default_factory=AyonEntityURIModel, + title="Extract USD Asset Contribution", + ) + ExtractUSDLayerContribution: AyonEntityURIModel = SettingsField( + default_factory=AyonEntityURIModel, + title="Extract USD Layer Contribution", + ) PreIntegrateThumbnails: PreIntegrateThumbnailsModel = SettingsField( default_factory=PreIntegrateThumbnailsModel, title="Override Integrate Thumbnail Representations" @@ -1161,6 +1180,12 @@ class PublishPuginsModel(BaseSettingsModel): } ] }, + "ExtractUSDAssetContribution": { + "use_ayon_entity_uri": True, + }, + "ExtractUSDLayerContribution": { + "use_ayon_entity_uri": True, + }, "PreIntegrateThumbnails": { "enabled": True, "integrate_profiles": [] From 86066660e854011d839a2412f1868b32a0e3b8cf Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Fri, 5 Jul 2024 16:00:15 +0200 Subject: [PATCH 3/5] Change default state to False --- 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 930fa9d0a3..c1c6bc42a5 100644 --- a/server/settings/publish_plugins.py +++ b/server/settings/publish_plugins.py @@ -1181,10 +1181,10 @@ class PublishPuginsModel(BaseSettingsModel): ] }, "ExtractUSDAssetContribution": { - "use_ayon_entity_uri": True, + "use_ayon_entity_uri": False, }, "ExtractUSDLayerContribution": { - "use_ayon_entity_uri": True, + "use_ayon_entity_uri": False, }, "PreIntegrateThumbnails": { "enabled": True, From 073ab83e78279d4bc51a09e452ff64403193fd1b Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Fri, 26 Jul 2024 15:39:59 +0200 Subject: [PATCH 4/5] Write the version instead of "latest" into the AYON URI --- .../plugins/publish/extract_usd_layer_contributions.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 58cffcd59a..7ed129a127 100644 --- a/client/ayon_core/plugins/publish/extract_usd_layer_contributions.py +++ b/client/ayon_core/plugins/publish/extract_usd_layer_contributions.py @@ -138,13 +138,14 @@ def get_instance_uri_path( folder_path = instance.data["folderPath"] product_name = instance.data["productName"] project_name = context.data["projectName"] + version_name = instance.data["version"] # Get the layer's published path path = construct_ayon_entity_uri( project_name=project_name, folder_path=folder_path, product=product_name, - version="latest", + version=version_name, representation_name="usd" ) From b309ec6967cb33070413117d98af95eb188f6508 Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Tue, 27 Aug 2024 14:55:28 +0200 Subject: [PATCH 5/5] Match the defaults from settings - so that if for whatever reason settings do not exist (e.g. dev mode using older addon on server in bundle) that it still runs backwards compatible and has this disabled by default --- .../plugins/publish/extract_usd_layer_contributions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 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 7ed129a127..8b58f447d6 100644 --- a/client/ayon_core/plugins/publish/extract_usd_layer_contributions.py +++ b/client/ayon_core/plugins/publish/extract_usd_layer_contributions.py @@ -562,7 +562,7 @@ class ExtractUSDLayerContribution(publish.Extractor): label = "Extract USD Layer Contributions (Asset/Shot)" order = pyblish.api.ExtractorOrder + 0.45 - use_ayon_entity_uri = True + use_ayon_entity_uri = False def process(self, instance): @@ -724,7 +724,7 @@ class ExtractUSDAssetContribution(publish.Extractor): label = "Extract USD Asset/Shot Contributions" order = ExtractUSDLayerContribution.order + 0.01 - use_ayon_entity_uri = True + use_ayon_entity_uri = False def process(self, instance):