From 0fc23ce2e7600c335bd05ccc642f742497a36282 Mon Sep 17 00:00:00 2001 From: Simone Barbieri Date: Thu, 21 Dec 2023 15:06:31 +0000 Subject: [PATCH 01/58] Changed logic for creation of output node --- openpype/hosts/blender/api/render_lib.py | 70 ++++++++++++++++-------- 1 file changed, 48 insertions(+), 22 deletions(-) diff --git a/openpype/hosts/blender/api/render_lib.py b/openpype/hosts/blender/api/render_lib.py index b437078ad8..cdccf13805 100644 --- a/openpype/hosts/blender/api/render_lib.py +++ b/openpype/hosts/blender/api/render_lib.py @@ -135,71 +135,95 @@ def set_render_passes(settings): return aov_list, custom_passes -def set_node_tree(output_path, name, aov_sep, ext, multilayer): +def set_node_tree(output_path, render_product, name, aov_sep, ext, multilayer): # Set the scene to use the compositor node tree to render bpy.context.scene.use_nodes = True tree = bpy.context.scene.node_tree + comp_layer_type = "CompositorNodeRLayers" + output_type = "CompositorNodeOutputFile" + # Get the Render Layers node rl_node = None for node in tree.nodes: - if node.bl_idname == "CompositorNodeRLayers": + if node.bl_idname == comp_layer_type: rl_node = node break # If there's not a Render Layers node, we create it if not rl_node: - rl_node = tree.nodes.new("CompositorNodeRLayers") + rl_node = tree.nodes.new(comp_layer_type) # Get the enabled output sockets, that are the active passes for the # render. # We also exclude some layers. - exclude_sockets = ["Image", "Alpha", "Noisy Image"] + exclude_sockets = ["Alpha", "Noisy Image"] passes = [ socket for socket in rl_node.outputs if socket.enabled and socket.name not in exclude_sockets ] - # Remove all output nodes + old_output = None + + # Remove all output nodes that inlcude "AYON" in the name. + # There should be only one. for node in tree.nodes: - if node.bl_idname == "CompositorNodeOutputFile": - tree.nodes.remove(node) + if node.bl_idname == output_type and "AYON" in node.name: + old_output = node + break # Create a new output node - output = tree.nodes.new("CompositorNodeOutputFile") + output = tree.nodes.new(output_type) image_settings = bpy.context.scene.render.image_settings output.format.file_format = image_settings.file_format + slots = None + # In case of a multilayer exr, we don't need to use the output node, # because the blender render already outputs a multilayer exr. - if ext == "exr" and multilayer: - output.layer_slots.clear() - return [] + multi_exr = ext == "exr" and multilayer + slots = output.layer_slots if multi_exr else output.file_slots + output.base_path = render_product if multi_exr else str(output_path) - output.file_slots.clear() - output.base_path = str(output_path) + slots.clear() aov_file_products = [] # For each active render pass, we add a new socket to the output node # and link it - for render_pass in passes: - filepath = f"{name}{aov_sep}{render_pass.name}.####" + for rpass in passes: + if rpass.name == "Image": + pass_name = "rgba" if multi_exr else "beauty" + else: + pass_name = rpass.name + filepath = f"{name}{aov_sep}{pass_name}.####" - output.file_slots.new(filepath) + slots.new(pass_name if multi_exr else filepath) filename = str(output_path / filepath.lstrip("/")) - aov_file_products.append((render_pass.name, filename)) + aov_file_products.append((rpass.name, filename)) - node_input = output.inputs[-1] + if not old_output: + node_input = output.inputs[-1] + tree.links.new(rpass, node_input) - tree.links.new(render_pass, node_input) + for link in tree.links: + if link.to_node == old_output: + socket_name = link.to_socket.name + new_socket = output.inputs.get(socket_name) + if new_socket: + tree.links.new(link.from_socket, new_socket) - return aov_file_products + if old_output: + output.location = old_output.location + tree.nodes.remove(old_output) + output.name = "AYON File Output" + + return [] if multi_exr else aov_file_products def imprint_render_settings(node, data): @@ -236,9 +260,11 @@ def prepare_rendering(asset_group): render_product = get_render_product(output_path, name, aov_sep) aov_file_product = set_node_tree( - output_path, name, aov_sep, ext, multilayer) + output_path, render_product, name, aov_sep, ext, multilayer) - bpy.context.scene.render.filepath = render_product + # Clear the render filepath, so that the output is handled only by the + # output node in the compositor. + bpy.context.scene.render.filepath = "" render_settings = { "render_folder": render_folder, From fa5b9777a98cca34f5cd5412500f34825a6ff3d8 Mon Sep 17 00:00:00 2001 From: Simone Barbieri Date: Thu, 21 Dec 2023 15:07:00 +0000 Subject: [PATCH 02/58] Create a new version of the workfile instead of overwriting current one --- openpype/hosts/blender/plugins/create/create_render.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openpype/hosts/blender/plugins/create/create_render.py b/openpype/hosts/blender/plugins/create/create_render.py index 7fb3e5eb00..e728579286 100644 --- a/openpype/hosts/blender/plugins/create/create_render.py +++ b/openpype/hosts/blender/plugins/create/create_render.py @@ -1,8 +1,10 @@ """Create render.""" import bpy +from openpype.lib import version_up from openpype.hosts.blender.api import plugin from openpype.hosts.blender.api.render_lib import prepare_rendering +from openpype.hosts.blender.api.workio import save_file class CreateRenderlayer(plugin.BaseCreator): @@ -37,6 +39,7 @@ class CreateRenderlayer(plugin.BaseCreator): # settings. Even the validator to check that the file is saved will # detect the file as saved, even if it isn't. The only solution for # now it is to force the file to be saved. - bpy.ops.wm.save_as_mainfile(filepath=bpy.data.filepath) + filepath = version_up(bpy.data.filepath) + save_file(filepath, copy=False) return collection From 0534c9c55d9eb5d0f193b2c64c3a870b6082a092 Mon Sep 17 00:00:00 2001 From: Simone Barbieri Date: Thu, 18 Jan 2024 10:13:24 +0000 Subject: [PATCH 03/58] Fix error when getting setting value in Ayon --- openpype/hosts/blender/api/render_lib.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openpype/hosts/blender/api/render_lib.py b/openpype/hosts/blender/api/render_lib.py index cdccf13805..904cabfc05 100644 --- a/openpype/hosts/blender/api/render_lib.py +++ b/openpype/hosts/blender/api/render_lib.py @@ -2,6 +2,7 @@ from pathlib import Path import bpy +from openpype import AYON_SERVER_ENABLED from openpype.settings import get_project_settings from openpype.pipeline import get_current_project_name @@ -124,13 +125,14 @@ def set_render_passes(settings): aovs_names = [aov.name for aov in vl.aovs] for cp in custom_passes: - cp_name = cp[0] + cp_name = cp["attribute"] if AYON_SERVER_ENABLED else cp[0] if cp_name not in aovs_names: aov = vl.aovs.add() aov.name = cp_name else: aov = vl.aovs[cp_name] - aov.type = cp[1].get("type", "VALUE") + aov.type = (cp["value"] + if AYON_SERVER_ENABLED else cp[1].get("type", "VALUE")) return aov_list, custom_passes From 1eb07bcedb97edef9bbf57fa7c605bf85794a33f Mon Sep 17 00:00:00 2001 From: Simone Barbieri Date: Thu, 18 Jan 2024 10:16:05 +0000 Subject: [PATCH 04/58] Added setting to choose render engine --- openpype/hosts/blender/api/render_lib.py | 11 ++++++++++- .../blender/server/settings/render_settings.py | 13 +++++++++++++ server_addon/blender/server/version.py | 2 +- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/openpype/hosts/blender/api/render_lib.py b/openpype/hosts/blender/api/render_lib.py index 904cabfc05..06353f8e8b 100644 --- a/openpype/hosts/blender/api/render_lib.py +++ b/openpype/hosts/blender/api/render_lib.py @@ -48,6 +48,14 @@ def get_multilayer(settings): ["multilayer_exr"]) +def get_renderer(settings): + """Get renderer from blender settings.""" + + return (settings["blender"] + ["RenderSettings"] + ["renderer"]) + + def get_render_product(output_path, name, aov_sep): """ Generate the path to the render product. Blender interprets the `#` @@ -254,9 +262,10 @@ def prepare_rendering(asset_group): aov_sep = get_aov_separator(settings) ext = get_image_format(settings) multilayer = get_multilayer(settings) + renderer = get_renderer(settings) set_render_format(ext, multilayer) - aov_list, custom_passes = set_render_passes(settings) + bpy.context.scene.render.engine = renderer output_path = Path.joinpath(dirpath, render_folder, file_name) diff --git a/server_addon/blender/server/settings/render_settings.py b/server_addon/blender/server/settings/render_settings.py index f62013982e..53cefd145d 100644 --- a/server_addon/blender/server/settings/render_settings.py +++ b/server_addon/blender/server/settings/render_settings.py @@ -25,6 +25,13 @@ def image_format_enum(): ] +def renderers_enum(): + return [ + {"value": "CYCLES", "label": "Cycles"}, + {"value": "BLENDER_EEVEE", "label": "Eevee"}, + ] + + def aov_list_enum(): return [ {"value": "empty", "label": "< none >"}, @@ -83,6 +90,11 @@ class RenderSettingsModel(BaseSettingsModel): multilayer_exr: bool = Field( title="Multilayer (EXR)" ) + renderer: str = Field( + "CYCLES", + title="Renderer", + enum_resolver=renderers_enum + ) aov_list: list[str] = Field( default_factory=list, enum_resolver=aov_list_enum, @@ -104,6 +116,7 @@ DEFAULT_RENDER_SETTINGS = { "aov_separator": "underscore", "image_format": "exr", "multilayer_exr": True, + "renderer": "CYCLES", "aov_list": [], "custom_passes": [] } diff --git a/server_addon/blender/server/version.py b/server_addon/blender/server/version.py index 1276d0254f..0a8da88258 100644 --- a/server_addon/blender/server/version.py +++ b/server_addon/blender/server/version.py @@ -1 +1 @@ -__version__ = "0.1.5" +__version__ = "0.1.6" From 2f58708f584a63a68ffcbe2c429704dca566f43b Mon Sep 17 00:00:00 2001 From: Simone Barbieri Date: Thu, 18 Jan 2024 10:16:31 +0000 Subject: [PATCH 05/58] Updated aov list --- openpype/hosts/blender/api/render_lib.py | 62 ++++++++++++++----- .../server/settings/render_settings.py | 50 ++++++++++++--- 2 files changed, 90 insertions(+), 22 deletions(-) diff --git a/openpype/hosts/blender/api/render_lib.py b/openpype/hosts/blender/api/render_lib.py index 06353f8e8b..44ee2be208 100644 --- a/openpype/hosts/blender/api/render_lib.py +++ b/openpype/hosts/blender/api/render_lib.py @@ -100,36 +100,69 @@ def set_render_format(ext, multilayer): image_settings.file_format = "TIFF" -def set_render_passes(settings): - aov_list = (settings["blender"] - ["RenderSettings"] - ["aov_list"]) - - custom_passes = (settings["blender"] - ["RenderSettings"] - ["custom_passes"]) +def set_render_passes(settings, renderer): + aov_list = settings["blender"]["RenderSettings"]["aov_list"] + custom_passes = settings["blender"]["RenderSettings"]["custom_passes"] + # Common passes for both renderers vl = bpy.context.view_layer + # Data Passes vl.use_pass_combined = "combined" in aov_list vl.use_pass_z = "z" in aov_list vl.use_pass_mist = "mist" in aov_list vl.use_pass_normal = "normal" in aov_list + + # Light Passes vl.use_pass_diffuse_direct = "diffuse_light" in aov_list vl.use_pass_diffuse_color = "diffuse_color" in aov_list vl.use_pass_glossy_direct = "specular_light" in aov_list vl.use_pass_glossy_color = "specular_color" in aov_list - vl.eevee.use_pass_volume_direct = "volume_light" in aov_list vl.use_pass_emit = "emission" in aov_list vl.use_pass_environment = "environment" in aov_list - vl.use_pass_shadow = "shadow" in aov_list vl.use_pass_ambient_occlusion = "ao" in aov_list - cycles = vl.cycles + # Cryptomatte Passes + vl.use_pass_cryptomatte_object = "cryptomatte_object" in aov_list + vl.use_pass_cryptomatte_material = "cryptomatte_material" in aov_list + vl.use_pass_cryptomatte_asset = "cryptomatte_asset" in aov_list - cycles.denoising_store_passes = "denoising" in aov_list - cycles.use_pass_volume_direct = "volume_direct" in aov_list - cycles.use_pass_volume_indirect = "volume_indirect" in aov_list + if renderer == "BLENDER_EEVEE": + # Eevee exclusive passes + eevee = vl.eevee + + # Light Passes + vl.use_pass_shadow = "shadow" in aov_list + eevee.use_pass_volume_direct = "volume_light" in aov_list + + # Effects Passes + eevee.use_pass_bloom = "bloom" in aov_list + eevee.use_pass_transparent = "transparent" in aov_list + + # Cryptomatte Passes + vl.use_pass_cryptomatte_accurate = "cryptomatte_accurate" in aov_list + elif renderer == "CYCLES": + # Cycles exclusive passes + cycles = vl.cycles + + # Data Passes + vl.use_pass_position = "position" in aov_list + vl.use_pass_vector = "vector" in aov_list + vl.use_pass_uv = "uv" in aov_list + cycles.denoising_store_passes = "denoising" in aov_list + vl.use_pass_object_index = "object_index" in aov_list + vl.use_pass_material_index = "material_index" in aov_list + cycles.pass_debug_sample_count = "sample_count" in aov_list + + # Light Passes + vl.use_pass_diffuse_indirect = "diffuse_indirect" in aov_list + vl.use_pass_glossy_indirect = "specular_indirect" in aov_list + vl.use_pass_transmission_direct = "transmission_direct" in aov_list + vl.use_pass_transmission_indirect = "transmission_indirect" in aov_list + vl.use_pass_transmission_color = "transmission_color" in aov_list + cycles.use_pass_volume_direct = "volume_light" in aov_list + cycles.use_pass_volume_indirect = "volume_indirect" in aov_list + cycles.use_pass_shadow_catcher = "shadow" in aov_list aovs_names = [aov.name for aov in vl.aovs] for cp in custom_passes: @@ -266,6 +299,7 @@ def prepare_rendering(asset_group): set_render_format(ext, multilayer) bpy.context.scene.render.engine = renderer + aov_list, custom_passes = set_render_passes(settings, renderer) output_path = Path.joinpath(dirpath, render_folder, file_name) diff --git a/server_addon/blender/server/settings/render_settings.py b/server_addon/blender/server/settings/render_settings.py index 53cefd145d..3ab720fc6a 100644 --- a/server_addon/blender/server/settings/render_settings.py +++ b/server_addon/blender/server/settings/render_settings.py @@ -39,18 +39,52 @@ def aov_list_enum(): {"value": "z", "label": "Z"}, {"value": "mist", "label": "Mist"}, {"value": "normal", "label": "Normal"}, - {"value": "diffuse_light", "label": "Diffuse Light"}, + {"value": "position", "label": "Position (Cycles Only)"}, + {"value": "vector", "label": "Vector (Cycles Only)"}, + {"value": "uv", "label": "UV (Cycles Only)"}, + {"value": "denoising", "label": "Denoising Data (Cycles Only)"}, + {"value": "object_index", "label": "Object Index (Cycles Only)"}, + {"value": "material_index", "label": "Material Index (Cycles Only)"}, + {"value": "sample_count", "label": "Sample Count (Cycles Only)"}, + {"value": "diffuse_light", "label": "Diffuse Light/Direct"}, + { + "value": "diffuse_indirect", + "label": "Diffuse Indirect (Cycles Only)" + }, {"value": "diffuse_color", "label": "Diffuse Color"}, - {"value": "specular_light", "label": "Specular Light"}, - {"value": "specular_color", "label": "Specular Color"}, - {"value": "volume_light", "label": "Volume Light"}, + {"value": "specular_light", "label": "Specular (Glossy) Light/Direct"}, + { + "value": "specular_indirect", + "label": "Specular (Glossy) Indirect (Cycles Only)" + }, + {"value": "specular_color", "label": "Specular (Glossy) Color"}, + { + "value": "transmission_light", + "label": "Transmission Light/Direct (Cycles Only)" + }, + { + "value": "transmission_indirect", + "label": "Transmission Indirect (Cycles Only)" + }, + { + "value": "transmission_color", + "label": "Transmission Color (Cycles Only)" + }, + {"value": "volume_light", "label": "Volume Light/Direct"}, + {"value": "volume_indirect", "label": "Volume Indirect (Cycles Only)"}, {"value": "emission", "label": "Emission"}, {"value": "environment", "label": "Environment"}, - {"value": "shadow", "label": "Shadow"}, + {"value": "shadow", "label": "Shadow/Shadow Catcher"}, {"value": "ao", "label": "Ambient Occlusion"}, - {"value": "denoising", "label": "Denoising"}, - {"value": "volume_direct", "label": "Direct Volumetric Scattering"}, - {"value": "volume_indirect", "label": "Indirect Volumetric Scattering"} + {"value": "bloom", "label": "Bloom (Eevee Only)"}, + {"value": "transparent", "label": "Transparent (Eevee Only)"}, + {"value": "cryptomatte_object", "label": "Cryptomatte Object"}, + {"value": "cryptomatte_material", "label": "Cryptomatte Material"}, + {"value": "cryptomatte_asset", "label": "Cryptomatte Asset"}, + { + "value": "cryptomatte_accurate", + "label": "Cryptomatte Accurate Mode (Eevee Only)" + }, ] From 91f67ca9b0a199e110650fd899d562eae3cdcd16 Mon Sep 17 00:00:00 2001 From: Simone Barbieri Date: Fri, 19 Jan 2024 10:00:58 +0000 Subject: [PATCH 06/58] Updated default settings for render passes --- server_addon/blender/server/settings/render_settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server_addon/blender/server/settings/render_settings.py b/server_addon/blender/server/settings/render_settings.py index 3ab720fc6a..580547e510 100644 --- a/server_addon/blender/server/settings/render_settings.py +++ b/server_addon/blender/server/settings/render_settings.py @@ -151,6 +151,6 @@ DEFAULT_RENDER_SETTINGS = { "image_format": "exr", "multilayer_exr": True, "renderer": "CYCLES", - "aov_list": [], + "aov_list": ["combined"], "custom_passes": [] } From dd0533ecb36b19988ccb67b0b2e83a50f7090be1 Mon Sep 17 00:00:00 2001 From: Simone Barbieri Date: Fri, 19 Jan 2024 10:03:05 +0000 Subject: [PATCH 07/58] Added composite output --- openpype/hosts/blender/api/render_lib.py | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/openpype/hosts/blender/api/render_lib.py b/openpype/hosts/blender/api/render_lib.py index 44ee2be208..fc47f5a659 100644 --- a/openpype/hosts/blender/api/render_lib.py +++ b/openpype/hosts/blender/api/render_lib.py @@ -186,12 +186,17 @@ def set_node_tree(output_path, render_product, name, aov_sep, ext, multilayer): comp_layer_type = "CompositorNodeRLayers" output_type = "CompositorNodeOutputFile" + compositor_type = "CompositorNodeComposite" - # Get the Render Layers node + # Get the Render Layer and Composite nodes rl_node = None + comp_node = None for node in tree.nodes: if node.bl_idname == comp_layer_type: rl_node = node + elif node.bl_idname == compositor_type: + comp_node = node + if rl_node and comp_node: break # If there's not a Render Layers node, we create it @@ -242,29 +247,38 @@ def set_node_tree(output_path, render_product, name, aov_sep, ext, multilayer): pass_name = "rgba" if multi_exr else "beauty" else: pass_name = rpass.name - filepath = f"{name}{aov_sep}{pass_name}.####" + filename = f"{name}{aov_sep}{pass_name}.####" - slots.new(pass_name if multi_exr else filepath) + slots.new(pass_name if multi_exr else filename) - filename = str(output_path / filepath.lstrip("/")) + filepath = str(output_path / filename.lstrip("/")) - aov_file_products.append((rpass.name, filename)) + aov_file_products.append((rpass.name, filepath)) if not old_output: node_input = output.inputs[-1] tree.links.new(rpass, node_input) + # Create a new socket for the composite output + pass_name = "composite" + filename = f"{name}{aov_sep}{pass_name}.####" + comp_socket = slots.new(pass_name if multi_exr else filename) + aov_file_products.append(("Composite", filepath)) + for link in tree.links: if link.to_node == old_output: socket_name = link.to_socket.name new_socket = output.inputs.get(socket_name) if new_socket: tree.links.new(link.from_socket, new_socket) + elif comp_node and link.to_node == comp_node: + tree.links.new(link.from_socket, comp_socket) if old_output: output.location = old_output.location tree.nodes.remove(old_output) output.name = "AYON File Output" + output.label = "AYON File Output" return [] if multi_exr else aov_file_products From c911c67dae109a3c769fa4fe584f925f3afe7a2e Mon Sep 17 00:00:00 2001 From: Simone Barbieri Date: Fri, 19 Jan 2024 11:04:25 +0000 Subject: [PATCH 08/58] Updated OpenPype Settings --- .../defaults/project_settings/blender.json | 3 +- .../schema_project_blender.json | 43 +++++++++++++++---- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/openpype/settings/defaults/project_settings/blender.json b/openpype/settings/defaults/project_settings/blender.json index 385e97ef91..48f3ef8ef0 100644 --- a/openpype/settings/defaults/project_settings/blender.json +++ b/openpype/settings/defaults/project_settings/blender.json @@ -22,7 +22,8 @@ "aov_separator": "underscore", "image_format": "exr", "multilayer_exr": true, - "aov_list": [], + "renderer": "CYCLES", + "aov_list": ["combined"], "custom_passes": [] }, "workfile_builder": { diff --git a/openpype/settings/entities/schemas/projects_schema/schema_project_blender.json b/openpype/settings/entities/schemas/projects_schema/schema_project_blender.json index 535d9434a3..bbed881ab0 100644 --- a/openpype/settings/entities/schemas/projects_schema/schema_project_blender.json +++ b/openpype/settings/entities/schemas/projects_schema/schema_project_blender.json @@ -103,6 +103,17 @@ "type": "label", "label": "Note: Multilayer EXR is only used when output format type set to EXR." }, + { + "key": "renderer", + "label": "Renderer", + "type": "enum", + "multiselection": false, + "defaults": "CYCLES", + "enum_items": [ + {"CYCLES": "Cycles"}, + {"BLENDER_EEVEE": "Eevee"} + ] + }, { "key": "aov_list", "label": "AOVs to create", @@ -115,18 +126,34 @@ {"z": "Z"}, {"mist": "Mist"}, {"normal": "Normal"}, - {"diffuse_light": "Diffuse Light"}, + {"position": "Position (Cycles Only)"}, + {"vector": "Vector (Cycles Only)"}, + {"uv": "UV (Cycles Only)"}, + {"denoising": "Denoising Data (Cycles Only)"}, + {"object_index": "Object Index (Cycles Only)"}, + {"material_index": "Material Index (Cycles Only)"}, + {"sample_count": "Sample Count (Cycles Only)"}, + {"diffuse_light": "Diffuse Light/Direct"}, + {"diffuse_indirect": "Diffuse Indirect (Cycles Only)"}, {"diffuse_color": "Diffuse Color"}, - {"specular_light": "Specular Light"}, - {"specular_color": "Specular Color"}, - {"volume_light": "Volume Light"}, + {"specular_light": "Specular (Glossy) Light/Direct"}, + {"specular_indirect": "Specular (Glossy) Indirect (Cycles Only)"}, + {"specular_color": "Specular (Glossy) Color"}, + {"transmission_light": "Transmission Light/Direct (Cycles Only)"}, + {"transmission_indirect": "Transmission Indirect (Cycles Only)"}, + {"transmission_color": "Transmission Color (Cycles Only)"}, + {"volume_light": "Volume Light/Direct"}, + {"volume_indirect": "Volume Indirect (Cycles Only)"}, {"emission": "Emission"}, {"environment": "Environment"}, - {"shadow": "Shadow"}, + {"shadow": "Shadow/Shadow Catcher"}, {"ao": "Ambient Occlusion"}, - {"denoising": "Denoising"}, - {"volume_direct": "Direct Volumetric Scattering"}, - {"volume_indirect": "Indirect Volumetric Scattering"} + {"bloom": "Bloom (Eevee Only)"}, + {"transparent": "Transparent (Eevee Only)"}, + {"cryptomatte_object": "Cryptomatte Object"}, + {"cryptomatte_material": "Cryptomatte Material"}, + {"cryptomatte_asset": "Cryptomatte Asset"}, + {"cryptomatte_accurate": "Cryptomatte Accurate Mode (Eevee Only)"} ] }, { From 44282f86df721a271a291bc005abd07f896acb49 Mon Sep 17 00:00:00 2001 From: Simone Barbieri Date: Thu, 1 Feb 2024 10:42:34 +0000 Subject: [PATCH 09/58] Fixed deadline validator to check compositor tree output --- .../publish/validate_deadline_publish.py | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/openpype/hosts/blender/plugins/publish/validate_deadline_publish.py b/openpype/hosts/blender/plugins/publish/validate_deadline_publish.py index bb243f08cc..f7860dd75d 100644 --- a/openpype/hosts/blender/plugins/publish/validate_deadline_publish.py +++ b/openpype/hosts/blender/plugins/publish/validate_deadline_publish.py @@ -28,15 +28,27 @@ class ValidateDeadlinePublish(pyblish.api.InstancePlugin, def process(self, instance): if not self.is_active(instance.data): return + + tree = bpy.context.scene.node_tree + output_type = "CompositorNodeOutputFile" + output_node = None + # Remove all output nodes that inlcude "AYON" in the name. + # There should be only one. + for node in tree.nodes: + if node.bl_idname == output_type and "AYON" in node.name: + output_node = node + break + if not output_node: + raise PublishValidationError( + "No output node found in the compositor tree." + ) filepath = bpy.data.filepath file = os.path.basename(filepath) filename, ext = os.path.splitext(file) - if filename not in bpy.context.scene.render.filepath: + if filename not in output_node.base_path: raise PublishValidationError( - "Render output folder " - "doesn't match the blender scene name! " - "Use Repair action to " - "fix the folder file path." + "Render output folder doesn't match the blender scene name! " + "Use Repair action to fix the folder file path." ) @classmethod From b7aa3e323d74a9524a30bfb472a07b77939ef8a2 Mon Sep 17 00:00:00 2001 From: MustafaJafar Date: Fri, 2 Feb 2024 11:38:23 +0200 Subject: [PATCH 10/58] fix default redshift version --- .../deadline/plugins/publish/submit_houdini_render_deadline.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/modules/deadline/plugins/publish/submit_houdini_render_deadline.py b/openpype/modules/deadline/plugins/publish/submit_houdini_render_deadline.py index bf7fb45a8b..e0e52fe6a6 100644 --- a/openpype/modules/deadline/plugins/publish/submit_houdini_render_deadline.py +++ b/openpype/modules/deadline/plugins/publish/submit_houdini_render_deadline.py @@ -45,7 +45,7 @@ class VrayRenderPluginInfo(): @attr.s class RedshiftRenderPluginInfo(): SceneFile = attr.ib(default=None) - Version = attr.ib(default=None) + Version = attr.ib(default="1") class HoudiniSubmitDeadline( From c2dbf604d8eb1fec466182f434daa332e952341f Mon Sep 17 00:00:00 2001 From: MustafaJafar Date: Fri, 2 Feb 2024 14:42:28 +0200 Subject: [PATCH 11/58] add comment about using v1 as RS default version --- .../deadline/plugins/publish/submit_houdini_render_deadline.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openpype/modules/deadline/plugins/publish/submit_houdini_render_deadline.py b/openpype/modules/deadline/plugins/publish/submit_houdini_render_deadline.py index e0e52fe6a6..582f7d081b 100644 --- a/openpype/modules/deadline/plugins/publish/submit_houdini_render_deadline.py +++ b/openpype/modules/deadline/plugins/publish/submit_houdini_render_deadline.py @@ -45,6 +45,9 @@ class VrayRenderPluginInfo(): @attr.s class RedshiftRenderPluginInfo(): SceneFile = attr.ib(default=None) + # "1" was selected as the default RS version as it's the default + # version in RS deadline plugin. + # https://docs.thinkboxsoftware.com/products/deadline/10.1/1_User%20Manual/manual/app-redshift.html#plug-in-configuration Version = attr.ib(default="1") From 7d586f59061cabab548516c3fcde289ad8dc3501 Mon Sep 17 00:00:00 2001 From: Mustafa Taher Date: Fri, 2 Feb 2024 15:06:12 +0200 Subject: [PATCH 12/58] remove RS deadline plugin doc link Co-authored-by: Roy Nieterau --- .../deadline/plugins/publish/submit_houdini_render_deadline.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openpype/modules/deadline/plugins/publish/submit_houdini_render_deadline.py b/openpype/modules/deadline/plugins/publish/submit_houdini_render_deadline.py index 582f7d081b..cf8e1617f2 100644 --- a/openpype/modules/deadline/plugins/publish/submit_houdini_render_deadline.py +++ b/openpype/modules/deadline/plugins/publish/submit_houdini_render_deadline.py @@ -47,7 +47,6 @@ class RedshiftRenderPluginInfo(): SceneFile = attr.ib(default=None) # "1" was selected as the default RS version as it's the default # version in RS deadline plugin. - # https://docs.thinkboxsoftware.com/products/deadline/10.1/1_User%20Manual/manual/app-redshift.html#plug-in-configuration Version = attr.ib(default="1") From 4e114b80324e71c808e65b872c965ce693c42923 Mon Sep 17 00:00:00 2001 From: Mustafa Taher Date: Fri, 2 Feb 2024 15:07:10 +0200 Subject: [PATCH 13/58] update comment about default RS version Co-authored-by: Roy Nieterau --- .../plugins/publish/submit_houdini_render_deadline.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openpype/modules/deadline/plugins/publish/submit_houdini_render_deadline.py b/openpype/modules/deadline/plugins/publish/submit_houdini_render_deadline.py index cf8e1617f2..402dcaf256 100644 --- a/openpype/modules/deadline/plugins/publish/submit_houdini_render_deadline.py +++ b/openpype/modules/deadline/plugins/publish/submit_houdini_render_deadline.py @@ -45,8 +45,9 @@ class VrayRenderPluginInfo(): @attr.s class RedshiftRenderPluginInfo(): SceneFile = attr.ib(default=None) - # "1" was selected as the default RS version as it's the default - # version in RS deadline plugin. + # Use "1" as the default Redshift version just because it + # default fallback version in Deadline's Redshift plugin + # if no version was specified Version = attr.ib(default="1") From 78a3ec2118c9963e31ea0b4ca2907d0b84a14b39 Mon Sep 17 00:00:00 2001 From: Simone Barbieri Date: Mon, 5 Feb 2024 12:06:19 +0000 Subject: [PATCH 14/58] Fixed issue with double entries in the json manifest --- openpype/hosts/blender/api/render_lib.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openpype/hosts/blender/api/render_lib.py b/openpype/hosts/blender/api/render_lib.py index fc47f5a659..c2792103e5 100644 --- a/openpype/hosts/blender/api/render_lib.py +++ b/openpype/hosts/blender/api/render_lib.py @@ -244,7 +244,9 @@ def set_node_tree(output_path, render_product, name, aov_sep, ext, multilayer): # and link it for rpass in passes: if rpass.name == "Image": - pass_name = "rgba" if multi_exr else "beauty" + if not multi_exr: + continue + pass_name = "rgba" else: pass_name = rpass.name filename = f"{name}{aov_sep}{pass_name}.####" @@ -263,6 +265,7 @@ def set_node_tree(output_path, render_product, name, aov_sep, ext, multilayer): pass_name = "composite" filename = f"{name}{aov_sep}{pass_name}.####" comp_socket = slots.new(pass_name if multi_exr else filename) + filepath = str(output_path / filename.lstrip("/")) aov_file_products.append(("Composite", filepath)) for link in tree.links: From f2429680ff5aa68b358ececeba02d24e9d86ad0c Mon Sep 17 00:00:00 2001 From: Simone Barbieri Date: Tue, 6 Feb 2024 15:43:18 +0000 Subject: [PATCH 15/58] Fix old links and duplicated entries in the manifest --- openpype/hosts/blender/api/render_lib.py | 114 ++++++++++++----------- 1 file changed, 62 insertions(+), 52 deletions(-) diff --git a/openpype/hosts/blender/api/render_lib.py b/openpype/hosts/blender/api/render_lib.py index c2792103e5..17b9d926ec 100644 --- a/openpype/hosts/blender/api/render_lib.py +++ b/openpype/hosts/blender/api/render_lib.py @@ -178,6 +178,14 @@ def set_render_passes(settings, renderer): return aov_list, custom_passes +def _create_aov_slot(name, aov_sep, slots, rpass_name, multi_exr, output_path): + filename = f"{name}{aov_sep}{rpass_name}.####" + slot = slots.new(rpass_name if multi_exr else filename) + filepath = str(output_path / filename.lstrip("/")) + + return slot, filepath + + def set_node_tree(output_path, render_product, name, aov_sep, ext, multilayer): # Set the scene to use the compositor node tree to render bpy.context.scene.use_nodes = True @@ -188,40 +196,34 @@ def set_node_tree(output_path, render_product, name, aov_sep, ext, multilayer): output_type = "CompositorNodeOutputFile" compositor_type = "CompositorNodeComposite" - # Get the Render Layer and Composite nodes - rl_node = None - comp_node = None + # Get the Render Layer, Composite and the previous output nodes + render_layer_node = None + composite_node = None + old_output_node = None for node in tree.nodes: if node.bl_idname == comp_layer_type: - rl_node = node + render_layer_node = node elif node.bl_idname == compositor_type: - comp_node = node - if rl_node and comp_node: + composite_node = node + elif node.bl_idname == output_type and "AYON" in node.name: + old_output_node = node + if render_layer_node and composite_node and old_output_node: break # If there's not a Render Layers node, we create it - if not rl_node: - rl_node = tree.nodes.new(comp_layer_type) + if not render_layer_node: + render_layer_node = tree.nodes.new(comp_layer_type) # Get the enabled output sockets, that are the active passes for the # render. # We also exclude some layers. - exclude_sockets = ["Alpha", "Noisy Image"] + exclude_sockets = ["Image", "Alpha", "Noisy Image"] passes = [ socket - for socket in rl_node.outputs + for socket in render_layer_node.outputs if socket.enabled and socket.name not in exclude_sockets ] - old_output = None - - # Remove all output nodes that inlcude "AYON" in the name. - # There should be only one. - for node in tree.nodes: - if node.bl_idname == output_type and "AYON" in node.name: - old_output = node - break - # Create a new output node output = tree.nodes.new(output_type) @@ -240,46 +242,54 @@ def set_node_tree(output_path, render_product, name, aov_sep, ext, multilayer): aov_file_products = [] - # For each active render pass, we add a new socket to the output node - # and link it - for rpass in passes: - if rpass.name == "Image": - if not multi_exr: - continue - pass_name = "rgba" - else: - pass_name = rpass.name - filename = f"{name}{aov_sep}{pass_name}.####" + old_links = { + link.from_socket.name: link for link in tree.links + if link.to_node == old_output_node} - slots.new(pass_name if multi_exr else filename) - - filepath = str(output_path / filename.lstrip("/")) - - aov_file_products.append((rpass.name, filepath)) - - if not old_output: - node_input = output.inputs[-1] - tree.links.new(rpass, node_input) + # Create a new socket for the beauty output + pass_name = "rgba" if multi_exr else "beauty" + slot, _ = _create_aov_slot( + name, aov_sep, slots, pass_name, multi_exr, output_path) + tree.links.new(render_layer_node.outputs["Image"], slot) # Create a new socket for the composite output pass_name = "composite" - filename = f"{name}{aov_sep}{pass_name}.####" - comp_socket = slots.new(pass_name if multi_exr else filename) - filepath = str(output_path / filename.lstrip("/")) + comp_socket, filepath = _create_aov_slot( + name, aov_sep, slots, pass_name, multi_exr, output_path) aov_file_products.append(("Composite", filepath)) - for link in tree.links: - if link.to_node == old_output: - socket_name = link.to_socket.name - new_socket = output.inputs.get(socket_name) - if new_socket: - tree.links.new(link.from_socket, new_socket) - elif comp_node and link.to_node == comp_node: - tree.links.new(link.from_socket, comp_socket) + # For each active render pass, we add a new socket to the output node + # and link it + for rpass in passes: + slot, filepath = _create_aov_slot( + name, aov_sep, slots, rpass.name, multi_exr, output_path) + aov_file_products.append((rpass.name, filepath)) + + # If the rpass was not connected with the old output node, we connect + # it with the new one. + if not old_links.get(rpass.name): + tree.links.new(rpass, slot) + + for link in list(old_links.values()): + # Check if the socket is still available in the new output node. + socket = output.inputs.get(link.to_socket.name) + # If it is, we connect it with the new output node. + if socket: + tree.links.new(link.from_socket, socket) + # Then, we remove the old link. + tree.links.remove(link) + + # If there's a composite node, we connect its input with the new output + if composite_node: + for link in tree.links: + if link.to_node == composite_node: + tree.links.new(link.from_socket, comp_socket) + break + + if old_output_node: + output.location = old_output_node.location + tree.nodes.remove(old_output_node) - if old_output: - output.location = old_output.location - tree.nodes.remove(old_output) output.name = "AYON File Output" output.label = "AYON File Output" From 14fc4ce6be35f02096ecc56cc865300ef67a705c Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Wed, 7 Feb 2024 17:51:52 +0800 Subject: [PATCH 16/58] Implementation of workfile creator --- .../max/plugins/create/create_workfile.py | 130 ++++++++++++++++++ .../max/plugins/publish/collect_members.py | 5 +- .../max/plugins/publish/collect_workfile.py | 14 +- 3 files changed, 140 insertions(+), 9 deletions(-) create mode 100644 openpype/hosts/max/plugins/create/create_workfile.py diff --git a/openpype/hosts/max/plugins/create/create_workfile.py b/openpype/hosts/max/plugins/create/create_workfile.py new file mode 100644 index 0000000000..b43a353136 --- /dev/null +++ b/openpype/hosts/max/plugins/create/create_workfile.py @@ -0,0 +1,130 @@ +# -*- coding: utf-8 -*- +"""Creator plugin for creating workfiles.""" +from openpype import AYON_SERVER_ENABLED +from openpype.pipeline import CreatedInstance, AutoCreator, CreatorError +from openpype.client import get_asset_by_name, get_asset_name_identifier +from openpype.hosts.max.api import plugin +from openpype.hosts.max.api.lib import read, imprint +from pymxs import runtime as rt + + +class CreateWorkfile(plugin.MaxCreatorBase, AutoCreator): + """Workfile auto-creator.""" + identifier = "io.openpype.creators.max.workfile" + label = "Workfile" + family = "workfile" + icon = "fa5.file" + + default_variant = "Main" + + def create(self): + variant = self.default_variant + current_instance = next( + ( + instance for instance in self.create_context.instances + if instance.creator_identifier == self.identifier + ), None) + project_name = self.project_name + asset_name = self.create_context.get_current_asset_name() + task_name = self.create_context.get_current_task_name() + host_name = self.create_context.host_name + + if current_instance is None: + current_instance_asset = None + elif AYON_SERVER_ENABLED: + current_instance_asset = current_instance["folderPath"] + else: + current_instance_asset = current_instance["asset"] + + if current_instance is None: + asset_doc = get_asset_by_name(project_name, asset_name) + data = { + "task": task_name, + "variant": variant + } + if AYON_SERVER_ENABLED: + data["folderPath"] = asset_name + else: + data["asset"] = asset_name + + data.update( + self.get_dynamic_data( + variant, task_name, asset_doc, + project_name, host_name, current_instance) + ) + subset_name = self.get_subset_name( + variant, task_name, asset_doc, project_name, host_name + ) + self.log.info("Auto-creating workfile instance...") + instance_node = self.create_node(subset_name) + data["instance_node"] = instance_node.name + current_instance = CreatedInstance( + self.family, subset_name, data, self + ) + self._add_instance_to_context(current_instance) + imprint(instance_node.name, current_instance.data) + elif ( + current_instance_asset != asset_name + or current_instance["task"] != task_name + ): + # Update instance context if is not the same + asset_doc = get_asset_by_name(project_name, asset_name) + subset_name = self.get_subset_name( + variant, task_name, asset_doc, project_name, host_name + ) + asset_name = get_asset_name_identifier(asset_doc) + + if AYON_SERVER_ENABLED: + current_instance["folderPath"] = asset_name + else: + current_instance["asset"] = asset_name + current_instance["task"] = task_name + current_instance["subset"] = subset_name + + def collect_instances(self): + self.cache_subsets(self.collection_shared_data) + for instance in self.collection_shared_data["max_cached_subsets"].get(self.identifier, []): # noqa + if not rt.getNodeByName(instance): + continue + created_instance = CreatedInstance.from_existing( + read(rt.GetNodeByName(instance)), self + ) + self._add_instance_to_context(created_instance) + + + def update_instances(self, update_list): + for created_inst, changes in update_list: + instance_node = created_inst.get("instance_node") + new_values = { + key: changes[key].new_value + for key in changes.changed_keys + } + + imprint( + instance_node, + created_inst.data_to_store() + ) + + def remove_instances(self, instances): + """Remove specified instance from the scene. + + This is only removing `id` parameter so instance is no longer + instance, because it might contain valuable data for artist. + + """ + for instance in instances: + instance_node = rt.GetNodeByName( + instance.data.get("instance_node")) + if instance_node: + rt.Delete(instance_node) + + self._remove_instance_from_context(instance) + + + def create_node(self, subset_name): + if rt.getNodeByName(subset_name): + node = rt.getNodeByName(subset_name) + return node + node = rt.Container(name=subset_name) + node.isHidden = True + return node diff --git a/openpype/hosts/max/plugins/publish/collect_members.py b/openpype/hosts/max/plugins/publish/collect_members.py index 2970cf0e24..7cd646e0e7 100644 --- a/openpype/hosts/max/plugins/publish/collect_members.py +++ b/openpype/hosts/max/plugins/publish/collect_members.py @@ -12,7 +12,10 @@ class CollectMembers(pyblish.api.InstancePlugin): hosts = ['max'] def process(self, instance): - + if instance.data["family"] == "workfile": + self.log.debug("Skipping Actions for workfile family.") + self.log.debug("{}".format(instance.data["subset"])) + return if instance.data.get("instance_node"): container = rt.GetNodeByName(instance.data["instance_node"]) instance.data["members"] = [ diff --git a/openpype/hosts/max/plugins/publish/collect_workfile.py b/openpype/hosts/max/plugins/publish/collect_workfile.py index 0eb4bb731e..446175c0ed 100644 --- a/openpype/hosts/max/plugins/publish/collect_workfile.py +++ b/openpype/hosts/max/plugins/publish/collect_workfile.py @@ -6,15 +6,16 @@ import pyblish.api from pymxs import runtime as rt -class CollectWorkfile(pyblish.api.ContextPlugin): +class CollectWorkfile(pyblish.api.InstancePlugin): """Inject the current working file into context""" order = pyblish.api.CollectorOrder - 0.01 label = "Collect 3dsmax Workfile" hosts = ['max'] - def process(self, context): + def process(self, instance): """Inject the current working file.""" + context = instance.context folder = rt.maxFilePath file = rt.maxFileName if not folder or not file: @@ -23,15 +24,12 @@ class CollectWorkfile(pyblish.api.ContextPlugin): context.data['currentFile'] = current_file - filename, ext = os.path.splitext(file) - - task = context.data["task"] + ext = os.path.splitext(file)[-1].lstrip(".") data = {} # create instance - instance = context.create_instance(name=filename) - subset = 'workfile' + task.capitalize() + subset = instance.data["subset"] data.update({ "subset": subset, @@ -55,7 +53,7 @@ class CollectWorkfile(pyblish.api.ContextPlugin): }] instance.data.update(data) - + self.log.info('Collected data: {}'.format(data)) self.log.info('Collected instance: {}'.format(file)) self.log.info('Scene path: {}'.format(current_file)) self.log.info('staging Dir: {}'.format(folder)) From 8bac54fcf0745645489a29fc2e78bac1d9d4c284 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Wed, 7 Feb 2024 17:54:39 +0800 Subject: [PATCH 17/58] move back the subset name before dynamic data --- openpype/hosts/max/plugins/create/create_workfile.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openpype/hosts/max/plugins/create/create_workfile.py b/openpype/hosts/max/plugins/create/create_workfile.py index b43a353136..70944b3e2c 100644 --- a/openpype/hosts/max/plugins/create/create_workfile.py +++ b/openpype/hosts/max/plugins/create/create_workfile.py @@ -38,6 +38,9 @@ class CreateWorkfile(plugin.MaxCreatorBase, AutoCreator): if current_instance is None: asset_doc = get_asset_by_name(project_name, asset_name) + subset_name = self.get_subset_name( + variant, task_name, asset_doc, project_name, host_name + ) data = { "task": task_name, "variant": variant @@ -52,9 +55,6 @@ class CreateWorkfile(plugin.MaxCreatorBase, AutoCreator): variant, task_name, asset_doc, project_name, host_name, current_instance) ) - subset_name = self.get_subset_name( - variant, task_name, asset_doc, project_name, host_name - ) self.log.info("Auto-creating workfile instance...") instance_node = self.create_node(subset_name) data["instance_node"] = instance_node.name From af022f3561ac96b3d891b52238219ddd913d5f5c Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Wed, 7 Feb 2024 17:59:20 +0800 Subject: [PATCH 18/58] hound shut --- openpype/hosts/max/plugins/create/create_workfile.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/openpype/hosts/max/plugins/create/create_workfile.py b/openpype/hosts/max/plugins/create/create_workfile.py index 70944b3e2c..25213871d8 100644 --- a/openpype/hosts/max/plugins/create/create_workfile.py +++ b/openpype/hosts/max/plugins/create/create_workfile.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Creator plugin for creating workfiles.""" from openpype import AYON_SERVER_ENABLED -from openpype.pipeline import CreatedInstance, AutoCreator, CreatorError +from openpype.pipeline import CreatedInstance, AutoCreator from openpype.client import get_asset_by_name, get_asset_name_identifier from openpype.hosts.max.api import plugin from openpype.hosts.max.api.lib import read, imprint @@ -91,15 +91,9 @@ class CreateWorkfile(plugin.MaxCreatorBase, AutoCreator): ) self._add_instance_to_context(created_instance) - def update_instances(self, update_list): for created_inst, changes in update_list: instance_node = created_inst.get("instance_node") - new_values = { - key: changes[key].new_value - for key in changes.changed_keys - } - imprint( instance_node, created_inst.data_to_store() @@ -120,7 +114,6 @@ class CreateWorkfile(plugin.MaxCreatorBase, AutoCreator): self._remove_instance_from_context(instance) - def create_node(self, subset_name): if rt.getNodeByName(subset_name): node = rt.getNodeByName(subset_name) From 2248240306fdf01dc2f756982b11304c48304cc5 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Wed, 7 Feb 2024 18:00:08 +0800 Subject: [PATCH 19/58] hound shut --- openpype/hosts/max/plugins/create/create_workfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/hosts/max/plugins/create/create_workfile.py b/openpype/hosts/max/plugins/create/create_workfile.py index 25213871d8..4ec3c6d3ad 100644 --- a/openpype/hosts/max/plugins/create/create_workfile.py +++ b/openpype/hosts/max/plugins/create/create_workfile.py @@ -92,7 +92,7 @@ class CreateWorkfile(plugin.MaxCreatorBase, AutoCreator): self._add_instance_to_context(created_instance) def update_instances(self, update_list): - for created_inst, changes in update_list: + for created_inst, _ in update_list: instance_node = created_inst.get("instance_node") imprint( instance_node, From bd8135f4dcea13240c8a894b9f70472b7a535851 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Wed, 7 Feb 2024 18:01:15 +0800 Subject: [PATCH 20/58] hound shut --- openpype/hosts/max/plugins/create/create_workfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openpype/hosts/max/plugins/create/create_workfile.py b/openpype/hosts/max/plugins/create/create_workfile.py index 4ec3c6d3ad..30692ccd06 100644 --- a/openpype/hosts/max/plugins/create/create_workfile.py +++ b/openpype/hosts/max/plugins/create/create_workfile.py @@ -93,7 +93,7 @@ class CreateWorkfile(plugin.MaxCreatorBase, AutoCreator): def update_instances(self, update_list): for created_inst, _ in update_list: - instance_node = created_inst.get("instance_node") + instance_node = created_inst.get("instance_node") imprint( instance_node, created_inst.data_to_store() From 27512a06a121f76f8c7d0705ee317b11a062032a Mon Sep 17 00:00:00 2001 From: Simone Barbieri Date: Mon, 12 Feb 2024 15:34:21 +0000 Subject: [PATCH 21/58] Removed references to `AYON_SERVER_ENABLED` --- client/ayon_core/hosts/blender/api/render_lib.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/client/ayon_core/hosts/blender/api/render_lib.py b/client/ayon_core/hosts/blender/api/render_lib.py index 9b43c14568..e1d0e2ae67 100644 --- a/client/ayon_core/hosts/blender/api/render_lib.py +++ b/client/ayon_core/hosts/blender/api/render_lib.py @@ -2,7 +2,6 @@ from pathlib import Path import bpy -from ayon_core import AYON_SERVER_ENABLED from ayon_core.settings import get_project_settings from ayon_core.pipeline import get_current_project_name @@ -166,14 +165,13 @@ def set_render_passes(settings, renderer): aovs_names = [aov.name for aov in vl.aovs] for cp in custom_passes: - cp_name = cp["attribute"] if AYON_SERVER_ENABLED else cp[0] + cp_name = cp["attribute"] if cp_name not in aovs_names: aov = vl.aovs.add() aov.name = cp_name else: aov = vl.aovs[cp_name] - aov.type = (cp["value"] - if AYON_SERVER_ENABLED else cp[1].get("type", "VALUE")) + aov.type = cp["value"] return aov_list, custom_passes From a0b18c91cd06ba18adb102f211ed4e7e30e00042 Mon Sep 17 00:00:00 2001 From: Simone Barbieri Date: Mon, 12 Feb 2024 15:39:40 +0000 Subject: [PATCH 22/58] Cast aov_list to set to improve performance --- client/ayon_core/hosts/blender/api/render_lib.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/ayon_core/hosts/blender/api/render_lib.py b/client/ayon_core/hosts/blender/api/render_lib.py index e1d0e2ae67..73d327b1a8 100644 --- a/client/ayon_core/hosts/blender/api/render_lib.py +++ b/client/ayon_core/hosts/blender/api/render_lib.py @@ -100,7 +100,7 @@ def set_render_format(ext, multilayer): def set_render_passes(settings, renderer): - aov_list = settings["blender"]["RenderSettings"]["aov_list"] + aov_list = set(settings["blender"]["RenderSettings"]["aov_list"]) custom_passes = settings["blender"]["RenderSettings"]["custom_passes"] # Common passes for both renderers @@ -173,7 +173,7 @@ def set_render_passes(settings, renderer): aov = vl.aovs[cp_name] aov.type = cp["value"] - return aov_list, custom_passes + return list(aov_list), custom_passes def _create_aov_slot(name, aov_sep, slots, rpass_name, multi_exr, output_path): From 97e4a3f93edd1af0f612c5f17b408c9abb2e6006 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Tue, 13 Feb 2024 19:21:25 +0800 Subject: [PATCH 23/58] clean up the unneccessary logs and code in collect members and collect workfiles --- .../max/plugins/create/create_workfile.py | 18 +++++------------ .../max/plugins/publish/collect_members.py | 3 +-- .../max/plugins/publish/collect_workfile.py | 20 ++++++------------- 3 files changed, 12 insertions(+), 29 deletions(-) diff --git a/client/ayon_core/hosts/max/plugins/create/create_workfile.py b/client/ayon_core/hosts/max/plugins/create/create_workfile.py index 5b51391749..e5fec5f437 100644 --- a/client/ayon_core/hosts/max/plugins/create/create_workfile.py +++ b/client/ayon_core/hosts/max/plugins/create/create_workfile.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- """Creator plugin for creating workfiles.""" -from ayon_core import AYON_SERVER_ENABLED from ayon_core.pipeline import CreatedInstance, AutoCreator from ayon_core.client import get_asset_by_name, get_asset_name_identifier from ayon_core.hosts.max.api import plugin @@ -31,10 +30,8 @@ class CreateWorkfile(plugin.MaxCreatorBase, AutoCreator): if current_instance is None: current_instance_asset = None - elif AYON_SERVER_ENABLED: - current_instance_asset = current_instance["folderPath"] - else: - current_instance_asset = current_instance["asset"] + + current_instance_asset = current_instance["folderPath"] if current_instance is None: asset_doc = get_asset_by_name(project_name, asset_name) @@ -45,10 +42,8 @@ class CreateWorkfile(plugin.MaxCreatorBase, AutoCreator): "task": task_name, "variant": variant } - if AYON_SERVER_ENABLED: - data["folderPath"] = asset_name - else: - data["asset"] = asset_name + + data["folderPath"] = asset_name data.update( self.get_dynamic_data( @@ -74,10 +69,7 @@ class CreateWorkfile(plugin.MaxCreatorBase, AutoCreator): ) asset_name = get_asset_name_identifier(asset_doc) - if AYON_SERVER_ENABLED: - current_instance["folderPath"] = asset_name - else: - current_instance["asset"] = asset_name + current_instance["folderPath"] = asset_name current_instance["task"] = task_name current_instance["subset"] = subset_name diff --git a/client/ayon_core/hosts/max/plugins/publish/collect_members.py b/client/ayon_core/hosts/max/plugins/publish/collect_members.py index 7cd646e0e7..f3fde00fe0 100644 --- a/client/ayon_core/hosts/max/plugins/publish/collect_members.py +++ b/client/ayon_core/hosts/max/plugins/publish/collect_members.py @@ -13,8 +13,7 @@ class CollectMembers(pyblish.api.InstancePlugin): def process(self, instance): if instance.data["family"] == "workfile": - self.log.debug("Skipping Actions for workfile family.") - self.log.debug("{}".format(instance.data["subset"])) + self.log.debug("Skipping Collecting Members for workfile family.") return if instance.data.get("instance_node"): container = rt.GetNodeByName(instance.data["instance_node"]) diff --git a/client/ayon_core/hosts/max/plugins/publish/collect_workfile.py b/client/ayon_core/hosts/max/plugins/publish/collect_workfile.py index 446175c0ed..4dbaf28bf7 100644 --- a/client/ayon_core/hosts/max/plugins/publish/collect_workfile.py +++ b/client/ayon_core/hosts/max/plugins/publish/collect_workfile.py @@ -29,15 +29,8 @@ class CollectWorkfile(pyblish.api.InstancePlugin): data = {} # create instance - subset = instance.data["subset"] data.update({ - "subset": subset, - "asset": context.data["asset"], - "label": subset, - "publish": True, - "family": 'workfile', - "families": ['workfile'], "setMembers": [current_file], "frameStart": context.data['frameStart'], "frameEnd": context.data['frameEnd'], @@ -46,15 +39,14 @@ class CollectWorkfile(pyblish.api.InstancePlugin): }) data['representations'] = [{ - 'name': ext.lstrip("."), - 'ext': ext.lstrip("."), + 'name': ext, + 'ext': ext, 'files': file, "stagingDir": folder, }] instance.data.update(data) - self.log.info('Collected data: {}'.format(data)) - self.log.info('Collected instance: {}'.format(file)) - self.log.info('Scene path: {}'.format(current_file)) - self.log.info('staging Dir: {}'.format(folder)) - self.log.info('subset: {}'.format(subset)) + self.log.debug('Collected data: {}'.format(data)) + self.log.debug('Collected instance: {}'.format(file)) + self.log.debug('Scene path: {}'.format(current_file)) + self.log.debug('staging Dir: {}'.format(folder)) From 66cb5336d354b501f7c467854d74e37ec9faffcc Mon Sep 17 00:00:00 2001 From: Simone Barbieri Date: Tue, 13 Feb 2024 18:03:44 +0000 Subject: [PATCH 24/58] Added an option to disable composite output --- .../ayon_core/hosts/blender/api/render_lib.py | 29 ++++++++++++++----- .../server/settings/render_settings.py | 4 +++ 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/client/ayon_core/hosts/blender/api/render_lib.py b/client/ayon_core/hosts/blender/api/render_lib.py index 73d327b1a8..91913f7913 100644 --- a/client/ayon_core/hosts/blender/api/render_lib.py +++ b/client/ayon_core/hosts/blender/api/render_lib.py @@ -55,6 +55,14 @@ def get_renderer(settings): ["renderer"]) +def get_compositing(settings): + """Get compositing from blender settings.""" + + return (settings["blender"] + ["RenderSettings"] + ["compositing"]) + + def get_render_product(output_path, name, aov_sep): """ Generate the path to the render product. Blender interprets the `#` @@ -184,7 +192,9 @@ def _create_aov_slot(name, aov_sep, slots, rpass_name, multi_exr, output_path): return slot, filepath -def set_node_tree(output_path, render_product, name, aov_sep, ext, multilayer): +def set_node_tree( + output_path, render_product, name, aov_sep, ext, multilayer, compositing +): # Set the scene to use the compositor node tree to render bpy.context.scene.use_nodes = True @@ -250,11 +260,12 @@ def set_node_tree(output_path, render_product, name, aov_sep, ext, multilayer): name, aov_sep, slots, pass_name, multi_exr, output_path) tree.links.new(render_layer_node.outputs["Image"], slot) - # Create a new socket for the composite output - pass_name = "composite" - comp_socket, filepath = _create_aov_slot( - name, aov_sep, slots, pass_name, multi_exr, output_path) - aov_file_products.append(("Composite", filepath)) + if compositing: + # Create a new socket for the composite output + pass_name = "composite" + comp_socket, filepath = _create_aov_slot( + name, aov_sep, slots, pass_name, multi_exr, output_path) + aov_file_products.append(("Composite", filepath)) # For each active render pass, we add a new socket to the output node # and link it @@ -278,7 +289,7 @@ def set_node_tree(output_path, render_product, name, aov_sep, ext, multilayer): tree.links.remove(link) # If there's a composite node, we connect its input with the new output - if composite_node: + if compositing and composite_node: for link in tree.links: if link.to_node == composite_node: tree.links.new(link.from_socket, comp_socket) @@ -321,6 +332,7 @@ def prepare_rendering(asset_group): ext = get_image_format(settings) multilayer = get_multilayer(settings) renderer = get_renderer(settings) + compositing = get_compositing(settings) set_render_format(ext, multilayer) bpy.context.scene.render.engine = renderer @@ -330,7 +342,8 @@ def prepare_rendering(asset_group): render_product = get_render_product(output_path, name, aov_sep) aov_file_product = set_node_tree( - output_path, render_product, name, aov_sep, ext, multilayer) + output_path, render_product, name, aov_sep, + ext, multilayer, compositing) # Clear the render filepath, so that the output is handled only by the # output node in the compositor. diff --git a/server_addon/blender/server/settings/render_settings.py b/server_addon/blender/server/settings/render_settings.py index a1f6d3114a..f992ea6fcc 100644 --- a/server_addon/blender/server/settings/render_settings.py +++ b/server_addon/blender/server/settings/render_settings.py @@ -127,6 +127,9 @@ class RenderSettingsModel(BaseSettingsModel): title="Renderer", enum_resolver=renderers_enum ) + compositing: bool = SettingsField( + title="Enable Compositing" + ) aov_list: list[str] = SettingsField( default_factory=list, enum_resolver=aov_list_enum, @@ -149,6 +152,7 @@ DEFAULT_RENDER_SETTINGS = { "image_format": "exr", "multilayer_exr": True, "renderer": "CYCLES", + "compositing": True, "aov_list": ["combined"], "custom_passes": [] } From f0eaf0c128b78fd8977c3eae60921b6290d947bd Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Wed, 14 Feb 2024 15:19:56 +0800 Subject: [PATCH 25/58] code tweaks on workfile creators to make sure there is no error out --- .../ayon_core/hosts/max/plugins/create/create_workfile.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/client/ayon_core/hosts/max/plugins/create/create_workfile.py b/client/ayon_core/hosts/max/plugins/create/create_workfile.py index e5fec5f437..cb47a36678 100644 --- a/client/ayon_core/hosts/max/plugins/create/create_workfile.py +++ b/client/ayon_core/hosts/max/plugins/create/create_workfile.py @@ -30,8 +30,8 @@ class CreateWorkfile(plugin.MaxCreatorBase, AutoCreator): if current_instance is None: current_instance_asset = None - - current_instance_asset = current_instance["folderPath"] + else: + current_instance_asset = current_instance["folderPath"] if current_instance is None: asset_doc = get_asset_by_name(project_name, asset_name) @@ -39,12 +39,11 @@ class CreateWorkfile(plugin.MaxCreatorBase, AutoCreator): variant, task_name, asset_doc, project_name, host_name ) data = { + "folderPath": asset_name, "task": task_name, "variant": variant } - data["folderPath"] = asset_name - data.update( self.get_dynamic_data( variant, task_name, asset_doc, From c9ddd6c9a270545d556fab4d391819c493c03666 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Wed, 14 Feb 2024 17:06:41 +0800 Subject: [PATCH 26/58] clean up the code for current_instance['folderPath'] --- .../ayon_core/hosts/maya/plugins/create/create_workfile.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/client/ayon_core/hosts/maya/plugins/create/create_workfile.py b/client/ayon_core/hosts/maya/plugins/create/create_workfile.py index 396ad6ffbb..dee574018f 100644 --- a/client/ayon_core/hosts/maya/plugins/create/create_workfile.py +++ b/client/ayon_core/hosts/maya/plugins/create/create_workfile.py @@ -29,11 +29,6 @@ class CreateWorkfile(plugin.MayaCreatorBase, AutoCreator): task_name = self.create_context.get_current_task_name() host_name = self.create_context.host_name - if current_instance is None: - current_instance_asset = None - else: - current_instance_asset = current_instance["folderPath"] - if current_instance is None: asset_doc = get_asset_by_name(project_name, asset_name) subset_name = self.get_subset_name( @@ -55,7 +50,7 @@ class CreateWorkfile(plugin.MayaCreatorBase, AutoCreator): ) self._add_instance_to_context(current_instance) elif ( - current_instance_asset != asset_name + current_instance["folderPath"] != asset_name or current_instance["task"] != task_name ): # Update instance context if is not the same From 9615a02aace1ad2aa6433c4172d6b42bb1f75746 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Wed, 14 Feb 2024 17:10:27 +0800 Subject: [PATCH 27/58] clean up the code of current_instance['folderPath'] --- .../ayon_core/hosts/max/plugins/create/create_workfile.py | 7 +------ .../ayon_core/hosts/maya/plugins/create/create_workfile.py | 7 ++++++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/client/ayon_core/hosts/max/plugins/create/create_workfile.py b/client/ayon_core/hosts/max/plugins/create/create_workfile.py index cb47a36678..ce4d8b976d 100644 --- a/client/ayon_core/hosts/max/plugins/create/create_workfile.py +++ b/client/ayon_core/hosts/max/plugins/create/create_workfile.py @@ -28,11 +28,6 @@ class CreateWorkfile(plugin.MaxCreatorBase, AutoCreator): task_name = self.create_context.get_current_task_name() host_name = self.create_context.host_name - if current_instance is None: - current_instance_asset = None - else: - current_instance_asset = current_instance["folderPath"] - if current_instance is None: asset_doc = get_asset_by_name(project_name, asset_name) subset_name = self.get_subset_name( @@ -58,7 +53,7 @@ class CreateWorkfile(plugin.MaxCreatorBase, AutoCreator): self._add_instance_to_context(current_instance) imprint(instance_node.name, current_instance.data) elif ( - current_instance_asset != asset_name + current_instance["folderPath"] != asset_name or current_instance["task"] != task_name ): # Update instance context if is not the same diff --git a/client/ayon_core/hosts/maya/plugins/create/create_workfile.py b/client/ayon_core/hosts/maya/plugins/create/create_workfile.py index dee574018f..396ad6ffbb 100644 --- a/client/ayon_core/hosts/maya/plugins/create/create_workfile.py +++ b/client/ayon_core/hosts/maya/plugins/create/create_workfile.py @@ -29,6 +29,11 @@ class CreateWorkfile(plugin.MayaCreatorBase, AutoCreator): task_name = self.create_context.get_current_task_name() host_name = self.create_context.host_name + if current_instance is None: + current_instance_asset = None + else: + current_instance_asset = current_instance["folderPath"] + if current_instance is None: asset_doc = get_asset_by_name(project_name, asset_name) subset_name = self.get_subset_name( @@ -50,7 +55,7 @@ class CreateWorkfile(plugin.MayaCreatorBase, AutoCreator): ) self._add_instance_to_context(current_instance) elif ( - current_instance["folderPath"] != asset_name + current_instance_asset != asset_name or current_instance["task"] != task_name ): # Update instance context if is not the same From ecd69f0a511890e6356769e092ca4143c4c862f6 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Wed, 14 Feb 2024 17:58:10 +0800 Subject: [PATCH 28/58] Separating collect current files from the collect workfile --- .../plugins/publish/collect_current_file.py | 22 ++++++++++++ .../max/plugins/publish/collect_workfile.py | 34 ++++++++----------- 2 files changed, 37 insertions(+), 19 deletions(-) create mode 100644 client/ayon_core/hosts/max/plugins/publish/collect_current_file.py diff --git a/client/ayon_core/hosts/max/plugins/publish/collect_current_file.py b/client/ayon_core/hosts/max/plugins/publish/collect_current_file.py new file mode 100644 index 0000000000..b10f3d51bc --- /dev/null +++ b/client/ayon_core/hosts/max/plugins/publish/collect_current_file.py @@ -0,0 +1,22 @@ +import os +import pyblish.api + +from pymxs import runtime as rt + + +class CollectCurrentFile(pyblish.api.ContextPlugin): + """Inject the current working file.""" + + order = pyblish.api.CollectorOrder - 0.4 + label = "Max Current File" + hosts = ['max'] + + def process(self, context): + """Inject the current working file""" + folder = rt.maxFilePath + file = rt.maxFileName + if not folder or not file: + self.log.error("Scene is not saved.") + current_file = os.path.join(folder, file) + + context.data["currentFile"] = current_file diff --git a/client/ayon_core/hosts/max/plugins/publish/collect_workfile.py b/client/ayon_core/hosts/max/plugins/publish/collect_workfile.py index 4dbaf28bf7..775e22ff0e 100644 --- a/client/ayon_core/hosts/max/plugins/publish/collect_workfile.py +++ b/client/ayon_core/hosts/max/plugins/publish/collect_workfile.py @@ -12,6 +12,7 @@ class CollectWorkfile(pyblish.api.InstancePlugin): order = pyblish.api.CollectorOrder - 0.01 label = "Collect 3dsmax Workfile" hosts = ['max'] + families = ["workfile"] def process(self, instance): """Inject the current working file.""" @@ -20,33 +21,28 @@ class CollectWorkfile(pyblish.api.InstancePlugin): file = rt.maxFileName if not folder or not file: self.log.error("Scene is not saved.") - current_file = os.path.join(folder, file) - - context.data['currentFile'] = current_file - ext = os.path.splitext(file)[-1].lstrip(".") data = {} - # create instance - data.update({ - "setMembers": [current_file], - "frameStart": context.data['frameStart'], - "frameEnd": context.data['frameEnd'], - "handleStart": context.data['handleStart'], - "handleEnd": context.data['handleEnd'] + "setMembers": context.data["currentFile"], + "frameStart": context.data["frameStart"], + "frameEnd": context.data["frameEnd"], + "handleStart": context.data["handleStart"], + "handleEnd": context.data["handleEnd"] }) - data['representations'] = [{ - 'name': ext, - 'ext': ext, - 'files': file, + data["representations"] = [{ + "name": ext, + "ext": ext, + "files": file, "stagingDir": folder, }] instance.data.update(data) - self.log.debug('Collected data: {}'.format(data)) - self.log.debug('Collected instance: {}'.format(file)) - self.log.debug('Scene path: {}'.format(current_file)) - self.log.debug('staging Dir: {}'.format(folder)) + self.log.debug("Collected data: {}".format(data)) + self.log.debug("Collected instance: {}".format(file)) + self.log.debug("Scene path: {}".format( + context.data["currentFile"])) + self.log.debug("staging Dir: {}".format(folder)) From 4be12c71efe3dcb65e4e8887eeaf1a775f73014d Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Wed, 14 Feb 2024 19:47:05 +0800 Subject: [PATCH 29/58] move debug msg of scene path into colelct current file --- .../ayon_core/hosts/max/plugins/publish/collect_current_file.py | 1 + client/ayon_core/hosts/max/plugins/publish/collect_workfile.py | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/client/ayon_core/hosts/max/plugins/publish/collect_current_file.py b/client/ayon_core/hosts/max/plugins/publish/collect_current_file.py index b10f3d51bc..689a357c53 100644 --- a/client/ayon_core/hosts/max/plugins/publish/collect_current_file.py +++ b/client/ayon_core/hosts/max/plugins/publish/collect_current_file.py @@ -20,3 +20,4 @@ class CollectCurrentFile(pyblish.api.ContextPlugin): current_file = os.path.join(folder, file) context.data["currentFile"] = current_file + self.log.debug("Scene path: {}".format(current_file)) diff --git a/client/ayon_core/hosts/max/plugins/publish/collect_workfile.py b/client/ayon_core/hosts/max/plugins/publish/collect_workfile.py index 775e22ff0e..6eec0f7292 100644 --- a/client/ayon_core/hosts/max/plugins/publish/collect_workfile.py +++ b/client/ayon_core/hosts/max/plugins/publish/collect_workfile.py @@ -43,6 +43,4 @@ class CollectWorkfile(pyblish.api.InstancePlugin): instance.data.update(data) self.log.debug("Collected data: {}".format(data)) self.log.debug("Collected instance: {}".format(file)) - self.log.debug("Scene path: {}".format( - context.data["currentFile"])) self.log.debug("staging Dir: {}".format(folder)) From 1d72cd102356bb5d0b4ae0f8555dec46433311cd Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Thu, 15 Feb 2024 16:47:05 +0800 Subject: [PATCH 30/58] bug fix remove items not working in scene inventory manager --- client/ayon_core/hosts/max/api/pipeline.py | 17 +++++++++++++++++ .../hosts/max/plugins/load/load_camera_fbx.py | 8 ++++---- .../hosts/max/plugins/load/load_max_scene.py | 9 +++++---- .../hosts/max/plugins/load/load_model.py | 8 +++++--- .../hosts/max/plugins/load/load_model_fbx.py | 9 +++++---- .../hosts/max/plugins/load/load_model_obj.py | 6 +++--- .../hosts/max/plugins/load/load_model_usd.py | 5 +++-- .../hosts/max/plugins/load/load_pointcache.py | 5 +++-- .../plugins/load/load_pointcache_ornatrix.py | 5 +++-- .../hosts/max/plugins/load/load_pointcloud.py | 6 +++--- .../max/plugins/load/load_redshift_proxy.py | 6 +++--- .../hosts/max/plugins/load/load_tycache.py | 9 ++++----- 12 files changed, 58 insertions(+), 35 deletions(-) diff --git a/client/ayon_core/hosts/max/api/pipeline.py b/client/ayon_core/hosts/max/api/pipeline.py index c26e697429..106c29fd26 100644 --- a/client/ayon_core/hosts/max/api/pipeline.py +++ b/client/ayon_core/hosts/max/api/pipeline.py @@ -242,3 +242,20 @@ def get_previous_loaded_object(container: str): if str(obj) in sel_list: node_list.append(obj) return node_list + + +def remove_container_data(container: str): + """Function to remove container data after updating, switching or deleting it. + + Args: + container (str): container + """ + if container.modifiers[0].name == "OP Data": + all_set_members_names = [ + member.node for member + in container.modifiers[0].openPypeData.all_handles] + for current_set_member in all_set_members_names: + rt.Delete(current_set_member) + rt.deleteModifier(container, container.modifiers[0]) + + rt.Delete(container) diff --git a/client/ayon_core/hosts/max/plugins/load/load_camera_fbx.py b/client/ayon_core/hosts/max/plugins/load/load_camera_fbx.py index 34b120c179..d7eebdbc3a 100644 --- a/client/ayon_core/hosts/max/plugins/load/load_camera_fbx.py +++ b/client/ayon_core/hosts/max/plugins/load/load_camera_fbx.py @@ -1,6 +1,6 @@ import os -from ayon_core.hosts.max.api import lib, maintained_selection +from ayon_core.hosts.max.api import lib from ayon_core.hosts.max.api.lib import ( unique_namespace, get_namespace, @@ -9,7 +9,8 @@ from ayon_core.hosts.max.api.lib import ( from ayon_core.hosts.max.api.pipeline import ( containerise, get_previous_loaded_object, - update_custom_attribute_data + update_custom_attribute_data, + remove_container_data ) from ayon_core.pipeline import get_representation_path, load @@ -94,6 +95,5 @@ class FbxLoader(load.LoaderPlugin): def remove(self, container): from pymxs import runtime as rt - node = rt.GetNodeByName(container["instance_node"]) - rt.Delete(node) + remove_container_data(node) diff --git a/client/ayon_core/hosts/max/plugins/load/load_max_scene.py b/client/ayon_core/hosts/max/plugins/load/load_max_scene.py index 7267d7a59e..81f3af089f 100644 --- a/client/ayon_core/hosts/max/plugins/load/load_max_scene.py +++ b/client/ayon_core/hosts/max/plugins/load/load_max_scene.py @@ -7,8 +7,10 @@ from ayon_core.hosts.max.api.lib import ( object_transform_set ) from ayon_core.hosts.max.api.pipeline import ( - containerise, get_previous_loaded_object, - update_custom_attribute_data + containerise, + get_previous_loaded_object, + update_custom_attribute_data, + remove_container_data ) from ayon_core.pipeline import get_representation_path, load @@ -93,6 +95,5 @@ class MaxSceneLoader(load.LoaderPlugin): def remove(self, container): from pymxs import runtime as rt - node = rt.GetNodeByName(container["instance_node"]) - rt.Delete(node) + remove_container_data(node) diff --git a/client/ayon_core/hosts/max/plugins/load/load_model.py b/client/ayon_core/hosts/max/plugins/load/load_model.py index 796e1b80ad..28ec7be01f 100644 --- a/client/ayon_core/hosts/max/plugins/load/load_model.py +++ b/client/ayon_core/hosts/max/plugins/load/load_model.py @@ -2,11 +2,13 @@ import os from ayon_core.pipeline import load, get_representation_path from ayon_core.hosts.max.api.pipeline import ( containerise, - get_previous_loaded_object + get_previous_loaded_object, + remove_container_data ) from ayon_core.hosts.max.api import lib from ayon_core.hosts.max.api.lib import ( - maintained_selection, unique_namespace + maintained_selection, + unique_namespace ) @@ -99,7 +101,7 @@ class ModelAbcLoader(load.LoaderPlugin): from pymxs import runtime as rt node = rt.GetNodeByName(container["instance_node"]) - rt.Delete(node) + remove_container_data(node) @staticmethod def get_container_children(parent, type_name): diff --git a/client/ayon_core/hosts/max/plugins/load/load_model_fbx.py b/client/ayon_core/hosts/max/plugins/load/load_model_fbx.py index 827cf63b39..81ad84546a 100644 --- a/client/ayon_core/hosts/max/plugins/load/load_model_fbx.py +++ b/client/ayon_core/hosts/max/plugins/load/load_model_fbx.py @@ -1,8 +1,10 @@ import os from ayon_core.pipeline import load, get_representation_path from ayon_core.hosts.max.api.pipeline import ( - containerise, get_previous_loaded_object, - update_custom_attribute_data + containerise, + get_previous_loaded_object, + update_custom_attribute_data, + remove_container_data ) from ayon_core.hosts.max.api import lib from ayon_core.hosts.max.api.lib import ( @@ -92,6 +94,5 @@ class FbxModelLoader(load.LoaderPlugin): def remove(self, container): from pymxs import runtime as rt - node = rt.GetNodeByName(container["instance_node"]) - rt.Delete(node) + remove_container_data(node) diff --git a/client/ayon_core/hosts/max/plugins/load/load_model_obj.py b/client/ayon_core/hosts/max/plugins/load/load_model_obj.py index 22d3d4b58a..1023b67f0c 100644 --- a/client/ayon_core/hosts/max/plugins/load/load_model_obj.py +++ b/client/ayon_core/hosts/max/plugins/load/load_model_obj.py @@ -11,7 +11,8 @@ from ayon_core.hosts.max.api.lib import maintained_selection from ayon_core.hosts.max.api.pipeline import ( containerise, get_previous_loaded_object, - update_custom_attribute_data + update_custom_attribute_data, + remove_container_data ) from ayon_core.pipeline import get_representation_path, load @@ -84,6 +85,5 @@ class ObjLoader(load.LoaderPlugin): def remove(self, container): from pymxs import runtime as rt - node = rt.GetNodeByName(container["instance_node"]) - rt.Delete(node) + remove_container_data(node) diff --git a/client/ayon_core/hosts/max/plugins/load/load_model_usd.py b/client/ayon_core/hosts/max/plugins/load/load_model_usd.py index 8d42219217..6a08bebf5a 100644 --- a/client/ayon_core/hosts/max/plugins/load/load_model_usd.py +++ b/client/ayon_core/hosts/max/plugins/load/load_model_usd.py @@ -13,7 +13,8 @@ from ayon_core.hosts.max.api.lib import maintained_selection from ayon_core.hosts.max.api.pipeline import ( containerise, get_previous_loaded_object, - update_custom_attribute_data + update_custom_attribute_data, + remove_container_data ) from ayon_core.pipeline import get_representation_path, load @@ -114,4 +115,4 @@ class ModelUSDLoader(load.LoaderPlugin): def remove(self, container): node = rt.GetNodeByName(container["instance_node"]) - rt.Delete(node) + remove_container_data(node) diff --git a/client/ayon_core/hosts/max/plugins/load/load_pointcache.py b/client/ayon_core/hosts/max/plugins/load/load_pointcache.py index a92fa66757..d7267afb7d 100644 --- a/client/ayon_core/hosts/max/plugins/load/load_pointcache.py +++ b/client/ayon_core/hosts/max/plugins/load/load_pointcache.py @@ -10,7 +10,8 @@ from ayon_core.hosts.max.api import lib, maintained_selection from ayon_core.hosts.max.api.lib import unique_namespace from ayon_core.hosts.max.api.pipeline import ( containerise, - get_previous_loaded_object + get_previous_loaded_object, + remove_container_data ) @@ -105,7 +106,7 @@ class AbcLoader(load.LoaderPlugin): from pymxs import runtime as rt node = rt.GetNodeByName(container["instance_node"]) - rt.Delete(node) + remove_container_data(node) @staticmethod def get_container_children(parent, type_name): diff --git a/client/ayon_core/hosts/max/plugins/load/load_pointcache_ornatrix.py b/client/ayon_core/hosts/max/plugins/load/load_pointcache_ornatrix.py index 27b2e271d2..5b48e5d189 100644 --- a/client/ayon_core/hosts/max/plugins/load/load_pointcache_ornatrix.py +++ b/client/ayon_core/hosts/max/plugins/load/load_pointcache_ornatrix.py @@ -4,7 +4,8 @@ from ayon_core.pipeline.load import LoadError from ayon_core.hosts.max.api.pipeline import ( containerise, get_previous_loaded_object, - update_custom_attribute_data + update_custom_attribute_data, + remove_container_data ) from ayon_core.hosts.max.api.lib import ( @@ -105,4 +106,4 @@ class OxAbcLoader(load.LoaderPlugin): def remove(self, container): node = rt.GetNodeByName(container["instance_node"]) - rt.Delete(node) + remove_container_data(node) \ No newline at end of file diff --git a/client/ayon_core/hosts/max/plugins/load/load_pointcloud.py b/client/ayon_core/hosts/max/plugins/load/load_pointcloud.py index 45e3da5621..7f4fba50b3 100644 --- a/client/ayon_core/hosts/max/plugins/load/load_pointcloud.py +++ b/client/ayon_core/hosts/max/plugins/load/load_pointcloud.py @@ -8,7 +8,8 @@ from ayon_core.hosts.max.api.lib import ( from ayon_core.hosts.max.api.pipeline import ( containerise, get_previous_loaded_object, - update_custom_attribute_data + update_custom_attribute_data, + remove_container_data ) from ayon_core.pipeline import get_representation_path, load @@ -63,6 +64,5 @@ class PointCloudLoader(load.LoaderPlugin): def remove(self, container): """remove the container""" from pymxs import runtime as rt - node = rt.GetNodeByName(container["instance_node"]) - rt.Delete(node) + remove_container_data(node) diff --git a/client/ayon_core/hosts/max/plugins/load/load_redshift_proxy.py b/client/ayon_core/hosts/max/plugins/load/load_redshift_proxy.py index 3f73210c24..3ccc5cc5e1 100644 --- a/client/ayon_core/hosts/max/plugins/load/load_redshift_proxy.py +++ b/client/ayon_core/hosts/max/plugins/load/load_redshift_proxy.py @@ -9,7 +9,8 @@ from ayon_core.pipeline.load import LoadError from ayon_core.hosts.max.api.pipeline import ( containerise, update_custom_attribute_data, - get_previous_loaded_object + get_previous_loaded_object, + remove_container_data ) from ayon_core.hosts.max.api import lib from ayon_core.hosts.max.api.lib import ( @@ -72,6 +73,5 @@ class RedshiftProxyLoader(load.LoaderPlugin): def remove(self, container): from pymxs import runtime as rt - node = rt.getNodeByName(container["instance_node"]) - rt.delete(node) + remove_container_data(node) diff --git a/client/ayon_core/hosts/max/plugins/load/load_tycache.py b/client/ayon_core/hosts/max/plugins/load/load_tycache.py index 48fb5c447a..97f41026b4 100644 --- a/client/ayon_core/hosts/max/plugins/load/load_tycache.py +++ b/client/ayon_core/hosts/max/plugins/load/load_tycache.py @@ -1,13 +1,13 @@ import os from ayon_core.hosts.max.api import lib, maintained_selection from ayon_core.hosts.max.api.lib import ( - unique_namespace, - + unique_namespace ) from ayon_core.hosts.max.api.pipeline import ( containerise, get_previous_loaded_object, - update_custom_attribute_data + update_custom_attribute_data, + remove_container_data ) from ayon_core.pipeline import get_representation_path, load @@ -59,6 +59,5 @@ class TyCacheLoader(load.LoaderPlugin): def remove(self, container): """remove the container""" from pymxs import runtime as rt - node = rt.GetNodeByName(container["instance_node"]) - rt.Delete(node) + remove_container_data(node) From a811ef9a0ce9c79b99a1a41bd9f5730d35e4a93c Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Thu, 15 Feb 2024 17:58:05 +0800 Subject: [PATCH 31/58] remove unrelated code --- client/ayon_core/hosts/max/api/pipeline.py | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/client/ayon_core/hosts/max/api/pipeline.py b/client/ayon_core/hosts/max/api/pipeline.py index 106c29fd26..c26e697429 100644 --- a/client/ayon_core/hosts/max/api/pipeline.py +++ b/client/ayon_core/hosts/max/api/pipeline.py @@ -242,20 +242,3 @@ def get_previous_loaded_object(container: str): if str(obj) in sel_list: node_list.append(obj) return node_list - - -def remove_container_data(container: str): - """Function to remove container data after updating, switching or deleting it. - - Args: - container (str): container - """ - if container.modifiers[0].name == "OP Data": - all_set_members_names = [ - member.node for member - in container.modifiers[0].openPypeData.all_handles] - for current_set_member in all_set_members_names: - rt.Delete(current_set_member) - rt.deleteModifier(container, container.modifiers[0]) - - rt.Delete(container) From 87df73da2242ac3ba32378f681d979ab6a011ed2 Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Thu, 15 Feb 2024 18:12:32 +0800 Subject: [PATCH 32/58] restored unrelated code --- client/ayon_core/hosts/max/api/pipeline.py | 17 ----------------- .../hosts/max/plugins/load/load_camera_fbx.py | 8 ++++---- .../hosts/max/plugins/load/load_max_scene.py | 9 ++++----- .../hosts/max/plugins/load/load_model.py | 8 +++----- .../hosts/max/plugins/load/load_model_fbx.py | 9 ++++----- .../hosts/max/plugins/load/load_model_obj.py | 6 +++--- .../hosts/max/plugins/load/load_model_usd.py | 5 ++--- .../hosts/max/plugins/load/load_pointcache.py | 5 ++--- .../plugins/load/load_pointcache_ornatrix.py | 5 ++--- .../hosts/max/plugins/load/load_pointcloud.py | 6 +++--- .../max/plugins/load/load_redshift_proxy.py | 6 +++--- .../hosts/max/plugins/load/load_tycache.py | 9 +++++---- 12 files changed, 35 insertions(+), 58 deletions(-) diff --git a/client/ayon_core/hosts/max/api/pipeline.py b/client/ayon_core/hosts/max/api/pipeline.py index 106c29fd26..c26e697429 100644 --- a/client/ayon_core/hosts/max/api/pipeline.py +++ b/client/ayon_core/hosts/max/api/pipeline.py @@ -242,20 +242,3 @@ def get_previous_loaded_object(container: str): if str(obj) in sel_list: node_list.append(obj) return node_list - - -def remove_container_data(container: str): - """Function to remove container data after updating, switching or deleting it. - - Args: - container (str): container - """ - if container.modifiers[0].name == "OP Data": - all_set_members_names = [ - member.node for member - in container.modifiers[0].openPypeData.all_handles] - for current_set_member in all_set_members_names: - rt.Delete(current_set_member) - rt.deleteModifier(container, container.modifiers[0]) - - rt.Delete(container) diff --git a/client/ayon_core/hosts/max/plugins/load/load_camera_fbx.py b/client/ayon_core/hosts/max/plugins/load/load_camera_fbx.py index d7eebdbc3a..34b120c179 100644 --- a/client/ayon_core/hosts/max/plugins/load/load_camera_fbx.py +++ b/client/ayon_core/hosts/max/plugins/load/load_camera_fbx.py @@ -1,6 +1,6 @@ import os -from ayon_core.hosts.max.api import lib +from ayon_core.hosts.max.api import lib, maintained_selection from ayon_core.hosts.max.api.lib import ( unique_namespace, get_namespace, @@ -9,8 +9,7 @@ from ayon_core.hosts.max.api.lib import ( from ayon_core.hosts.max.api.pipeline import ( containerise, get_previous_loaded_object, - update_custom_attribute_data, - remove_container_data + update_custom_attribute_data ) from ayon_core.pipeline import get_representation_path, load @@ -95,5 +94,6 @@ class FbxLoader(load.LoaderPlugin): def remove(self, container): from pymxs import runtime as rt + node = rt.GetNodeByName(container["instance_node"]) - remove_container_data(node) + rt.Delete(node) diff --git a/client/ayon_core/hosts/max/plugins/load/load_max_scene.py b/client/ayon_core/hosts/max/plugins/load/load_max_scene.py index 81f3af089f..7267d7a59e 100644 --- a/client/ayon_core/hosts/max/plugins/load/load_max_scene.py +++ b/client/ayon_core/hosts/max/plugins/load/load_max_scene.py @@ -7,10 +7,8 @@ from ayon_core.hosts.max.api.lib import ( object_transform_set ) from ayon_core.hosts.max.api.pipeline import ( - containerise, - get_previous_loaded_object, - update_custom_attribute_data, - remove_container_data + containerise, get_previous_loaded_object, + update_custom_attribute_data ) from ayon_core.pipeline import get_representation_path, load @@ -95,5 +93,6 @@ class MaxSceneLoader(load.LoaderPlugin): def remove(self, container): from pymxs import runtime as rt + node = rt.GetNodeByName(container["instance_node"]) - remove_container_data(node) + rt.Delete(node) diff --git a/client/ayon_core/hosts/max/plugins/load/load_model.py b/client/ayon_core/hosts/max/plugins/load/load_model.py index 28ec7be01f..796e1b80ad 100644 --- a/client/ayon_core/hosts/max/plugins/load/load_model.py +++ b/client/ayon_core/hosts/max/plugins/load/load_model.py @@ -2,13 +2,11 @@ import os from ayon_core.pipeline import load, get_representation_path from ayon_core.hosts.max.api.pipeline import ( containerise, - get_previous_loaded_object, - remove_container_data + get_previous_loaded_object ) from ayon_core.hosts.max.api import lib from ayon_core.hosts.max.api.lib import ( - maintained_selection, - unique_namespace + maintained_selection, unique_namespace ) @@ -101,7 +99,7 @@ class ModelAbcLoader(load.LoaderPlugin): from pymxs import runtime as rt node = rt.GetNodeByName(container["instance_node"]) - remove_container_data(node) + rt.Delete(node) @staticmethod def get_container_children(parent, type_name): diff --git a/client/ayon_core/hosts/max/plugins/load/load_model_fbx.py b/client/ayon_core/hosts/max/plugins/load/load_model_fbx.py index 81ad84546a..827cf63b39 100644 --- a/client/ayon_core/hosts/max/plugins/load/load_model_fbx.py +++ b/client/ayon_core/hosts/max/plugins/load/load_model_fbx.py @@ -1,10 +1,8 @@ import os from ayon_core.pipeline import load, get_representation_path from ayon_core.hosts.max.api.pipeline import ( - containerise, - get_previous_loaded_object, - update_custom_attribute_data, - remove_container_data + containerise, get_previous_loaded_object, + update_custom_attribute_data ) from ayon_core.hosts.max.api import lib from ayon_core.hosts.max.api.lib import ( @@ -94,5 +92,6 @@ class FbxModelLoader(load.LoaderPlugin): def remove(self, container): from pymxs import runtime as rt + node = rt.GetNodeByName(container["instance_node"]) - remove_container_data(node) + rt.Delete(node) diff --git a/client/ayon_core/hosts/max/plugins/load/load_model_obj.py b/client/ayon_core/hosts/max/plugins/load/load_model_obj.py index 1023b67f0c..22d3d4b58a 100644 --- a/client/ayon_core/hosts/max/plugins/load/load_model_obj.py +++ b/client/ayon_core/hosts/max/plugins/load/load_model_obj.py @@ -11,8 +11,7 @@ from ayon_core.hosts.max.api.lib import maintained_selection from ayon_core.hosts.max.api.pipeline import ( containerise, get_previous_loaded_object, - update_custom_attribute_data, - remove_container_data + update_custom_attribute_data ) from ayon_core.pipeline import get_representation_path, load @@ -85,5 +84,6 @@ class ObjLoader(load.LoaderPlugin): def remove(self, container): from pymxs import runtime as rt + node = rt.GetNodeByName(container["instance_node"]) - remove_container_data(node) + rt.Delete(node) diff --git a/client/ayon_core/hosts/max/plugins/load/load_model_usd.py b/client/ayon_core/hosts/max/plugins/load/load_model_usd.py index 6a08bebf5a..8d42219217 100644 --- a/client/ayon_core/hosts/max/plugins/load/load_model_usd.py +++ b/client/ayon_core/hosts/max/plugins/load/load_model_usd.py @@ -13,8 +13,7 @@ from ayon_core.hosts.max.api.lib import maintained_selection from ayon_core.hosts.max.api.pipeline import ( containerise, get_previous_loaded_object, - update_custom_attribute_data, - remove_container_data + update_custom_attribute_data ) from ayon_core.pipeline import get_representation_path, load @@ -115,4 +114,4 @@ class ModelUSDLoader(load.LoaderPlugin): def remove(self, container): node = rt.GetNodeByName(container["instance_node"]) - remove_container_data(node) + rt.Delete(node) diff --git a/client/ayon_core/hosts/max/plugins/load/load_pointcache.py b/client/ayon_core/hosts/max/plugins/load/load_pointcache.py index d7267afb7d..a92fa66757 100644 --- a/client/ayon_core/hosts/max/plugins/load/load_pointcache.py +++ b/client/ayon_core/hosts/max/plugins/load/load_pointcache.py @@ -10,8 +10,7 @@ from ayon_core.hosts.max.api import lib, maintained_selection from ayon_core.hosts.max.api.lib import unique_namespace from ayon_core.hosts.max.api.pipeline import ( containerise, - get_previous_loaded_object, - remove_container_data + get_previous_loaded_object ) @@ -106,7 +105,7 @@ class AbcLoader(load.LoaderPlugin): from pymxs import runtime as rt node = rt.GetNodeByName(container["instance_node"]) - remove_container_data(node) + rt.Delete(node) @staticmethod def get_container_children(parent, type_name): diff --git a/client/ayon_core/hosts/max/plugins/load/load_pointcache_ornatrix.py b/client/ayon_core/hosts/max/plugins/load/load_pointcache_ornatrix.py index 5b48e5d189..27b2e271d2 100644 --- a/client/ayon_core/hosts/max/plugins/load/load_pointcache_ornatrix.py +++ b/client/ayon_core/hosts/max/plugins/load/load_pointcache_ornatrix.py @@ -4,8 +4,7 @@ from ayon_core.pipeline.load import LoadError from ayon_core.hosts.max.api.pipeline import ( containerise, get_previous_loaded_object, - update_custom_attribute_data, - remove_container_data + update_custom_attribute_data ) from ayon_core.hosts.max.api.lib import ( @@ -106,4 +105,4 @@ class OxAbcLoader(load.LoaderPlugin): def remove(self, container): node = rt.GetNodeByName(container["instance_node"]) - remove_container_data(node) \ No newline at end of file + rt.Delete(node) diff --git a/client/ayon_core/hosts/max/plugins/load/load_pointcloud.py b/client/ayon_core/hosts/max/plugins/load/load_pointcloud.py index 7f4fba50b3..45e3da5621 100644 --- a/client/ayon_core/hosts/max/plugins/load/load_pointcloud.py +++ b/client/ayon_core/hosts/max/plugins/load/load_pointcloud.py @@ -8,8 +8,7 @@ from ayon_core.hosts.max.api.lib import ( from ayon_core.hosts.max.api.pipeline import ( containerise, get_previous_loaded_object, - update_custom_attribute_data, - remove_container_data + update_custom_attribute_data ) from ayon_core.pipeline import get_representation_path, load @@ -64,5 +63,6 @@ class PointCloudLoader(load.LoaderPlugin): def remove(self, container): """remove the container""" from pymxs import runtime as rt + node = rt.GetNodeByName(container["instance_node"]) - remove_container_data(node) + rt.Delete(node) diff --git a/client/ayon_core/hosts/max/plugins/load/load_redshift_proxy.py b/client/ayon_core/hosts/max/plugins/load/load_redshift_proxy.py index 3ccc5cc5e1..3f73210c24 100644 --- a/client/ayon_core/hosts/max/plugins/load/load_redshift_proxy.py +++ b/client/ayon_core/hosts/max/plugins/load/load_redshift_proxy.py @@ -9,8 +9,7 @@ from ayon_core.pipeline.load import LoadError from ayon_core.hosts.max.api.pipeline import ( containerise, update_custom_attribute_data, - get_previous_loaded_object, - remove_container_data + get_previous_loaded_object ) from ayon_core.hosts.max.api import lib from ayon_core.hosts.max.api.lib import ( @@ -73,5 +72,6 @@ class RedshiftProxyLoader(load.LoaderPlugin): def remove(self, container): from pymxs import runtime as rt + node = rt.getNodeByName(container["instance_node"]) - remove_container_data(node) + rt.delete(node) diff --git a/client/ayon_core/hosts/max/plugins/load/load_tycache.py b/client/ayon_core/hosts/max/plugins/load/load_tycache.py index 97f41026b4..48fb5c447a 100644 --- a/client/ayon_core/hosts/max/plugins/load/load_tycache.py +++ b/client/ayon_core/hosts/max/plugins/load/load_tycache.py @@ -1,13 +1,13 @@ import os from ayon_core.hosts.max.api import lib, maintained_selection from ayon_core.hosts.max.api.lib import ( - unique_namespace + unique_namespace, + ) from ayon_core.hosts.max.api.pipeline import ( containerise, get_previous_loaded_object, - update_custom_attribute_data, - remove_container_data + update_custom_attribute_data ) from ayon_core.pipeline import get_representation_path, load @@ -59,5 +59,6 @@ class TyCacheLoader(load.LoaderPlugin): def remove(self, container): """remove the container""" from pymxs import runtime as rt + node = rt.GetNodeByName(container["instance_node"]) - remove_container_data(node) + rt.Delete(node) From 005e1b70cc2d89e5a1b62087ca3513406d5dc4d5 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Fri, 16 Feb 2024 09:35:35 +0100 Subject: [PATCH 33/58] removed unused rr_path attribute --- client/ayon_core/modules/royalrender/royal_render_module.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/client/ayon_core/modules/royalrender/royal_render_module.py b/client/ayon_core/modules/royalrender/royal_render_module.py index 66b09832d8..a413fc4d8d 100644 --- a/client/ayon_core/modules/royalrender/royal_render_module.py +++ b/client/ayon_core/modules/royalrender/royal_render_module.py @@ -20,7 +20,6 @@ class RoyalRenderModule(OpenPypeModule, IPluginPaths): def __init__(self, manager, settings): # type: (ayon_core.addon.AddonsManager, dict) -> None - self.rr_paths = {} self._api = None self.settings = settings super(RoyalRenderModule, self).__init__(manager, settings) @@ -29,7 +28,6 @@ class RoyalRenderModule(OpenPypeModule, IPluginPaths): # type: (dict) -> None rr_settings = module_settings[self.name] self.enabled = rr_settings["enabled"] - self.rr_paths = rr_settings.get("rr_paths") @staticmethod def get_plugin_paths(): From c34daca9b034f00400dc37e84e95858b2f5e5b5e Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Fri, 16 Feb 2024 09:40:36 +0100 Subject: [PATCH 34/58] removed royalrender settings conversion --- client/ayon_core/settings/ayon_settings.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/client/ayon_core/settings/ayon_settings.py b/client/ayon_core/settings/ayon_settings.py index 190970b908..3a69711d57 100644 --- a/client/ayon_core/settings/ayon_settings.py +++ b/client/ayon_core/settings/ayon_settings.py @@ -78,21 +78,6 @@ def _convert_deadline_system_settings( output["modules"]["deadline"] = deadline_settings -def _convert_royalrender_system_settings( - ayon_settings, output, addon_versions, default_settings -): - enabled = addon_versions.get("royalrender") is not None - rr_settings = default_settings["modules"]["royalrender"] - rr_settings["enabled"] = enabled - if enabled: - ayon_royalrender = ayon_settings["royalrender"] - rr_settings["rr_paths"] = { - item["name"]: item["value"] - for item in ayon_royalrender["rr_paths"] - } - output["modules"]["royalrender"] = rr_settings - - def _convert_modules_system( ayon_settings, output, addon_versions, default_settings ): @@ -100,13 +85,13 @@ def _convert_modules_system( # TODO add 'enabled' values for func in ( _convert_deadline_system_settings, - _convert_royalrender_system_settings, ): func(ayon_settings, output, addon_versions, default_settings) for key in { "timers_manager", "clockify", + "royalrender", }: if addon_versions.get(key): output[key] = ayon_settings From 834cea70667cdeb885c34d2aaa2b14e1bd35dfa8 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Fri, 16 Feb 2024 09:42:21 +0100 Subject: [PATCH 35/58] Modified royal render addon initialization and name --- client/ayon_core/modules/royalrender/__init__.py | 4 ++-- .../modules/royalrender/royal_render_module.py | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/client/ayon_core/modules/royalrender/__init__.py b/client/ayon_core/modules/royalrender/__init__.py index cc92e3b50d..a4769b6086 100644 --- a/client/ayon_core/modules/royalrender/__init__.py +++ b/client/ayon_core/modules/royalrender/__init__.py @@ -1,6 +1,6 @@ -from .royal_render_module import RoyalRenderModule +from .royal_render_module import RoyalRenderAddon __all__ = ( - "RoyalRenderModule", + "RoyalRenderAddon", ) diff --git a/client/ayon_core/modules/royalrender/royal_render_module.py b/client/ayon_core/modules/royalrender/royal_render_module.py index a413fc4d8d..ba3ce67198 100644 --- a/client/ayon_core/modules/royalrender/royal_render_module.py +++ b/client/ayon_core/modules/royalrender/royal_render_module.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- """Module providing support for Royal Render.""" import os -import ayon_core.modules -from ayon_core.modules import OpenPypeModule, IPluginPaths + +from ayon_core.addon import AYONAddon, IPluginPaths -class RoyalRenderModule(OpenPypeModule, IPluginPaths): +class RoyalRenderAddon(AYONAddon, IPluginPaths): """Class providing basic Royal Render implementation logic.""" name = "royalrender" @@ -19,15 +19,13 @@ class RoyalRenderModule(OpenPypeModule, IPluginPaths): return self._api def __init__(self, manager, settings): - # type: (ayon_core.addon.AddonsManager, dict) -> None self._api = None self.settings = settings super(RoyalRenderModule, self).__init__(manager, settings) - def initialize(self, module_settings): + def initialize(self, studio_settings): # type: (dict) -> None - rr_settings = module_settings[self.name] - self.enabled = rr_settings["enabled"] + self.enabled = self.name in studio_settings @staticmethod def get_plugin_paths(): From 722923f3c09c3433bd0aefede385414fe4d581eb Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Fri, 16 Feb 2024 09:43:19 +0100 Subject: [PATCH 36/58] modified code to use AYON settings --- client/ayon_core/modules/royalrender/lib.py | 31 ++++----------- .../publish/collect_rr_path_from_instance.py | 39 +++++++------------ .../publish/submit_jobs_to_royalrender.py | 31 ++++----------- 3 files changed, 31 insertions(+), 70 deletions(-) diff --git a/client/ayon_core/modules/royalrender/lib.py b/client/ayon_core/modules/royalrender/lib.py index 5343a5f06f..966eb82ab1 100644 --- a/client/ayon_core/modules/royalrender/lib.py +++ b/client/ayon_core/modules/royalrender/lib.py @@ -213,30 +213,15 @@ class BaseCreateRoyalRenderJob(pyblish.api.InstancePlugin, @staticmethod def _resolve_rr_path(context, rr_path_name): # type: (pyblish.api.Context, str) -> str - rr_settings = ( - context.data - ["system_settings"] - ["modules"] - ["royalrender"] - ) - try: - default_servers = rr_settings["rr_paths"] - project_servers = ( - context.data - ["project_settings"] - ["royalrender"] - ["rr_paths"] - ) - rr_servers = { - k: default_servers[k] - for k in project_servers - if k in default_servers - } - - except (AttributeError, KeyError): - # Handle situation were we had only one url for royal render. - return context.data["defaultRRPath"][platform.system().lower()] + rr_settings = context.data["project_settings"]["royalrender"] + rr_paths = rr_settings["rr_paths"] + selected_paths = rr_settings["selected_rr_paths"] + rr_servers = { + path_key: rr_paths[path_key] + for path_key in selected_paths + if path_key in rr_paths + } return rr_servers[rr_path_name][platform.system().lower()] def expected_files(self, instance, path, start_frame, end_frame): diff --git a/client/ayon_core/modules/royalrender/plugins/publish/collect_rr_path_from_instance.py b/client/ayon_core/modules/royalrender/plugins/publish/collect_rr_path_from_instance.py index e978ce5bed..f43ed1ca49 100644 --- a/client/ayon_core/modules/royalrender/plugins/publish/collect_rr_path_from_instance.py +++ b/client/ayon_core/modules/royalrender/plugins/publish/collect_rr_path_from_instance.py @@ -18,30 +18,21 @@ class CollectRRPathFromInstance(pyblish.api.InstancePlugin): def _collect_rr_path_name(instance): # type: (pyblish.api.Instance) -> str """Get Royal Render pat name from render instance.""" - rr_settings = ( - instance.context.data - ["system_settings"] - ["modules"] - ["royalrender"] - ) - if not instance.data.get("rrPaths"): + + instance_rr_paths = instance.data.get("rrPaths") + if instance_rr_paths is None: return "default" - try: - default_servers = rr_settings["rr_paths"] - project_servers = ( - instance.context.data - ["project_settings"] - ["royalrender"] - ["rr_paths"] - ) - rr_servers = { - k: default_servers[k] - for k in project_servers - if k in default_servers - } - except (AttributeError, KeyError): - # Handle situation were we had only one url for royal render. - return rr_settings["rr_paths"]["default"] + rr_settings = instance.context.data["project_settings"]["royalrender"] + rr_paths = rr_settings["rr_paths"] + selected_paths = rr_settings["selected_rr_paths"] - return list(rr_servers.keys())[int(instance.data.get("rrPaths"))] + rr_servers = { + path_key + for path_key in selected_paths + if path_key in rr_paths + } + for instance_rr_path in instance_rr_paths: + if instance_rr_path in rr_servers: + return instance_rr_path + return "default" diff --git a/client/ayon_core/modules/royalrender/plugins/publish/submit_jobs_to_royalrender.py b/client/ayon_core/modules/royalrender/plugins/publish/submit_jobs_to_royalrender.py index a76bdfc26c..5e25464186 100644 --- a/client/ayon_core/modules/royalrender/plugins/publish/submit_jobs_to_royalrender.py +++ b/client/ayon_core/modules/royalrender/plugins/publish/submit_jobs_to_royalrender.py @@ -104,28 +104,13 @@ class SubmitJobsToRoyalRender(pyblish.api.ContextPlugin): @staticmethod def _resolve_rr_path(context, rr_path_name): # type: (pyblish.api.Context, str) -> str - rr_settings = ( - context.data - ["system_settings"] - ["modules"] - ["royalrender"] - ) - try: - default_servers = rr_settings["rr_paths"] - project_servers = ( - context.data - ["project_settings"] - ["royalrender"] - ["rr_paths"] - ) - rr_servers = { - k: default_servers[k] - for k in project_servers - if k in default_servers - } - - except (AttributeError, KeyError): - # Handle situation were we had only one url for royal render. - return context.data["defaultRRPath"][platform.system().lower()] + rr_settings = context.data["project_settings"]["royalrender"] + rr_paths = rr_settings["rr_paths"] + selected_paths = rr_settings["selected_rr_paths"] + rr_servers = { + path_key: rr_paths[path_key] + for path_key in selected_paths + if path_key in rr_paths + } return rr_servers[rr_path_name][platform.system().lower()] From 50fbc854a3f10db8468e07761d5e2f2e12a534f0 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Fri, 16 Feb 2024 09:44:31 +0100 Subject: [PATCH 37/58] renamed 'royal_render_module.py' to 'addon.py' --- client/ayon_core/modules/royalrender/__init__.py | 2 +- .../modules/royalrender/{royal_render_module.py => addon.py} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename client/ayon_core/modules/royalrender/{royal_render_module.py => addon.py} (100%) diff --git a/client/ayon_core/modules/royalrender/__init__.py b/client/ayon_core/modules/royalrender/__init__.py index a4769b6086..121530beda 100644 --- a/client/ayon_core/modules/royalrender/__init__.py +++ b/client/ayon_core/modules/royalrender/__init__.py @@ -1,4 +1,4 @@ -from .royal_render_module import RoyalRenderAddon +from .addon import RoyalRenderAddon __all__ = ( diff --git a/client/ayon_core/modules/royalrender/royal_render_module.py b/client/ayon_core/modules/royalrender/addon.py similarity index 100% rename from client/ayon_core/modules/royalrender/royal_render_module.py rename to client/ayon_core/modules/royalrender/addon.py From 313894c5b1286328a24ca524d1b0b9bc45ad0153 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Fri, 16 Feb 2024 09:51:56 +0100 Subject: [PATCH 38/58] commented out unused 'api' property --- client/ayon_core/modules/royalrender/addon.py | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/client/ayon_core/modules/royalrender/addon.py b/client/ayon_core/modules/royalrender/addon.py index ba3ce67198..e9dd694f4c 100644 --- a/client/ayon_core/modules/royalrender/addon.py +++ b/client/ayon_core/modules/royalrender/addon.py @@ -9,19 +9,14 @@ class RoyalRenderAddon(AYONAddon, IPluginPaths): """Class providing basic Royal Render implementation logic.""" name = "royalrender" - @property - def api(self): - if not self._api: - # import royal render modules - from . import api as rr_api - self._api = rr_api.Api(self.settings) - - return self._api - - def __init__(self, manager, settings): - self._api = None - self.settings = settings - super(RoyalRenderModule, self).__init__(manager, settings) + # @property + # def api(self): + # if not self._api: + # # import royal render modules + # from . import api as rr_api + # self._api = rr_api.Api(self.settings) + # + # return self._api def initialize(self, studio_settings): # type: (dict) -> None From c359f05d8d82e15375c83a941a94a3eb0641650b Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Fri, 16 Feb 2024 09:53:09 +0100 Subject: [PATCH 39/58] renamed 'api' property to 'rr_api' --- client/ayon_core/modules/royalrender/addon.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/client/ayon_core/modules/royalrender/addon.py b/client/ayon_core/modules/royalrender/addon.py index e9dd694f4c..e69cf9feec 100644 --- a/client/ayon_core/modules/royalrender/addon.py +++ b/client/ayon_core/modules/royalrender/addon.py @@ -9,14 +9,14 @@ class RoyalRenderAddon(AYONAddon, IPluginPaths): """Class providing basic Royal Render implementation logic.""" name = "royalrender" + # _rr_api = None # @property - # def api(self): - # if not self._api: + # def rr_api(self): + # if not self._rr_api: # # import royal render modules - # from . import api as rr_api - # self._api = rr_api.Api(self.settings) - # - # return self._api + # from .api import Api + # self._rr_api = Api(self.settings) + # return self._rr_api def initialize(self, studio_settings): # type: (dict) -> None From aafc6470c29f73fad297077bd256dab943c8d5f3 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Fri, 16 Feb 2024 14:45:10 +0100 Subject: [PATCH 40/58] use 'folderPath' instead of 'asset' --- .../publish/submit_maya_remote_publish_deadline.py | 2 +- .../plugins/publish/submit_publish_cache_job.py | 6 +++--- .../deadline/plugins/publish/submit_publish_job.py | 12 ++++++------ client/ayon_core/modules/royalrender/lib.py | 2 +- .../plugins/publish/collect_sequences_from_job.py | 4 ++-- .../publish/create_publish_royalrender_job.py | 4 ++-- .../timers_manager/plugins/publish/start_timer.py | 2 +- client/ayon_core/pipeline/create/legacy_create.py | 4 ++-- client/ayon_core/pipeline/farm/pyblish_functions.py | 10 +++++----- .../pipeline/publish/abstract_collect_render.py | 2 +- .../plugins/publish/collect_anatomy_instance_data.py | 4 ++-- client/ayon_core/plugins/publish/collect_audio.py | 2 +- .../plugins/publish/collect_context_entities.py | 2 +- .../plugins/publish/collect_current_context.py | 7 +++---- .../ayon_core/plugins/publish/collect_frames_fix.py | 2 +- .../plugins/publish/collect_from_create_context.py | 3 +-- .../ayon_core/plugins/publish/collect_hierarchy.py | 2 +- .../plugins/publish/collect_rendered_files.py | 11 ++++++++--- .../plugins/publish/extract_hierarchy_to_ayon.py | 2 +- .../plugins/publish/extract_otio_audio_tracks.py | 2 +- .../ayon_core/plugins/publish/integrate_thumbnail.py | 5 +++-- .../plugins/publish/validate_editorial_asset_name.py | 2 +- .../plugins/publish/validate_unique_subsets.py | 2 +- 23 files changed, 49 insertions(+), 45 deletions(-) diff --git a/client/ayon_core/modules/deadline/plugins/publish/submit_maya_remote_publish_deadline.py b/client/ayon_core/modules/deadline/plugins/publish/submit_maya_remote_publish_deadline.py index 1042c44c33..772fa03628 100644 --- a/client/ayon_core/modules/deadline/plugins/publish/submit_maya_remote_publish_deadline.py +++ b/client/ayon_core/modules/deadline/plugins/publish/submit_maya_remote_publish_deadline.py @@ -105,7 +105,7 @@ class MayaSubmitRemotePublishDeadline( } environment["AYON_PROJECT_NAME"] = project_name - environment["AYON_FOLDER_PATH"] = instance.context.data["asset"] + environment["AYON_FOLDER_PATH"] = instance.context.data["folderPath"] environment["AYON_TASK_NAME"] = instance.context.data["task"] environment["AYON_APP_NAME"] = os.environ.get("AYON_APP_NAME") environment["OPENPYPE_PUBLISH_SUBSET"] = instance.data["subset"] diff --git a/client/ayon_core/modules/deadline/plugins/publish/submit_publish_cache_job.py b/client/ayon_core/modules/deadline/plugins/publish/submit_publish_cache_job.py index 54d4fb47fc..0b0e293943 100644 --- a/client/ayon_core/modules/deadline/plugins/publish/submit_publish_cache_job.py +++ b/client/ayon_core/modules/deadline/plugins/publish/submit_publish_cache_job.py @@ -112,7 +112,7 @@ class ProcessSubmittedCacheJobOnFarm(pyblish.api.InstancePlugin, output_dir = self._get_publish_folder( anatomy, deepcopy(instance.data["anatomyData"]), - instance.data.get("asset"), + instance.data.get("folderPath"), instance.data["subset"], instance.context, instance.data["family"], @@ -126,7 +126,7 @@ class ProcessSubmittedCacheJobOnFarm(pyblish.api.InstancePlugin, environment = { "AYON_PROJECT_NAME": instance.context.data["projectName"], - "AYON_FOLDER_PATH": instance.context.data["asset"], + "AYON_FOLDER_PATH": instance.context.data["folderPath"], "AYON_TASK_NAME": instance.context.data["task"], "AYON_USERNAME": instance.context.data["user"], "AYON_LOG_NO_COLORS": "1", @@ -359,7 +359,7 @@ class ProcessSubmittedCacheJobOnFarm(pyblish.api.InstancePlugin, # publish job file publish_job = { - "asset": instance_skeleton_data["asset"], + "folderPath": instance_skeleton_data["folderPath"], "frameStart": instance_skeleton_data["frameStart"], "frameEnd": instance_skeleton_data["frameEnd"], "fps": instance_skeleton_data["fps"], diff --git a/client/ayon_core/modules/deadline/plugins/publish/submit_publish_job.py b/client/ayon_core/modules/deadline/plugins/publish/submit_publish_job.py index d4d04f79f6..31c845a0b8 100644 --- a/client/ayon_core/modules/deadline/plugins/publish/submit_publish_job.py +++ b/client/ayon_core/modules/deadline/plugins/publish/submit_publish_job.py @@ -189,7 +189,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin, output_dir = self._get_publish_folder( anatomy, deepcopy(instance.data["anatomyData"]), - instance.data.get("asset"), + instance.data.get("folderPath"), instances[0]["subset"], instance.context, instances[0]["family"], @@ -203,7 +203,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin, environment = { "AYON_PROJECT_NAME": instance.context.data["projectName"], - "AYON_FOLDER_PATH": instance.context.data["asset"], + "AYON_FOLDER_PATH": instance.context.data["folderPath"], "AYON_TASK_NAME": instance.context.data["task"], "AYON_USERNAME": instance.context.data["user"], "AYON_LOG_NO_COLORS": "1", @@ -335,7 +335,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin, self.context = context self.anatomy = instance.context.data["anatomy"] - asset = data.get("asset") or context.data["asset"] + folder_path = data.get("folderPath") or context.data["folderPath"] subset = data.get("subset") start = instance.data.get("frameStart") @@ -360,7 +360,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin, if data.get("extendFrames", False): start, end = self._extend_frames( - asset, + folder_path, subset, start, end, @@ -402,7 +402,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin, "family": family, "subset": subset, "families": families, - "asset": asset, + "folderPath": folder_path, "frameStart": start, "frameEnd": end, "handleStart": handle_start, @@ -620,7 +620,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin, # publish job file publish_job = { - "asset": instance_skeleton_data["asset"], + "folderPath": instance_skeleton_data["folderPath"], "frameStart": instance_skeleton_data["frameStart"], "frameEnd": instance_skeleton_data["frameEnd"], "fps": instance_skeleton_data["fps"], diff --git a/client/ayon_core/modules/royalrender/lib.py b/client/ayon_core/modules/royalrender/lib.py index 5343a5f06f..f782cb9984 100644 --- a/client/ayon_core/modules/royalrender/lib.py +++ b/client/ayon_core/modules/royalrender/lib.py @@ -350,7 +350,7 @@ class BaseCreateRoyalRenderJob(pyblish.api.InstancePlugin, add_kwargs = { "project": anatomy_data["project"]["name"], - "asset": instance.context.data["asset"], + "asset": instance.context.data["folderPath"], "task": anatomy_data["task"]["name"], "app": instance.context.data.get("appName"), "envgroup": "farm" diff --git a/client/ayon_core/modules/royalrender/plugins/publish/collect_sequences_from_job.py b/client/ayon_core/modules/royalrender/plugins/publish/collect_sequences_from_job.py index cd34ba9bb3..4460e11004 100644 --- a/client/ayon_core/modules/royalrender/plugins/publish/collect_sequences_from_job.py +++ b/client/ayon_core/modules/royalrender/plugins/publish/collect_sequences_from_job.py @@ -189,8 +189,8 @@ class CollectSequencesFromJob(pyblish.api.ContextPlugin): "family": families[0], # backwards compatibility / pyblish "families": list(families), "subset": subset, - "asset": data.get( - "asset", context.data["asset"] + "folderPath": data.get( + "folderPath", context.data["folderPath"] ), "stagingDir": root, "frameStart": start, diff --git a/client/ayon_core/modules/royalrender/plugins/publish/create_publish_royalrender_job.py b/client/ayon_core/modules/royalrender/plugins/publish/create_publish_royalrender_job.py index 910abfcb15..33f5585cef 100644 --- a/client/ayon_core/modules/royalrender/plugins/publish/create_publish_royalrender_job.py +++ b/client/ayon_core/modules/royalrender/plugins/publish/create_publish_royalrender_job.py @@ -132,7 +132,7 @@ class CreatePublishRoyalRenderJob(pyblish.api.InstancePlugin, # publish job file publish_job = { - "asset": instance_skeleton_data["asset"], + "folderPath": instance_skeleton_data["folderPath"], "frameStart": instance_skeleton_data["frameStart"], "frameEnd": instance_skeleton_data["frameEnd"], "fps": instance_skeleton_data["fps"], @@ -180,7 +180,7 @@ class CreatePublishRoyalRenderJob(pyblish.api.InstancePlugin, environment = RREnvList({ "AYON_PROJECT_NAME": anatomy_data["project"]["name"], - "AYON_FOLDER_PATH": instance.context.data["asset"], + "AYON_FOLDER_PATH": instance.context.data["folderPath"], "AYON_TASK_NAME": anatomy_data["task"]["name"], "AYON_USERNAME": anatomy_data["user"] }) diff --git a/client/ayon_core/modules/timers_manager/plugins/publish/start_timer.py b/client/ayon_core/modules/timers_manager/plugins/publish/start_timer.py index 51f707ecf6..a3eb49ee70 100644 --- a/client/ayon_core/modules/timers_manager/plugins/publish/start_timer.py +++ b/client/ayon_core/modules/timers_manager/plugins/publish/start_timer.py @@ -24,7 +24,7 @@ class StartTimer(pyblish.api.ContextPlugin): return project_name = context.data["projectName"] - asset_name = context.data.get("asset") + asset_name = context.data.get("folderPath") task_name = context.data.get("task") if not project_name or not asset_name or not task_name: self.log.info(( diff --git a/client/ayon_core/pipeline/create/legacy_create.py b/client/ayon_core/pipeline/create/legacy_create.py index aab6b67e6f..a437c7921c 100644 --- a/client/ayon_core/pipeline/create/legacy_create.py +++ b/client/ayon_core/pipeline/create/legacy_create.py @@ -27,7 +27,7 @@ class LegacyCreator(object): log = logging.getLogger("LegacyCreator") log.propagate = True - def __init__(self, name, asset, options=None, data=None): + def __init__(self, name, folder_path, options=None, data=None): self.name = name # For backwards compatibility self.options = options @@ -35,7 +35,7 @@ class LegacyCreator(object): self.data = collections.OrderedDict() self.data["id"] = "pyblish.avalon.instance" self.data["family"] = self.family - self.data["asset"] = asset + self.data["folderPath"] = folder_path self.data["subset"] = name self.data["active"] = True diff --git a/client/ayon_core/pipeline/farm/pyblish_functions.py b/client/ayon_core/pipeline/farm/pyblish_functions.py index 389d3d27ed..4652d34011 100644 --- a/client/ayon_core/pipeline/farm/pyblish_functions.py +++ b/client/ayon_core/pipeline/farm/pyblish_functions.py @@ -197,7 +197,7 @@ def create_skeleton_instance( if data.get("extendFrames", False): time_data.start, time_data.end = extend_frames( - data["asset"], + data["folderPath"], data["subset"], time_data.start, time_data.end, @@ -228,7 +228,7 @@ def create_skeleton_instance( "family": family, "subset": data["subset"], "families": families, - "asset": data["asset"], + "folderPath": data["folderPath"], "frameStart": time_data.start, "frameEnd": time_data.end, "handleStart": time_data.handle_start, @@ -777,7 +777,7 @@ def create_skeleton_instance_cache(instance): if data.get("extendFrames", False): time_data.start, time_data.end = extend_frames( - data["asset"], + data["folderPath"], data["subset"], time_data.start, time_data.end, @@ -805,7 +805,7 @@ def create_skeleton_instance_cache(instance): "family": family, "subset": data["subset"], "families": families, - "asset": data["asset"], + "folderPath": data["folderPath"], "frameStart": time_data.start, "frameEnd": time_data.end, "handleStart": time_data.handle_start, @@ -1011,7 +1011,7 @@ def copy_extend_frames(instance, representation): version = get_last_version_by_subset_name( project_name, instance.data.get("subset"), - asset_name=instance.data.get("asset") + asset_name=instance.data.get("folderPath") ) # get its files based on extension diff --git a/client/ayon_core/pipeline/publish/abstract_collect_render.py b/client/ayon_core/pipeline/publish/abstract_collect_render.py index 764532cadb..6ca1d81bc7 100644 --- a/client/ayon_core/pipeline/publish/abstract_collect_render.py +++ b/client/ayon_core/pipeline/publish/abstract_collect_render.py @@ -30,7 +30,7 @@ class RenderInstance(object): label = attr.ib() # label to show in GUI subset = attr.ib() # subset name task = attr.ib() # task name - asset = attr.ib() # asset name + folderPath = attr.ib() # folder path attachTo = attr.ib() # subset name to attach render to setMembers = attr.ib() # list of nodes/members producing render output publish = attr.ib() # bool, True to publish instance diff --git a/client/ayon_core/plugins/publish/collect_anatomy_instance_data.py b/client/ayon_core/plugins/publish/collect_anatomy_instance_data.py index 336ac02b8e..763aee5b1c 100644 --- a/client/ayon_core/plugins/publish/collect_anatomy_instance_data.py +++ b/client/ayon_core/plugins/publish/collect_anatomy_instance_data.py @@ -296,7 +296,7 @@ class CollectAnatomyInstanceData(pyblish.api.ContextPlugin): if hierarchy: parent_name = hierarchy.split("/")[-1] - asset_name = instance.data["asset"].split("/")[-1] + asset_name = instance.data["folderPath"].split("/")[-1] anatomy_data.update({ "asset": asset_name, "hierarchy": hierarchy, @@ -337,7 +337,7 @@ class CollectAnatomyInstanceData(pyblish.api.ContextPlugin): # Try to find task data based on hierarchy context and asset name hierarchy_context = instance.context.data.get("hierarchyContext") - asset_name = instance.data.get("asset") + asset_name = instance.data.get("folderPath") if not hierarchy_context or not asset_name: return diff --git a/client/ayon_core/plugins/publish/collect_audio.py b/client/ayon_core/plugins/publish/collect_audio.py index 6da3fd0685..f0efd546e7 100644 --- a/client/ayon_core/plugins/publish/collect_audio.py +++ b/client/ayon_core/plugins/publish/collect_audio.py @@ -66,7 +66,7 @@ class CollectAudio(pyblish.api.ContextPlugin): # Add audio to instance if exists. instances_by_asset_name = collections.defaultdict(list) for instance in filtered_instances: - asset_name = instance.data["asset"] + asset_name = instance.data["folderPath"] instances_by_asset_name[asset_name].append(instance) asset_names = set(instances_by_asset_name.keys()) diff --git a/client/ayon_core/plugins/publish/collect_context_entities.py b/client/ayon_core/plugins/publish/collect_context_entities.py index 30bb184ef5..64ef73e2d9 100644 --- a/client/ayon_core/plugins/publish/collect_context_entities.py +++ b/client/ayon_core/plugins/publish/collect_context_entities.py @@ -25,7 +25,7 @@ class CollectContextEntities(pyblish.api.ContextPlugin): def process(self, context): project_name = context.data["projectName"] - asset_name = context.data["asset"] + asset_name = context.data["folderPath"] task_name = context.data["task"] project_entity = get_project(project_name) diff --git a/client/ayon_core/plugins/publish/collect_current_context.py b/client/ayon_core/plugins/publish/collect_current_context.py index 90b9fcdcbd..6a22daa04a 100644 --- a/client/ayon_core/plugins/publish/collect_current_context.py +++ b/client/ayon_core/plugins/publish/collect_current_context.py @@ -1,7 +1,7 @@ """ Provides: context -> projectName (str) - context -> asset (str) + context -> folderPath (str) context -> task (str) """ @@ -21,7 +21,7 @@ class CollectCurrentContext(pyblish.api.ContextPlugin): def process(self, context): # Check if values are already set project_name = context.data.get("projectName") - asset_name = context.data.get("asset") + asset_name = context.data.get("folderPath") task_name = context.data.get("task") current_context = get_current_context() @@ -29,13 +29,12 @@ class CollectCurrentContext(pyblish.api.ContextPlugin): context.data["projectName"] = current_context["project_name"] if not asset_name: - context.data["asset"] = current_context["asset_name"] + context.data["folderPath"] = current_context["asset_name"] if not task_name: context.data["task"] = current_context["task_name"] # QUESTION should we be explicit with keys? (the same on instances) - # - 'asset' -> 'assetName' # - 'task' -> 'taskName' self.log.info(( diff --git a/client/ayon_core/plugins/publish/collect_frames_fix.py b/client/ayon_core/plugins/publish/collect_frames_fix.py index 4903991d40..6996844eda 100644 --- a/client/ayon_core/plugins/publish/collect_frames_fix.py +++ b/client/ayon_core/plugins/publish/collect_frames_fix.py @@ -41,7 +41,7 @@ class CollectFramesFixDef( instance.data["frames_to_fix"] = frames_to_fix subset_name = instance.data["subset"] - asset_name = instance.data["asset"] + asset_name = instance.data["folderPath"] project_entity = instance.data["projectEntity"] project_name = project_entity["name"] diff --git a/client/ayon_core/plugins/publish/collect_from_create_context.py b/client/ayon_core/plugins/publish/collect_from_create_context.py index 66ca5745b2..7152446de8 100644 --- a/client/ayon_core/plugins/publish/collect_from_create_context.py +++ b/client/ayon_core/plugins/publish/collect_from_create_context.py @@ -38,7 +38,6 @@ class CollectFromCreateContext(pyblish.api.ContextPlugin): for created_instance in create_context.instances: instance_data = created_instance.data_to_store() - instance_data["asset"] = instance_data.pop("folderPath") if instance_data["active"]: thumbnail_path = thumbnail_paths_by_instance_id.get( created_instance.id @@ -80,7 +79,7 @@ class CollectFromCreateContext(pyblish.api.ContextPlugin): instance = context.create_instance(subset) instance.data.update({ "subset": subset, - "asset": in_data["asset"], + "folderPath": in_data["folderPath"], "task": in_data["task"], "label": in_data.get("label") or subset, "name": subset, diff --git a/client/ayon_core/plugins/publish/collect_hierarchy.py b/client/ayon_core/plugins/publish/collect_hierarchy.py index 32f10ba4c8..d7077d030a 100644 --- a/client/ayon_core/plugins/publish/collect_hierarchy.py +++ b/client/ayon_core/plugins/publish/collect_hierarchy.py @@ -62,7 +62,7 @@ class CollectHierarchy(pyblish.api.ContextPlugin): "pixelAspect": instance.data["pixelAspect"] } # Split by '/' for AYON where asset is a path - name = instance.data["asset"].split("/")[-1] + name = instance.data["folderPath"].split("/")[-1] actual = {name: shot_data} for parent in reversed(instance.data["parents"]): diff --git a/client/ayon_core/plugins/publish/collect_rendered_files.py b/client/ayon_core/plugins/publish/collect_rendered_files.py index 9a316b69a4..fcea773208 100644 --- a/client/ayon_core/plugins/publish/collect_rendered_files.py +++ b/client/ayon_core/plugins/publish/collect_rendered_files.py @@ -71,14 +71,19 @@ class CollectRenderedFiles(pyblish.api.ContextPlugin): """ # validate basic necessary data data_err = "invalid json file - missing data" - required = ["asset", "user", "comment", + required = ["user", "comment", "job", "instances", "version"] assert all(elem in data.keys() for elem in required), data_err + if "folderPath" not in data and "asset" not in data: + raise AssertionError(data_err) + + if "folderPath" not in data: + data["folderPath"] = data.pop("asset") # set context by first json file ctx = self._context.data - ctx["asset"] = ctx.get("asset") or data.get("asset") + ctx["folderPath"] = ctx.get("folderPath") or data.get("folderPath") ctx["intent"] = ctx.get("intent") or data.get("intent") ctx["comment"] = ctx.get("comment") or data.get("comment") ctx["user"] = ctx.get("user") or data.get("user") @@ -87,7 +92,7 @@ class CollectRenderedFiles(pyblish.api.ContextPlugin): # basic sanity check to see if we are working in same context # if some other json file has different context, bail out. ctx_err = "inconsistent contexts in json files - %s" - assert ctx.get("asset") == data.get("asset"), ctx_err % "asset" + assert ctx.get("folderPath") == data.get("folderPath"), ctx_err % "folderPath" assert ctx.get("intent") == data.get("intent"), ctx_err % "intent" assert ctx.get("comment") == data.get("comment"), ctx_err % "comment" assert ctx.get("user") == data.get("user"), ctx_err % "user" 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 0851b28134..26e448cc6e 100644 --- a/client/ayon_core/plugins/publish/extract_hierarchy_to_ayon.py +++ b/client/ayon_core/plugins/publish/extract_hierarchy_to_ayon.py @@ -45,7 +45,7 @@ class ExtractHierarchyToAYON(pyblish.api.ContextPlugin): continue # Skip if instance asset does not match - instance_asset_name = instance.data.get("asset") + instance_asset_name = instance.data.get("folderPath") instances_by_asset_name[instance_asset_name].append(instance) project_doc = context.data["projectEntity"] diff --git a/client/ayon_core/plugins/publish/extract_otio_audio_tracks.py b/client/ayon_core/plugins/publish/extract_otio_audio_tracks.py index c6bdb59f59..dd45f3fc1a 100644 --- a/client/ayon_core/plugins/publish/extract_otio_audio_tracks.py +++ b/client/ayon_core/plugins/publish/extract_otio_audio_tracks.py @@ -68,7 +68,7 @@ class ExtractOtioAudioTracks(pyblish.api.ContextPlugin): def add_audio_to_instances(self, audio_file, instances): created_files = [] for inst in instances: - name = inst.data["asset"] + name = inst.data["folderPath"] recycling_file = [f for f in created_files if name in f] diff --git a/client/ayon_core/plugins/publish/integrate_thumbnail.py b/client/ayon_core/plugins/publish/integrate_thumbnail.py index dd3fdd5073..03bc8d2d3d 100644 --- a/client/ayon_core/plugins/publish/integrate_thumbnail.py +++ b/client/ayon_core/plugins/publish/integrate_thumbnail.py @@ -196,12 +196,13 @@ class IntegrateThumbnailsAYON(pyblish.api.ContextPlugin): )) asset_entity = instance.data["assetEntity"] + folder_path = instance.data["folderPath"] thumbnail_info_by_entity_id[asset_entity["_id"]] = { "thumbnail_id": thumbnail_id, "entity_type": "asset", } - self.log.debug("Setting thumbnail for asset \"{}\" <{}>".format( - asset_entity["name"], version_id + self.log.debug("Setting thumbnail for folder \"{}\" <{}>".format( + folder_path, version_id )) op_session = OperationsSession() diff --git a/client/ayon_core/plugins/publish/validate_editorial_asset_name.py b/client/ayon_core/plugins/publish/validate_editorial_asset_name.py index d40263d7f3..dd1a19f602 100644 --- a/client/ayon_core/plugins/publish/validate_editorial_asset_name.py +++ b/client/ayon_core/plugins/publish/validate_editorial_asset_name.py @@ -113,7 +113,7 @@ class ValidateEditorialAssetName(pyblish.api.ContextPlugin): def get_parents(self, context): return_dict = {} for instance in context: - asset = instance.data["asset"] + asset = instance.data["folderPath"] families = instance.data.get("families", []) + [ instance.data["family"] ] diff --git a/client/ayon_core/plugins/publish/validate_unique_subsets.py b/client/ayon_core/plugins/publish/validate_unique_subsets.py index 75d12f8e01..5e0e90cff6 100644 --- a/client/ayon_core/plugins/publish/validate_unique_subsets.py +++ b/client/ayon_core/plugins/publish/validate_unique_subsets.py @@ -36,7 +36,7 @@ class ValidateSubsetUniqueness(pyblish.api.ContextPlugin): continue # Ignore instance without asset data - asset = instance.data.get("asset") + asset = instance.data.get("folderPath") if asset is None: self.log.warning("Instance found without `asset` data: " "{}".format(instance.name)) From ecba1daaa074a77fc81f21a5fc8d0f54e01657a9 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Fri, 16 Feb 2024 15:06:28 +0100 Subject: [PATCH 41/58] changed docstrings --- client/ayon_core/pipeline/create/README.md | 2 +- .../ayon_core/plugins/publish/collect_anatomy_instance_data.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/ayon_core/pipeline/create/README.md b/client/ayon_core/pipeline/create/README.md index 012572a776..3858314a82 100644 --- a/client/ayon_core/pipeline/create/README.md +++ b/client/ayon_core/pipeline/create/README.md @@ -48,7 +48,7 @@ Family tells how should be instance processed and subset what name will publishe : {...}, ... }, - ## Additional data related to instance (`asset`, `task`, etc.) + ## Additional data related to instance (`folderPath`, `task`, etc.) ... } ``` diff --git a/client/ayon_core/plugins/publish/collect_anatomy_instance_data.py b/client/ayon_core/plugins/publish/collect_anatomy_instance_data.py index 763aee5b1c..b33c438233 100644 --- a/client/ayon_core/plugins/publish/collect_anatomy_instance_data.py +++ b/client/ayon_core/plugins/publish/collect_anatomy_instance_data.py @@ -3,7 +3,7 @@ Requires: context -> anatomyData context -> projectEntity context -> assetEntity - instance -> asset + instance -> folderPath instance -> subset instance -> family From 4ab0591047f1b6c9029adc739eb1989b4e9bc850 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Fri, 16 Feb 2024 16:08:52 +0100 Subject: [PATCH 42/58] fix used key in collect current context --- client/ayon_core/plugins/publish/collect_current_context.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/plugins/publish/collect_current_context.py b/client/ayon_core/plugins/publish/collect_current_context.py index 6a22daa04a..418ca8eff6 100644 --- a/client/ayon_core/plugins/publish/collect_current_context.py +++ b/client/ayon_core/plugins/publish/collect_current_context.py @@ -44,6 +44,6 @@ class CollectCurrentContext(pyblish.api.ContextPlugin): "Task: {task_name}" ).format( project_name=context.data["projectName"], - asset_name=context.data["asset"], + asset_name=context.data["folderPath"], task_name=context.data["task"] )) From f5fb7308e0cafdb3f5d9af538cf9bb93cf1707f1 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Fri, 16 Feb 2024 17:13:21 +0100 Subject: [PATCH 43/58] use 'folderPath' in hosts --- .../hosts/aftereffects/plugins/publish/collect_render.py | 6 +++--- .../hosts/aftereffects/plugins/publish/collect_workfile.py | 4 ++-- .../plugins/publish/validate_instance_asset.py | 4 ++-- .../hosts/blender/plugins/create/create_action.py | 4 +++- .../plugins/publish/collect_celaction_instances.py | 2 +- .../hosts/flame/plugins/publish/collect_timeline_otio.py | 4 ++-- .../flame/plugins/publish/extract_subset_resources.py | 4 ++-- .../hosts/flame/plugins/publish/integrate_batch_group.py | 4 ++-- .../hosts/fusion/plugins/publish/collect_render.py | 2 +- .../hosts/fusion/plugins/publish/extract_render_local.py | 2 +- .../fusion/plugins/publish/validate_unique_subsets.py | 4 +++- .../hosts/harmony/plugins/publish/collect_farm_render.py | 4 ++-- .../hosts/harmony/plugins/publish/collect_palettes.py | 4 ++-- .../hosts/harmony/plugins/publish/collect_workfile.py | 2 +- .../hosts/harmony/plugins/publish/validate_instances.py | 5 +++-- .../hosts/hiero/plugins/publish/collect_clip_effects.py | 4 ++-- .../hiero/plugins/publish/collect_frame_tag_instances.py | 6 +++--- .../hosts/hiero/plugins/publish/extract_clip_effects.py | 2 +- .../hosts/hiero/plugins/publish/precollect_instances.py | 7 +++---- .../hosts/hiero/plugins/publish/precollect_workfile.py | 2 +- .../hosts/houdini/plugins/publish/collect_instances.py | 2 +- .../ayon_core/hosts/max/plugins/publish/collect_render.py | 2 +- .../hosts/max/plugins/publish/collect_workfile.py | 2 +- client/ayon_core/hosts/maya/api/action.py | 4 ++-- .../hosts/maya/plugins/publish/validate_model_name.py | 4 ++-- .../hosts/nuke/plugins/publish/validate_asset_context.py | 6 +++--- client/ayon_core/hosts/photoshop/api/ws_stub.py | 4 ++-- .../hosts/photoshop/plugins/publish/collect_auto_image.py | 4 ++-- .../hosts/photoshop/plugins/publish/collect_auto_review.py | 4 ++-- .../photoshop/plugins/publish/collect_auto_workfile.py | 4 ++-- .../hosts/photoshop/plugins/publish/collect_batch_data.py | 4 ++-- .../plugins/publish/collect_color_coded_instances.py | 4 ++-- .../photoshop/plugins/publish/validate_instance_asset.py | 4 ++-- client/ayon_core/hosts/resolve/api/lib.py | 2 +- .../hosts/resolve/plugins/publish/precollect_instances.py | 6 +++--- .../hosts/resolve/plugins/publish/precollect_workfile.py | 2 +- .../plugins/publish/collect_textureset_images.py | 4 ++-- .../hosts/tvpaint/plugins/publish/collect_workfile_data.py | 4 ++-- .../hosts/tvpaint/plugins/publish/validate_asset_name.py | 6 +++--- .../unreal/plugins/publish/collect_render_instances.py | 2 +- 40 files changed, 77 insertions(+), 73 deletions(-) diff --git a/client/ayon_core/hosts/aftereffects/plugins/publish/collect_render.py b/client/ayon_core/hosts/aftereffects/plugins/publish/collect_render.py index a8a316ea80..32e3b4f3c3 100644 --- a/client/ayon_core/hosts/aftereffects/plugins/publish/collect_render.py +++ b/client/ayon_core/hosts/aftereffects/plugins/publish/collect_render.py @@ -98,7 +98,7 @@ class CollectAERender(publish.AbstractCollectRender): source=current_file, label="{} - {}".format(subset_name, family), subset=subset_name, - asset=inst.data["asset"], + folderPath=inst.data["folderPath"], task=task_name, attachTo=False, setMembers='', @@ -175,7 +175,7 @@ class CollectAERender(publish.AbstractCollectRender): version_str = "v{:03d}".format(render_instance.version) if "#" not in file_name: # single frame (mov)W path = os.path.join(base_dir, "{}_{}_{}.{}".format( - render_instance.asset, + render_instance.folderPath, render_instance.subset, version_str, ext @@ -184,7 +184,7 @@ class CollectAERender(publish.AbstractCollectRender): else: for frame in range(start, end + 1): path = os.path.join(base_dir, "{}_{}_{}.{}.{}".format( - render_instance.asset, + render_instance.folderPath, render_instance.subset, version_str, str(frame).zfill(self.padding_width), diff --git a/client/ayon_core/hosts/aftereffects/plugins/publish/collect_workfile.py b/client/ayon_core/hosts/aftereffects/plugins/publish/collect_workfile.py index 538d646ab4..107643f56c 100644 --- a/client/ayon_core/hosts/aftereffects/plugins/publish/collect_workfile.py +++ b/client/ayon_core/hosts/aftereffects/plugins/publish/collect_workfile.py @@ -50,11 +50,11 @@ class CollectWorkfile(pyblish.api.ContextPlugin): asset_entity = context.data["assetEntity"] project_entity = context.data["projectEntity"] - asset_name = get_asset_name_identifier(asset_entity) + folder_path = get_asset_name_identifier(asset_entity) instance_data = { "active": True, - "asset": asset_name, + "folderPath": folder_path, "task": task, "frameStart": context.data['frameStart'], "frameEnd": context.data['frameEnd'], diff --git a/client/ayon_core/hosts/aftereffects/plugins/publish/validate_instance_asset.py b/client/ayon_core/hosts/aftereffects/plugins/publish/validate_instance_asset.py index c3938ecbda..e8f2e29a2f 100644 --- a/client/ayon_core/hosts/aftereffects/plugins/publish/validate_instance_asset.py +++ b/client/ayon_core/hosts/aftereffects/plugins/publish/validate_instance_asset.py @@ -30,7 +30,7 @@ class ValidateInstanceAssetRepair(pyblish.api.Action): for instance in instances: data = stub.read(instance[0]) - data["asset"] = get_current_asset_name() + data["folderPath"] = get_current_asset_name() stub.imprint(instance[0].instance_id, data) @@ -53,7 +53,7 @@ class ValidateInstanceAsset(pyblish.api.InstancePlugin): order = ValidateContentsOrder def process(self, instance): - instance_asset = instance.data["asset"] + instance_asset = instance.data["folderPath"] current_asset = get_current_asset_name() msg = ( f"Instance asset {instance_asset} is not the same " diff --git a/client/ayon_core/hosts/blender/plugins/create/create_action.py b/client/ayon_core/hosts/blender/plugins/create/create_action.py index 2331daf7b7..82047fb5c6 100644 --- a/client/ayon_core/hosts/blender/plugins/create/create_action.py +++ b/client/ayon_core/hosts/blender/plugins/create/create_action.py @@ -22,7 +22,9 @@ class CreateAction(plugin.BaseCreator): ) # Get instance name - name = plugin.prepare_scene_name(instance_data["asset"], subset_name) + name = plugin.prepare_scene_name( + instance_data["folderPath"], subset_name + ) if pre_create_data.get("use_selection"): for obj in lib.get_selection(): diff --git a/client/ayon_core/hosts/celaction/plugins/publish/collect_celaction_instances.py b/client/ayon_core/hosts/celaction/plugins/publish/collect_celaction_instances.py index d0f4c59290..ef471dbd05 100644 --- a/client/ayon_core/hosts/celaction/plugins/publish/collect_celaction_instances.py +++ b/client/ayon_core/hosts/celaction/plugins/publish/collect_celaction_instances.py @@ -22,7 +22,7 @@ class CollectCelactionInstances(pyblish.api.ContextPlugin): asset_name = get_asset_name_identifier(asset_entity) shared_instance_data = { - "asset": asset_name, + "folderPath": asset_name, "frameStart": asset_entity["data"]["frameStart"], "frameEnd": asset_entity["data"]["frameEnd"], "handleStart": asset_entity["data"]["handleStart"], diff --git a/client/ayon_core/hosts/flame/plugins/publish/collect_timeline_otio.py b/client/ayon_core/hosts/flame/plugins/publish/collect_timeline_otio.py index 6a3e99aa55..2fcfb55e7c 100644 --- a/client/ayon_core/hosts/flame/plugins/publish/collect_timeline_otio.py +++ b/client/ayon_core/hosts/flame/plugins/publish/collect_timeline_otio.py @@ -34,7 +34,7 @@ class CollecTimelineOTIO(pyblish.api.ContextPlugin): project_settings=context.data["project_settings"] ) - asset_name = get_asset_name_identifier(asset_doc) + folder_path = get_asset_name_identifier(asset_doc) # adding otio timeline to context with opfapi.maintained_segment_selection(sequence) as selected_seg: @@ -42,7 +42,7 @@ class CollecTimelineOTIO(pyblish.api.ContextPlugin): instance_data = { "name": subset_name, - "asset": asset_name, + "folderPath": folder_path, "subset": subset_name, "family": "workfile", "families": [] diff --git a/client/ayon_core/hosts/flame/plugins/publish/extract_subset_resources.py b/client/ayon_core/hosts/flame/plugins/publish/extract_subset_resources.py index 9e55dbce96..cae08cd76b 100644 --- a/client/ayon_core/hosts/flame/plugins/publish/extract_subset_resources.py +++ b/client/ayon_core/hosts/flame/plugins/publish/extract_subset_resources.py @@ -55,7 +55,7 @@ class ExtractProductResources(publish.Extractor): # flame objects segment = instance.data["item"] - asset_name = instance.data["asset"] + folder_path = instance.data["folderPath"] segment_name = segment.name.get_value() clip_path = instance.data["path"] sequence_clip = instance.context.data["flameSequence"] @@ -249,7 +249,7 @@ class ExtractProductResources(publish.Extractor): out_mark = in_mark + source_duration_handles exporting_clip = self.import_clip(clip_path) exporting_clip.name.set_value("{}_{}".format( - asset_name, segment_name)) + folder_path, segment_name)) # add xml tags modifications modify_xml_data.update({ diff --git a/client/ayon_core/hosts/flame/plugins/publish/integrate_batch_group.py b/client/ayon_core/hosts/flame/plugins/publish/integrate_batch_group.py index 3458bd3002..e36d2a22d5 100644 --- a/client/ayon_core/hosts/flame/plugins/publish/integrate_batch_group.py +++ b/client/ayon_core/hosts/flame/plugins/publish/integrate_batch_group.py @@ -168,10 +168,10 @@ class IntegrateBatchGroup(pyblish.api.InstancePlugin): handle_start = instance.data["handleStart"] handle_end = instance.data["handleEnd"] frame_duration = (frame_end - frame_start) + 1 - asset_name = instance.data["asset"] + folder_path = instance.data["folderPath"] task_name = task_data["name"] - batchgroup_name = "{}_{}".format(asset_name, task_name) + batchgroup_name = "{}_{}".format(folder_path, task_name) batch_data = { "shematic_reels": [ diff --git a/client/ayon_core/hosts/fusion/plugins/publish/collect_render.py b/client/ayon_core/hosts/fusion/plugins/publish/collect_render.py index f8870da1c5..0a0e4b38af 100644 --- a/client/ayon_core/hosts/fusion/plugins/publish/collect_render.py +++ b/client/ayon_core/hosts/fusion/plugins/publish/collect_render.py @@ -68,7 +68,7 @@ class CollectFusionRender( source=current_file, label=inst.data["label"], subset=subset_name, - asset=inst.data["asset"], + folderPath=inst.data["folderPath"], task=task_name, attachTo=False, setMembers='', diff --git a/client/ayon_core/hosts/fusion/plugins/publish/extract_render_local.py b/client/ayon_core/hosts/fusion/plugins/publish/extract_render_local.py index eea232ac29..23a8cdb8a0 100644 --- a/client/ayon_core/hosts/fusion/plugins/publish/extract_render_local.py +++ b/client/ayon_core/hosts/fusion/plugins/publish/extract_render_local.py @@ -72,7 +72,7 @@ class FusionRenderLocal( self.log.info( "Rendered '{nm}' for asset '{ast}' under the task '{tsk}'".format( nm=instance.data["name"], - ast=instance.data["asset"], + ast=instance.data["folderPath"], tsk=instance.data["task"], ) ) diff --git a/client/ayon_core/hosts/fusion/plugins/publish/validate_unique_subsets.py b/client/ayon_core/hosts/fusion/plugins/publish/validate_unique_subsets.py index 619b52077e..3131400de9 100644 --- a/client/ayon_core/hosts/fusion/plugins/publish/validate_unique_subsets.py +++ b/client/ayon_core/hosts/fusion/plugins/publish/validate_unique_subsets.py @@ -21,7 +21,9 @@ class ValidateUniqueSubsets(pyblish.api.ContextPlugin): # Collect instances per subset per asset instances_per_subset_asset = defaultdict(lambda: defaultdict(list)) for instance in context: - asset = instance.data.get("asset", context.data.get("asset")) + asset = instance.data.get( + "folderPath", context.data.get("folderPath") + ) subset = instance.data.get("subset", context.data.get("subset")) instances_per_subset_asset[asset][subset].append(instance) diff --git a/client/ayon_core/hosts/harmony/plugins/publish/collect_farm_render.py b/client/ayon_core/hosts/harmony/plugins/publish/collect_farm_render.py index faeff7bddd..6a9c349185 100644 --- a/client/ayon_core/hosts/harmony/plugins/publish/collect_farm_render.py +++ b/client/ayon_core/hosts/harmony/plugins/publish/collect_farm_render.py @@ -98,7 +98,7 @@ class CollectFarmRender(publish.AbstractCollectRender): self_name = self.__class__.__name__ - asset_name = context.data["asset"] + folder_path = context.data["folderPath"] for node in context.data["allNodes"]: data = harmony.read(node) @@ -142,7 +142,7 @@ class CollectFarmRender(publish.AbstractCollectRender): source=context.data["currentFile"], label=node.split("/")[1], subset=subset_name, - asset=asset_name, + folderPath=folder_path, task=task_name, attachTo=False, setMembers=[node], diff --git a/client/ayon_core/hosts/harmony/plugins/publish/collect_palettes.py b/client/ayon_core/hosts/harmony/plugins/publish/collect_palettes.py index 9343fab86d..66b1ee6085 100644 --- a/client/ayon_core/hosts/harmony/plugins/publish/collect_palettes.py +++ b/client/ayon_core/hosts/harmony/plugins/publish/collect_palettes.py @@ -31,7 +31,7 @@ class CollectPalettes(pyblish.api.ContextPlugin): if (not any([re.search(pattern, task_name) for pattern in self.allowed_tasks])): return - asset_name = context.data["asset"] + folder_path = context.data["folderPath"] for name, id in palettes.items(): instance = context.create_instance(name) @@ -39,7 +39,7 @@ class CollectPalettes(pyblish.api.ContextPlugin): "id": id, "family": "harmony.palette", 'families': [], - "asset": asset_name, + "folderPath": folder_path, "subset": "{}{}".format("palette", name) }) self.log.info( diff --git a/client/ayon_core/hosts/harmony/plugins/publish/collect_workfile.py b/client/ayon_core/hosts/harmony/plugins/publish/collect_workfile.py index 4be2a0fc26..1ea1f15124 100644 --- a/client/ayon_core/hosts/harmony/plugins/publish/collect_workfile.py +++ b/client/ayon_core/hosts/harmony/plugins/publish/collect_workfile.py @@ -36,5 +36,5 @@ class CollectWorkfile(pyblish.api.ContextPlugin): "family": family, "families": [family], "representations": [], - "asset": context.data["asset"] + "folderPath": context.data["folderPath"] }) diff --git a/client/ayon_core/hosts/harmony/plugins/publish/validate_instances.py b/client/ayon_core/hosts/harmony/plugins/publish/validate_instances.py index a57a863d6f..fdba834de6 100644 --- a/client/ayon_core/hosts/harmony/plugins/publish/validate_instances.py +++ b/client/ayon_core/hosts/harmony/plugins/publish/validate_instances.py @@ -27,9 +27,10 @@ class ValidateInstanceRepair(pyblish.api.Action): # Apply pyblish.logic to get the instances for the plug-in instances = pyblish.api.instances_by_plugin(failed, plugin) + folder_path = get_current_asset_name() for instance in instances: data = harmony.read(instance.data["setMembers"][0]) - data["asset"] = get_current_asset_name() + data["folderPath"] = folder_path harmony.imprint(instance.data["setMembers"][0], data) @@ -42,7 +43,7 @@ class ValidateInstance(pyblish.api.InstancePlugin): order = ValidateContentsOrder def process(self, instance): - instance_asset = instance.data["asset"] + instance_asset = instance.data["folderPath"] current_asset = get_current_asset_name() msg = ( "Instance asset is not the same as current asset:" diff --git a/client/ayon_core/hosts/hiero/plugins/publish/collect_clip_effects.py b/client/ayon_core/hosts/hiero/plugins/publish/collect_clip_effects.py index d7f646ebc9..3bd5b88942 100644 --- a/client/ayon_core/hosts/hiero/plugins/publish/collect_clip_effects.py +++ b/client/ayon_core/hosts/hiero/plugins/publish/collect_clip_effects.py @@ -118,9 +118,9 @@ class CollectClipEffects(pyblish.api.InstancePlugin): data["subset"] = name data["family"] = family data["families"] = [family] - data["name"] = data["subset"] + "_" + data["asset"] + data["name"] = data["subset"] + "_" + data["folderPath"] data["label"] = "{} - {}".format( - data['asset'], data["subset"] + data["folderPath"], data["subset"] ) data["effects"] = effects diff --git a/client/ayon_core/hosts/hiero/plugins/publish/collect_frame_tag_instances.py b/client/ayon_core/hosts/hiero/plugins/publish/collect_frame_tag_instances.py index b981d89eef..6f99e6be29 100644 --- a/client/ayon_core/hosts/hiero/plugins/publish/collect_frame_tag_instances.py +++ b/client/ayon_core/hosts/hiero/plugins/publish/collect_frame_tag_instances.py @@ -102,7 +102,7 @@ class CollectFrameTagInstances(pyblish.api.ContextPlugin): # first collect all available subset tag frames subset_data = {} context_asset_doc = context.data["assetEntity"] - context_asset_name = get_asset_name_identifier(context_asset_doc) + context_folder_path = get_asset_name_identifier(context_asset_doc) for tag_data in sequence_tags: frame = int(tag_data["start"]) @@ -120,7 +120,7 @@ class CollectFrameTagInstances(pyblish.api.ContextPlugin): subset_data[subset] = { "frames": [frame], "format": tag_data["format"], - "asset": context_asset_name + "folderPath": context_folder_path } return subset_data @@ -133,7 +133,7 @@ class CollectFrameTagInstances(pyblish.api.ContextPlugin): "label": "{} {}".format(name, subset_data["frames"]), "family": "image", "families": ["frame"], - "asset": subset_data["asset"], + "folderPath": subset_data["folderPath"], "subset": name, "format": subset_data["format"], "frames": subset_data["frames"] diff --git a/client/ayon_core/hosts/hiero/plugins/publish/extract_clip_effects.py b/client/ayon_core/hosts/hiero/plugins/publish/extract_clip_effects.py index afff41fc74..d1edfed0d7 100644 --- a/client/ayon_core/hosts/hiero/plugins/publish/extract_clip_effects.py +++ b/client/ayon_core/hosts/hiero/plugins/publish/extract_clip_effects.py @@ -57,7 +57,7 @@ class ExtractClipEffects(publish.Extractor): "sourceStart", "sourceStartH", "sourceEnd", "sourceEndH", "frameStart", "frameEnd", "clipIn", "clipOut", "clipInH", "clipOutH", - "asset", "version" + "folderPath", "version" ] # pass data to version diff --git a/client/ayon_core/hosts/hiero/plugins/publish/precollect_instances.py b/client/ayon_core/hosts/hiero/plugins/publish/precollect_instances.py index e41ca74320..4142d2f403 100644 --- a/client/ayon_core/hosts/hiero/plugins/publish/precollect_instances.py +++ b/client/ayon_core/hosts/hiero/plugins/publish/precollect_instances.py @@ -98,7 +98,7 @@ class PrecollectInstances(pyblish.api.ContextPlugin): data.update({ "name": "{}_{}".format(asset, subset), "label": label, - "asset": asset, + "folderPath": asset, "asset_name": asset_name, "item": track_item, "families": families, @@ -189,7 +189,7 @@ class PrecollectInstances(pyblish.api.ContextPlugin): if not hierarchy_data: return - asset = data["asset"] + asset = data["folderPath"] asset_name = data["asset_name"] # insert family into families @@ -241,7 +241,6 @@ class PrecollectInstances(pyblish.api.ContextPlugin): if not master_layer: return - asset = data.get("asset") item = data.get("item") clip_name = item.name() @@ -249,7 +248,7 @@ class PrecollectInstances(pyblish.api.ContextPlugin): if not self.test_any_audio(item): return - asset = data["asset"] + asset = data["folferPath"] asset_name = data["asset_name"] # insert family into families diff --git a/client/ayon_core/hosts/hiero/plugins/publish/precollect_workfile.py b/client/ayon_core/hosts/hiero/plugins/publish/precollect_workfile.py index e9e2aae653..2925e723b8 100644 --- a/client/ayon_core/hosts/hiero/plugins/publish/precollect_workfile.py +++ b/client/ayon_core/hosts/hiero/plugins/publish/precollect_workfile.py @@ -17,7 +17,7 @@ class PrecollectWorkfile(pyblish.api.ContextPlugin): order = pyblish.api.CollectorOrder - 0.491 def process(self, context): - asset = context.data["asset"] + asset = context.data["folderPath"] asset_name = asset.split("/")[-1] active_timeline = hiero.ui.activeSequence() diff --git a/client/ayon_core/hosts/houdini/plugins/publish/collect_instances.py b/client/ayon_core/hosts/houdini/plugins/publish/collect_instances.py index 2780da95d9..b445397b18 100644 --- a/client/ayon_core/hosts/houdini/plugins/publish/collect_instances.py +++ b/client/ayon_core/hosts/houdini/plugins/publish/collect_instances.py @@ -72,7 +72,7 @@ class CollectInstances(pyblish.api.ContextPlugin): # Create nice name if the instance has a frame range. label = data.get("name", node.name()) - label += " (%s)" % data["asset"] # include asset in name + label += " (%s)" % data["folderPath"] # include folder in name instance = context.create_instance(label) diff --git a/client/ayon_core/hosts/max/plugins/publish/collect_render.py b/client/ayon_core/hosts/max/plugins/publish/collect_render.py index a97e8a154e..66226e24fa 100644 --- a/client/ayon_core/hosts/max/plugins/publish/collect_render.py +++ b/client/ayon_core/hosts/max/plugins/publish/collect_render.py @@ -94,7 +94,7 @@ class CollectRender(pyblish.api.InstancePlugin): renderer = str(renderer_class).split(":")[0] # also need to get the render dir for conversion data = { - "asset": instance.data["asset"], + "folderPath": instance.data["folderPath"], "subset": str(instance.name), "publish": True, "maxversion": str(get_max_version()), diff --git a/client/ayon_core/hosts/max/plugins/publish/collect_workfile.py b/client/ayon_core/hosts/max/plugins/publish/collect_workfile.py index 0eb4bb731e..f5d4ba475d 100644 --- a/client/ayon_core/hosts/max/plugins/publish/collect_workfile.py +++ b/client/ayon_core/hosts/max/plugins/publish/collect_workfile.py @@ -35,7 +35,7 @@ class CollectWorkfile(pyblish.api.ContextPlugin): data.update({ "subset": subset, - "asset": context.data["asset"], + "folderPath": context.data["folderPath"], "label": subset, "publish": True, "family": 'workfile', diff --git a/client/ayon_core/hosts/maya/api/action.py b/client/ayon_core/hosts/maya/api/action.py index 1edca82ee4..4beb1e3e5b 100644 --- a/client/ayon_core/hosts/maya/api/action.py +++ b/client/ayon_core/hosts/maya/api/action.py @@ -15,7 +15,7 @@ class GenerateUUIDsOnInvalidAction(pyblish.api.Action): receive new UUIDs are actually invalid. Requires: - - instance.data["asset"] + - instance.data["folderPath"] """ @@ -78,7 +78,7 @@ class GenerateUUIDsOnInvalidAction(pyblish.api.Action): # should be always available, but kept a way to query it by name. asset_doc = instance.data.get("assetEntity") if not asset_doc: - asset_name = instance.data["asset"] + asset_name = instance.data["folderPath"] project_name = instance.context.data["projectName"] self.log.info(( "Asset is not stored on instance." diff --git a/client/ayon_core/hosts/maya/plugins/publish/validate_model_name.py b/client/ayon_core/hosts/maya/plugins/publish/validate_model_name.py index cf2bbcd77c..673cfd0d29 100644 --- a/client/ayon_core/hosts/maya/plugins/publish/validate_model_name.py +++ b/client/ayon_core/hosts/maya/plugins/publish/validate_model_name.py @@ -67,14 +67,14 @@ class ValidateModelName(pyblish.api.InstancePlugin, r = re.compile(regex) m = r.match(top_group) project_name = instance.context.data["projectName"] - current_asset_name = instance.context.data["asset"] + current_folder_path = instance.context.data["folderPath"] if m is None: cls.log.error("invalid name on: {}".format(top_group)) cls.log.error("name doesn't match regex {}".format(regex)) invalid.append(top_group) else: if "asset" in r.groupindex: - if m.group("asset") != current_asset_name: + if m.group("folderPath") != current_folder_path: cls.log.error("Invalid asset name in top level group.") return top_group if "subset" in r.groupindex: diff --git a/client/ayon_core/hosts/nuke/plugins/publish/validate_asset_context.py b/client/ayon_core/hosts/nuke/plugins/publish/validate_asset_context.py index b4814c6a00..52ef4a58d4 100644 --- a/client/ayon_core/hosts/nuke/plugins/publish/validate_asset_context.py +++ b/client/ayon_core/hosts/nuke/plugins/publish/validate_asset_context.py @@ -23,10 +23,10 @@ class ValidateCorrectAssetContext( current asset (shot). This validator checks if this is so. It is optional so it can be disabled when needed. - Checking `asset` and `task` keys. + Checking `folderPath` and `task` keys. """ order = ValidateContentsOrder - label = "Validate asset context" + label = "Validate Folder context" hosts = ["nuke"] actions = [ RepairAction, @@ -85,7 +85,7 @@ class ValidateCorrectAssetContext( """Get invalid keys from instance data and context data.""" invalid_keys = [] - testing_keys = ["asset", "task"] + testing_keys = ["folderPath", "task"] for _key in testing_keys: if _key not in instance.data: invalid_keys.append(_key) diff --git a/client/ayon_core/hosts/photoshop/api/ws_stub.py b/client/ayon_core/hosts/photoshop/api/ws_stub.py index 42bad05f26..8f9d3a876b 100644 --- a/client/ayon_core/hosts/photoshop/api/ws_stub.py +++ b/client/ayon_core/hosts/photoshop/api/ws_stub.py @@ -120,7 +120,7 @@ class PhotoshopServerStub: "subset":"imageBG", "family":"image", "id":"pyblish.avalon.instance", - "asset":"Town", + "folderPath":"Town", "uuid": "8" }] - for created instances OR @@ -421,7 +421,7 @@ class PhotoshopServerStub: example: {"8":{"active":true,"subset":"imageBG", "family":"image","id":"pyblish.avalon.instance", - "asset":"Town"}} + "folderPath":"Town"}} 8 is layer(group) id - used for deletion, update etc. """ res = self.websocketserver.call(self.client.call('Photoshop.read')) diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_image.py b/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_image.py index 051a3da0a1..479d9139af 100644 --- a/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_image.py +++ b/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_image.py @@ -28,7 +28,7 @@ class CollectAutoImage(pyblish.api.ContextPlugin): task_name = context.data["task"] host_name = context.data["hostName"] asset_doc = context.data["assetEntity"] - asset_name = get_asset_name_identifier(asset_doc) + folder_path = get_asset_name_identifier(asset_doc) auto_creator = proj_settings.get( "photoshop", {}).get( @@ -86,7 +86,7 @@ class CollectAutoImage(pyblish.api.ContextPlugin): instance = context.create_instance(subset_name) instance.data["family"] = family - instance.data["asset"] = asset_name + instance.data["folderPath"] = folder_path instance.data["subset"] = subset_name instance.data["ids"] = publishable_ids instance.data["publish"] = True diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_review.py b/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_review.py index c8d4ddf111..e31508e641 100644 --- a/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_review.py +++ b/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_review.py @@ -67,7 +67,7 @@ class CollectAutoReview(pyblish.api.ContextPlugin): host_name = context.data["hostName"] asset_doc = context.data["assetEntity"] - asset_name = get_asset_name_identifier(asset_doc) + folder_path = get_asset_name_identifier(asset_doc) subset_name = get_subset_name( family, @@ -87,7 +87,7 @@ class CollectAutoReview(pyblish.api.ContextPlugin): "family": family, "families": [], "representations": [], - "asset": asset_name, + "folderPath": folder_path, "publish": self.publish }) diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_workfile.py b/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_workfile.py index 365fd0a684..12fc31a2f2 100644 --- a/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_workfile.py +++ b/client/ayon_core/hosts/photoshop/plugins/publish/collect_auto_workfile.py @@ -71,7 +71,7 @@ class CollectAutoWorkfile(pyblish.api.ContextPlugin): host_name = context.data["hostName"] asset_doc = context.data["assetEntity"] - asset_name = get_asset_name_identifier(asset_doc) + folder_path = get_asset_name_identifier(asset_doc) subset_name = get_subset_name( family, variant, @@ -91,7 +91,7 @@ class CollectAutoWorkfile(pyblish.api.ContextPlugin): "family": family, "families": [], "representations": [], - "asset": asset_name + "folderPath": folder_path }) # creating representation diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/collect_batch_data.py b/client/ayon_core/hosts/photoshop/plugins/publish/collect_batch_data.py index 464b6e3999..a32b5f8fa5 100644 --- a/client/ayon_core/hosts/photoshop/plugins/publish/collect_batch_data.py +++ b/client/ayon_core/hosts/photoshop/plugins/publish/collect_batch_data.py @@ -2,7 +2,7 @@ Provides: context -> Loaded batch file. - - asset + - folderPath - task (task name) - taskType - project_name @@ -71,7 +71,7 @@ class CollectBatchData(pyblish.api.ContextPlugin): os.environ["AYON_FOLDER_PATH"] = asset_name os.environ["AYON_TASK_NAME"] = task_name - context.data["asset"] = asset_name + context.data["folderPath"] = asset_name context.data["task"] = task_name context.data["taskType"] = task_type context.data["project_name"] = project_name diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/collect_color_coded_instances.py b/client/ayon_core/hosts/photoshop/plugins/publish/collect_color_coded_instances.py index 6a09cff3c7..35538279eb 100644 --- a/client/ayon_core/hosts/photoshop/plugins/publish/collect_color_coded_instances.py +++ b/client/ayon_core/hosts/photoshop/plugins/publish/collect_color_coded_instances.py @@ -56,7 +56,7 @@ class CollectColorCodedInstances(pyblish.api.ContextPlugin): existing_subset_names = self._get_existing_subset_names(context) # from CollectBatchData - asset_name = context.data["asset"] + asset_name = context.data["folderPath"] task_name = context.data["task"] variant = context.data["variant"] project_name = context.data["projectEntity"]["name"] @@ -163,7 +163,7 @@ class CollectColorCodedInstances(pyblish.api.ContextPlugin): instance = context.create_instance(layer.name) instance.data["family"] = family instance.data["publish"] = True - instance.data["asset"] = asset + instance.data["folderPath"] = asset instance.data["task"] = task_name instance.data["subset"] = subset instance.data["layer"] = layer diff --git a/client/ayon_core/hosts/photoshop/plugins/publish/validate_instance_asset.py b/client/ayon_core/hosts/photoshop/plugins/publish/validate_instance_asset.py index dc0f2efd52..67a7303316 100644 --- a/client/ayon_core/hosts/photoshop/plugins/publish/validate_instance_asset.py +++ b/client/ayon_core/hosts/photoshop/plugins/publish/validate_instance_asset.py @@ -31,7 +31,7 @@ class ValidateInstanceAssetRepair(pyblish.api.Action): current_asset_name = get_current_asset_name() for instance in instances: data = stub.read(instance[0]) - data["asset"] = current_asset_name + data["folderPath"] = current_asset_name stub.imprint(instance[0], data) @@ -54,7 +54,7 @@ class ValidateInstanceAsset(OptionalPyblishPluginMixin, order = ValidateContentsOrder def process(self, instance): - instance_asset = instance.data["asset"] + instance_asset = instance.data["folderPath"] current_asset = get_current_asset_name() if instance_asset != current_asset: diff --git a/client/ayon_core/hosts/resolve/api/lib.py b/client/ayon_core/hosts/resolve/api/lib.py index 2c648bb4cc..5eb88afdcb 100644 --- a/client/ayon_core/hosts/resolve/api/lib.py +++ b/client/ayon_core/hosts/resolve/api/lib.py @@ -519,7 +519,7 @@ def imprint(timeline_item, data=None): Examples: data = { - 'asset': 'sq020sh0280', + 'folderPath': 'sq020sh0280', 'family': 'render', 'subset': 'subsetMain' } diff --git a/client/ayon_core/hosts/resolve/plugins/publish/precollect_instances.py b/client/ayon_core/hosts/resolve/plugins/publish/precollect_instances.py index 0ae6206496..c288d1bf99 100644 --- a/client/ayon_core/hosts/resolve/plugins/publish/precollect_instances.py +++ b/client/ayon_core/hosts/resolve/plugins/publish/precollect_instances.py @@ -66,7 +66,7 @@ class PrecollectInstances(pyblish.api.ContextPlugin): data.update({ "name": "{}_{}".format(asset, subset), "label": "{} {}".format(asset, subset), - "asset": asset, + "folderPath": asset, "item": timeline_item, "publish": get_publish_attribute(timeline_item), "fps": context.data["fps"], @@ -124,7 +124,7 @@ class PrecollectInstances(pyblish.api.ContextPlugin): if not hierarchy_data: return - asset = data["asset"] + asset = data["folderPath"] subset = "shotMain" # insert family into families @@ -134,7 +134,7 @@ class PrecollectInstances(pyblish.api.ContextPlugin): "name": "{}_{}".format(asset, subset), "label": "{} {}".format(asset, subset), "subset": subset, - "asset": asset, + "folderPath": asset, "family": family, "families": [], "publish": get_publish_attribute(timeline_item) diff --git a/client/ayon_core/hosts/resolve/plugins/publish/precollect_workfile.py b/client/ayon_core/hosts/resolve/plugins/publish/precollect_workfile.py index 5f8cf6b5d9..814b1e159f 100644 --- a/client/ayon_core/hosts/resolve/plugins/publish/precollect_workfile.py +++ b/client/ayon_core/hosts/resolve/plugins/publish/precollect_workfile.py @@ -28,7 +28,7 @@ class PrecollectWorkfile(pyblish.api.ContextPlugin): instance_data = { "name": "{}_{}".format(asset_name, subset), "label": "{} {}".format(current_asset_name, subset), - "asset": current_asset_name, + "folderPath": current_asset_name, "subset": subset, "item": project, "family": "workfile", diff --git a/client/ayon_core/hosts/substancepainter/plugins/publish/collect_textureset_images.py b/client/ayon_core/hosts/substancepainter/plugins/publish/collect_textureset_images.py index b8279c99cd..03e17192d2 100644 --- a/client/ayon_core/hosts/substancepainter/plugins/publish/collect_textureset_images.py +++ b/client/ayon_core/hosts/substancepainter/plugins/publish/collect_textureset_images.py @@ -27,8 +27,8 @@ class CollectTextureSet(pyblish.api.InstancePlugin): config = self.get_export_config(instance) asset_doc = get_asset_by_name( - project_name=instance.context.data["projectName"], - asset_name=instance.data["asset"] + instance.context.data["projectName"], + instance.data["folderPath"] ) instance.data["exportConfig"] = config diff --git a/client/ayon_core/hosts/tvpaint/plugins/publish/collect_workfile_data.py b/client/ayon_core/hosts/tvpaint/plugins/publish/collect_workfile_data.py index a6b6f05dc9..1cf21a1fae 100644 --- a/client/ayon_core/hosts/tvpaint/plugins/publish/collect_workfile_data.py +++ b/client/ayon_core/hosts/tvpaint/plugins/publish/collect_workfile_data.py @@ -65,7 +65,7 @@ class CollectWorkfileData(pyblish.api.ContextPlugin): # Collect and store current context to have reference current_context = { "project_name": context.data["projectName"], - "asset_name": context.data["asset"], + "asset_name": context.data["folderPath"], "task_name": context.data["task"] } self.log.debug("Current context is: {}".format(current_context)) @@ -105,7 +105,7 @@ class CollectWorkfileData(pyblish.api.ContextPlugin): )) # Store context asset name - context.data["asset"] = asset_name + context.data["folderPath"] = asset_name context.data["task"] = task_name self.log.info( "Context is set to Asset: \"{}\" and Task: \"{}\"".format( diff --git a/client/ayon_core/hosts/tvpaint/plugins/publish/validate_asset_name.py b/client/ayon_core/hosts/tvpaint/plugins/publish/validate_asset_name.py index 62603a460b..927d601e34 100644 --- a/client/ayon_core/hosts/tvpaint/plugins/publish/validate_asset_name.py +++ b/client/ayon_core/hosts/tvpaint/plugins/publish/validate_asset_name.py @@ -20,7 +20,7 @@ class FixAssetNames(pyblish.api.Action): on = "failed" def process(self, context, plugin): - context_asset_name = context.data["asset"] + context_asset_name = context.data["folderPath"] old_instance_items = list_instances() new_instance_items = [] for instance_item in old_instance_items: @@ -51,9 +51,9 @@ class ValidateAssetName( def process(self, context): if not self.is_active(context.data): return - context_asset_name = context.data["asset"] + context_asset_name = context.data["folderPath"] for instance in context: - asset_name = instance.data.get("asset") + asset_name = instance.data.get("folderPath") if asset_name and asset_name == context_asset_name: continue diff --git a/client/ayon_core/hosts/unreal/plugins/publish/collect_render_instances.py b/client/ayon_core/hosts/unreal/plugins/publish/collect_render_instances.py index 8641094610..8bbf5a5c62 100644 --- a/client/ayon_core/hosts/unreal/plugins/publish/collect_render_instances.py +++ b/client/ayon_core/hosts/unreal/plugins/publish/collect_render_instances.py @@ -64,7 +64,7 @@ class CollectRenderInstances(pyblish.api.InstancePlugin): new_data = new_instance.data - new_data["asset"] = seq_name + new_data["folderPath"] = seq_name new_data["setMembers"] = seq_name new_data["family"] = "render" new_data["families"] = ["render", "review"] From eaf6e0dfdb192fc2a5833631c4df29fd79347b1e Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Fri, 16 Feb 2024 17:14:53 +0100 Subject: [PATCH 44/58] fix collect anatomy instance data --- .../ayon_core/plugins/publish/collect_anatomy_instance_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/plugins/publish/collect_anatomy_instance_data.py b/client/ayon_core/plugins/publish/collect_anatomy_instance_data.py index b33c438233..f6326bb9e8 100644 --- a/client/ayon_core/plugins/publish/collect_anatomy_instance_data.py +++ b/client/ayon_core/plugins/publish/collect_anatomy_instance_data.py @@ -68,7 +68,7 @@ class CollectAnatomyInstanceData(pyblish.api.ContextPlugin): instances_with_missing_asset_doc = collections.defaultdict(list) for instance in context: instance_asset_doc = instance.data.get("assetEntity") - _asset_name = instance.data["asset"] + _asset_name = instance.data["folderPath"] # There is possibility that assetEntity on instance is already set # which can happen in standalone publisher From 47f51af6e1207d085ca96edb8363a62afc877be0 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Fri, 16 Feb 2024 17:20:08 +0100 Subject: [PATCH 45/58] fix precollect workfile in hiero --- .../hosts/hiero/plugins/publish/precollect_workfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/hosts/hiero/plugins/publish/precollect_workfile.py b/client/ayon_core/hosts/hiero/plugins/publish/precollect_workfile.py index 2925e723b8..15dd0dee26 100644 --- a/client/ayon_core/hosts/hiero/plugins/publish/precollect_workfile.py +++ b/client/ayon_core/hosts/hiero/plugins/publish/precollect_workfile.py @@ -64,7 +64,7 @@ class PrecollectWorkfile(pyblish.api.ContextPlugin): "label": "{} - {}Main".format( asset, family), "name": "{}_{}".format(asset_name, family), - "asset": context.data["asset"], + "folderPath": context.data["folderPath"], # TODO use 'get_subset_name' "subset": "{}{}Main".format(asset_name, family.capitalize()), "item": project, From 2cbbe4b3bcbb5033fbc905691febbf719d12fff8 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Mon, 19 Feb 2024 10:26:40 +0100 Subject: [PATCH 46/58] file maya collectors --- client/ayon_core/hosts/maya/plugins/publish/collect_render.py | 2 +- .../ayon_core/hosts/maya/plugins/publish/collect_vrayscene.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/ayon_core/hosts/maya/plugins/publish/collect_render.py b/client/ayon_core/hosts/maya/plugins/publish/collect_render.py index 4ea91ccb0d..d5392fba4a 100644 --- a/client/ayon_core/hosts/maya/plugins/publish/collect_render.py +++ b/client/ayon_core/hosts/maya/plugins/publish/collect_render.py @@ -307,7 +307,7 @@ class CollectMayaRender(pyblish.api.InstancePlugin): _instance.data["version"] = context.data["version"] # Define nice label - label = "{0} ({1})".format(layer_name, instance.data["asset"]) + label = "{0} ({1})".format(layer_name, instance.data["folderPath"]) label += " [{0}-{1}]".format( int(data["frameStartHandle"]), int(data["frameEndHandle"]) ) diff --git a/client/ayon_core/hosts/maya/plugins/publish/collect_vrayscene.py b/client/ayon_core/hosts/maya/plugins/publish/collect_vrayscene.py index db008cc2be..979f49f7fe 100644 --- a/client/ayon_core/hosts/maya/plugins/publish/collect_vrayscene.py +++ b/client/ayon_core/hosts/maya/plugins/publish/collect_vrayscene.py @@ -99,7 +99,7 @@ class CollectVrayScene(pyblish.api.InstancePlugin): instance.data.update(data) # Define nice label - label = "{0} ({1})".format(layer_name, instance.data["asset"]) + label = "{0} ({1})".format(layer_name, instance.data["folderPath"]) label += " [{0}-{1}]".format( int(data["frameStartHandle"]), int(data["frameEndHandle"]) ) From 9c22294717ae2df2615f4c3baf28d6c3ee561c92 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Mon, 19 Feb 2024 10:28:21 +0100 Subject: [PATCH 47/58] fix another maya plugins --- .../maya/plugins/publish/extract_unreal_skeletalmesh_fbx.py | 2 +- .../maya/plugins/publish/validate_instance_in_context.py | 4 ++-- .../hosts/maya/plugins/publish/validate_shader_name.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/ayon_core/hosts/maya/plugins/publish/extract_unreal_skeletalmesh_fbx.py b/client/ayon_core/hosts/maya/plugins/publish/extract_unreal_skeletalmesh_fbx.py index 7b44c92194..edbb5f845e 100644 --- a/client/ayon_core/hosts/maya/plugins/publish/extract_unreal_skeletalmesh_fbx.py +++ b/client/ayon_core/hosts/maya/plugins/publish/extract_unreal_skeletalmesh_fbx.py @@ -61,7 +61,7 @@ class ExtractUnrealSkeletalMeshFbx(publish.Extractor): # we rely on hierarchy under one root. original_parent = to_extract[0].split("|")[1] - parent_node = instance.data.get("asset") + parent_node = instance.data.get("folderPath") # this needs to be done for AYON # WARNING: since AYON supports duplicity of asset names, # this needs to be refactored throughout the pipeline. diff --git a/client/ayon_core/hosts/maya/plugins/publish/validate_instance_in_context.py b/client/ayon_core/hosts/maya/plugins/publish/validate_instance_in_context.py index c683c1b30f..43b4f06e3f 100644 --- a/client/ayon_core/hosts/maya/plugins/publish/validate_instance_in_context.py +++ b/client/ayon_core/hosts/maya/plugins/publish/validate_instance_in_context.py @@ -37,7 +37,7 @@ class ValidateInstanceInContext(pyblish.api.InstancePlugin, if not self.is_active(instance.data): return - asset = instance.data.get("asset") + asset = instance.data.get("folderPath") context_asset = self.get_context_asset(instance) if asset != context_asset: raise PublishValidationError( @@ -74,4 +74,4 @@ class ValidateInstanceInContext(pyblish.api.InstancePlugin, @staticmethod def get_context_asset(instance): - return instance.context.data["asset"] + return instance.context.data["folderPath"] diff --git a/client/ayon_core/hosts/maya/plugins/publish/validate_shader_name.py b/client/ayon_core/hosts/maya/plugins/publish/validate_shader_name.py index cb7f975535..86ca0ca400 100644 --- a/client/ayon_core/hosts/maya/plugins/publish/validate_shader_name.py +++ b/client/ayon_core/hosts/maya/plugins/publish/validate_shader_name.py @@ -51,7 +51,7 @@ class ValidateShaderName(pyblish.api.InstancePlugin, descendants = cmds.ls(descendants, noIntermediate=True, long=True) shapes = cmds.ls(descendants, type=["nurbsSurface", "mesh"], long=True) - asset_name = instance.data.get("asset") + asset_name = instance.data.get("folderPath") # Check the number of connected shadingEngines per shape regex_compile = re.compile(cls.regex) From 14ba402c164018fe09cab7e20772c103ddd6a78b Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Tue, 20 Feb 2024 11:09:41 +0100 Subject: [PATCH 48/58] fix forgotten places --- .../hosts/houdini/plugins/publish/collect_usd_bootstrap.py | 2 +- .../hosts/houdini/plugins/publish/collect_usd_layers.py | 2 +- .../houdini/plugins/publish/validate_usd_shade_model_exists.py | 2 +- .../traypublisher/plugins/publish/collect_shot_instances.py | 2 +- .../traypublisher/plugins/publish/validate_existing_version.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/client/ayon_core/hosts/houdini/plugins/publish/collect_usd_bootstrap.py b/client/ayon_core/hosts/houdini/plugins/publish/collect_usd_bootstrap.py index ed54ad8bc1..0fb269516c 100644 --- a/client/ayon_core/hosts/houdini/plugins/publish/collect_usd_bootstrap.py +++ b/client/ayon_core/hosts/houdini/plugins/publish/collect_usd_bootstrap.py @@ -55,7 +55,7 @@ class CollectUsdBootstrap(pyblish.api.InstancePlugin): self.log.debug("Add bootstrap for: %s" % bootstrap) project_name = instance.context.data["projectName"] - asset_name = instance.data["asset"] + asset_name = instance.data["folderPath"] asset_doc = get_asset_by_name(project_name, asset_name) assert asset_doc, "Asset must exist: %s" % asset_name diff --git a/client/ayon_core/hosts/houdini/plugins/publish/collect_usd_layers.py b/client/ayon_core/hosts/houdini/plugins/publish/collect_usd_layers.py index e36cd875ba..70dc28e925 100644 --- a/client/ayon_core/hosts/houdini/plugins/publish/collect_usd_layers.py +++ b/client/ayon_core/hosts/houdini/plugins/publish/collect_usd_layers.py @@ -55,7 +55,7 @@ class CollectUsdLayers(pyblish.api.InstancePlugin): layer_inst.data["families"] = [family] layer_inst.data["subset"] = "__stub__" layer_inst.data["label"] = label - layer_inst.data["asset"] = instance.data["asset"] + layer_inst.data["folderPath"] = instance.data["folderPath"] layer_inst.data["instance_node"] = instance.data["instance_node"] # include same USD ROP layer_inst.append(rop_node) diff --git a/client/ayon_core/hosts/houdini/plugins/publish/validate_usd_shade_model_exists.py b/client/ayon_core/hosts/houdini/plugins/publish/validate_usd_shade_model_exists.py index 8fa20ace02..c8b9ed9bab 100644 --- a/client/ayon_core/hosts/houdini/plugins/publish/validate_usd_shade_model_exists.py +++ b/client/ayon_core/hosts/houdini/plugins/publish/validate_usd_shade_model_exists.py @@ -18,7 +18,7 @@ class ValidateUSDShadeModelExists(pyblish.api.InstancePlugin): def process(self, instance): project_name = instance.context.data["projectName"] - asset_name = instance.data["asset"] + asset_name = instance.data["folderPath"] subset = instance.data["subset"] # Assume shading variation starts after a dot separator diff --git a/client/ayon_core/hosts/traypublisher/plugins/publish/collect_shot_instances.py b/client/ayon_core/hosts/traypublisher/plugins/publish/collect_shot_instances.py index b19eb36168..67eb3d425c 100644 --- a/client/ayon_core/hosts/traypublisher/plugins/publish/collect_shot_instances.py +++ b/client/ayon_core/hosts/traypublisher/plugins/publish/collect_shot_instances.py @@ -170,7 +170,7 @@ class CollectShotInstance(pyblish.api.InstancePlugin): parents = instance.data.get('parents', []) # Split by '/' for AYON where asset is a path - asset_name = instance.data["asset"].split("/")[-1] + asset_name = instance.data["folderPath"].split("/")[-1] actual = {asset_name: in_info} for parent in reversed(parents): diff --git a/client/ayon_core/hosts/traypublisher/plugins/publish/validate_existing_version.py b/client/ayon_core/hosts/traypublisher/plugins/publish/validate_existing_version.py index 6a85f92ce1..b75ae674e8 100644 --- a/client/ayon_core/hosts/traypublisher/plugins/publish/validate_existing_version.py +++ b/client/ayon_core/hosts/traypublisher/plugins/publish/validate_existing_version.py @@ -40,7 +40,7 @@ class ValidateExistingVersion( formatting_data = { "subset_name": subset_name, - "asset_name": instance.data["asset"], + "asset_name": instance.data["folderPath"], "version": version } raise PublishXmlValidationError( From 43485cc64abc348e51321725de577daf5627df9f Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Tue, 20 Feb 2024 11:29:20 +0100 Subject: [PATCH 49/58] fix extract usd layered --- .../hosts/houdini/plugins/publish/extract_usd_layered.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/hosts/houdini/plugins/publish/extract_usd_layered.py b/client/ayon_core/hosts/houdini/plugins/publish/extract_usd_layered.py index 7160e3d282..56c335f50e 100644 --- a/client/ayon_core/hosts/houdini/plugins/publish/extract_usd_layered.py +++ b/client/ayon_core/hosts/houdini/plugins/publish/extract_usd_layered.py @@ -285,7 +285,7 @@ class ExtractUSDLayered(publish.Extractor): # to detect whether we should make this into a new publish # version. If not, skip it. asset = get_asset_by_name( - project_name, dependency.data["asset"], fields=["_id"] + project_name, dependency.data["folderPath"], fields=["_id"] ) subset = get_subset_by_name( project_name, From 1b153953113c6eb8378da508ac38f9451d63556e Mon Sep 17 00:00:00 2001 From: Kayla Man Date: Tue, 20 Feb 2024 18:54:38 +0800 Subject: [PATCH 50/58] change on the identifier in regards to the ayon and move the collector of current file to lower priority for collecting the data --- client/ayon_core/hosts/max/plugins/create/create_workfile.py | 2 +- .../ayon_core/hosts/max/plugins/publish/collect_current_file.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/ayon_core/hosts/max/plugins/create/create_workfile.py b/client/ayon_core/hosts/max/plugins/create/create_workfile.py index ce4d8b976d..27864c28d5 100644 --- a/client/ayon_core/hosts/max/plugins/create/create_workfile.py +++ b/client/ayon_core/hosts/max/plugins/create/create_workfile.py @@ -9,7 +9,7 @@ from pymxs import runtime as rt class CreateWorkfile(plugin.MaxCreatorBase, AutoCreator): """Workfile auto-creator.""" - identifier = "io.openpype.creators.max.workfile" + identifier = "io.ayon.creators.max.workfile" label = "Workfile" family = "workfile" icon = "fa5.file" diff --git a/client/ayon_core/hosts/max/plugins/publish/collect_current_file.py b/client/ayon_core/hosts/max/plugins/publish/collect_current_file.py index 689a357c53..6f8b8dda4b 100644 --- a/client/ayon_core/hosts/max/plugins/publish/collect_current_file.py +++ b/client/ayon_core/hosts/max/plugins/publish/collect_current_file.py @@ -7,7 +7,7 @@ from pymxs import runtime as rt class CollectCurrentFile(pyblish.api.ContextPlugin): """Inject the current working file.""" - order = pyblish.api.CollectorOrder - 0.4 + order = pyblish.api.CollectorOrder - 0.5 label = "Max Current File" hosts = ['max'] From ce6fc93d486730da3391c750742c039324f301b3 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Tue, 20 Feb 2024 14:04:26 +0100 Subject: [PATCH 51/58] fix collect usd bootstrap --- .../hosts/houdini/plugins/publish/collect_usd_bootstrap.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/ayon_core/hosts/houdini/plugins/publish/collect_usd_bootstrap.py b/client/ayon_core/hosts/houdini/plugins/publish/collect_usd_bootstrap.py index c43ff4f442..791b530eed 100644 --- a/client/ayon_core/hosts/houdini/plugins/publish/collect_usd_bootstrap.py +++ b/client/ayon_core/hosts/houdini/plugins/publish/collect_usd_bootstrap.py @@ -95,7 +95,7 @@ class CollectUsdBootstrap(pyblish.api.InstancePlugin): new.data["optional"] = False # Copy some data from the instance for which we bootstrap - for key in ["asset"]: + for key in ["folderPath"]: new.data[key] = instance.data[key] def _subset_exists(self, project_name, instance, subset_name, asset_doc): @@ -107,7 +107,7 @@ class CollectUsdBootstrap(pyblish.api.InstancePlugin): for inst in context: if ( inst.data["subset"] == subset_name - and inst.data["asset"] == asset_doc_name + and inst.data["folderPath"] == asset_doc_name ): return True From 522e1b1095d1f152a4db95de915be45d9eba0ee0 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Tue, 20 Feb 2024 14:11:10 +0100 Subject: [PATCH 52/58] fix extract hierarchy to ayon --- client/ayon_core/plugins/publish/extract_hierarchy_to_ayon.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 26e448cc6e..7ceaf7d2ad 100644 --- a/client/ayon_core/plugins/publish/extract_hierarchy_to_ayon.py +++ b/client/ayon_core/plugins/publish/extract_hierarchy_to_ayon.py @@ -189,7 +189,7 @@ class ExtractHierarchyToAYON(pyblish.api.ContextPlugin): active_folder_paths = set() for instance in context: if instance.data.get("publish") is not False: - active_folder_paths.add(instance.data.get("asset")) + active_folder_paths.add(instance.data.get("folderPath")) active_folder_paths.discard(None) From 229bd07396f8f59fa70d7285aae71c50377b4fe3 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Tue, 20 Feb 2024 14:11:31 +0100 Subject: [PATCH 53/58] fix 'get_last_versions_for_instances' --- client/ayon_core/pipeline/create/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/pipeline/create/utils.py b/client/ayon_core/pipeline/create/utils.py index 0547c20c0a..c2655f319f 100644 --- a/client/ayon_core/pipeline/create/utils.py +++ b/client/ayon_core/pipeline/create/utils.py @@ -32,7 +32,7 @@ def get_last_versions_for_instances( subset_names_by_asset_name = collections.defaultdict(set) instances_by_hierarchy = {} for instance in instances: - asset_name = instance.data.get("asset") + asset_name = instance.data.get("folderPath") subset_name = instance.subset_name if not asset_name or not subset_name: if use_value_for_missing: From e145b3347666bb4815147d135118a335e5837727 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Tue, 20 Feb 2024 15:04:20 +0100 Subject: [PATCH 54/58] Fix typo in data key and update variable name. - Corrected a typo in a data key from "folferPath" to "folderPath". - Updated the variable name from "asset" to "asset_name". --- .../hosts/hiero/plugins/publish/precollect_instances.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/hosts/hiero/plugins/publish/precollect_instances.py b/client/ayon_core/hosts/hiero/plugins/publish/precollect_instances.py index 4142d2f403..e97059edf6 100644 --- a/client/ayon_core/hosts/hiero/plugins/publish/precollect_instances.py +++ b/client/ayon_core/hosts/hiero/plugins/publish/precollect_instances.py @@ -248,7 +248,7 @@ class PrecollectInstances(pyblish.api.ContextPlugin): if not self.test_any_audio(item): return - asset = data["folferPath"] + asset = data["folderPath"] asset_name = data["asset_name"] # insert family into families From ebfa5a2f3b79f367fe6c8079043e322dfd2f841b Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Tue, 20 Feb 2024 17:02:42 +0100 Subject: [PATCH 55/58] fix traypublisher editorial --- .../hosts/traypublisher/plugins/create/create_online.py | 2 +- .../traypublisher/plugins/publish/collect_shot_instances.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/ayon_core/hosts/traypublisher/plugins/create/create_online.py b/client/ayon_core/hosts/traypublisher/plugins/create/create_online.py index db11d30afe..36d2fba976 100644 --- a/client/ayon_core/hosts/traypublisher/plugins/create/create_online.py +++ b/client/ayon_core/hosts/traypublisher/plugins/create/create_online.py @@ -53,7 +53,7 @@ class OnlineCreator(TrayPublishCreator): # disable check for existing subset with the same name """ asset = get_asset_by_name( - self.project_name, instance_data["asset"], fields=["_id"]) + self.project_name, instance_data["folderPath"], fields=["_id"]) if get_subset_by_name( self.project_name, origin_basename, asset["_id"], diff --git a/client/ayon_core/hosts/traypublisher/plugins/publish/collect_shot_instances.py b/client/ayon_core/hosts/traypublisher/plugins/publish/collect_shot_instances.py index 67eb3d425c..d489528c57 100644 --- a/client/ayon_core/hosts/traypublisher/plugins/publish/collect_shot_instances.py +++ b/client/ayon_core/hosts/traypublisher/plugins/publish/collect_shot_instances.py @@ -17,7 +17,7 @@ class CollectShotInstance(pyblish.api.InstancePlugin): families = ["shot"] SHARED_KEYS = [ - "asset", + "folderPath", "fps", "handleStart", "handleEnd", @@ -132,7 +132,7 @@ class CollectShotInstance(pyblish.api.InstancePlugin): "sourceIn": _cr_attrs["sourceIn"], "sourceOut": _cr_attrs["sourceOut"], "workfileFrameStart": workfile_start_frame, - "asset": _cr_attrs["folderPath"], + "folderPath": _cr_attrs["folderPath"], } def _solve_hierarchy_context(self, instance): From 7e78937e31b39c9d690d7b6573d8aa0860986ee1 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Wed, 21 Feb 2024 10:38:21 +0100 Subject: [PATCH 56/58] fix 'update_content_on_context_change' in maya --- client/ayon_core/hosts/maya/api/lib.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/client/ayon_core/hosts/maya/api/lib.py b/client/ayon_core/hosts/maya/api/lib.py index 3a29fe433b..e2e985396b 100644 --- a/client/ayon_core/hosts/maya/api/lib.py +++ b/client/ayon_core/hosts/maya/api/lib.py @@ -24,7 +24,8 @@ from ayon_core.client import ( get_asset_by_name, get_subsets, get_last_versions, - get_representation_by_name + get_representation_by_name, + get_asset_name_identifier, ) from ayon_core.settings import get_project_settings from ayon_core.pipeline import ( @@ -3143,21 +3144,25 @@ def fix_incompatible_containers(): def update_content_on_context_change(): """ - This will update scene content to match new asset on context change + This will update scene content to match new folder on context change """ scene_sets = cmds.listSets(allSets=True) asset_doc = get_current_project_asset() - new_asset = asset_doc["name"] + new_folder_path = get_asset_name_identifier(asset_doc) new_data = asset_doc["data"] for s in scene_sets: try: if cmds.getAttr("{}.id".format(s)) == "pyblish.avalon.instance": attr = cmds.listAttr(s) print(s) - if "asset" in attr: - print(" - setting asset to: [ {} ]".format(new_asset)) - cmds.setAttr("{}.asset".format(s), - new_asset, type="string") + if "folderPath" in attr: + print( + " - setting folder to: [ {} ]".format(new_folder_path) + ) + cmds.setAttr( + "{}.folderPath".format(s), + new_folder_path, type="string" + ) if "frameStart" in attr: cmds.setAttr("{}.frameStart".format(s), new_data["frameStart"]) From c1e528e134c85667c075ef3a211d6bb07b3f9cc2 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Wed, 21 Feb 2024 12:06:41 +0100 Subject: [PATCH 57/58] Remove pushing OPENPYPE_VERSION That env var doesn't make sense in Ayon. --- .../publish/create_publish_royalrender_job.py | 25 +------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/client/ayon_core/modules/royalrender/plugins/publish/create_publish_royalrender_job.py b/client/ayon_core/modules/royalrender/plugins/publish/create_publish_royalrender_job.py index 910abfcb15..90eab2e675 100644 --- a/client/ayon_core/modules/royalrender/plugins/publish/create_publish_royalrender_job.py +++ b/client/ayon_core/modules/royalrender/plugins/publish/create_publish_royalrender_job.py @@ -216,7 +216,7 @@ class CreatePublishRoyalRenderJob(pyblish.api.InstancePlugin, SeqEnd=1, SeqStep=1, SeqFileOffset=0, - Version=self._sanitize_version(os.environ.get("OPENPYPE_VERSION")), + Version=os.environ["AYON_BUNDLE_NAME"], SceneName=abs_metadata_path, # command line arguments CustomAddCmdFlags=" ".join(args), @@ -243,26 +243,3 @@ class CreatePublishRoyalRenderJob(pyblish.api.InstancePlugin, job.WaitForPreIDs += jobs_pre_ids return job - - def _sanitize_version(self, version): - """Returns version in format MAJOR.MINORPATCH - - 3.15.7-nightly.2 >> 3.157 - """ - VERSION_REGEX = re.compile( - r"(?P0|[1-9]\d*)" - r"\.(?P0|[1-9]\d*)" - r"\.(?P0|[1-9]\d*)" - r"(?:-(?P[a-zA-Z\d\-.]*))?" - r"(?:\+(?P[a-zA-Z\d\-.]*))?" - ) - - valid_parts = VERSION_REGEX.findall(version) - if len(valid_parts) != 1: - # Return invalid version with filled 'origin' attribute - return version - - # Unpack found version - major, minor, patch, pre, post = valid_parts[0] - - return "{}.{}{}".format(major, minor, patch) From 528f161472c0ca1e68244b99334b72f777e3dff6 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Wed, 21 Feb 2024 12:09:51 +0100 Subject: [PATCH 58/58] Cleaned up how selected RR server is queried It should be only queried only once in Collector phase, not multiple times. There is no real possibility to select RR server on instance, eg. artist cannot set that in Publisher, but thats on different PR. --- client/ayon_core/modules/royalrender/lib.py | 18 +------------ .../publish/collect_rr_path_from_instance.py | 3 +++ .../publish/submit_jobs_to_royalrender.py | 26 +------------------ 3 files changed, 5 insertions(+), 42 deletions(-) diff --git a/client/ayon_core/modules/royalrender/lib.py b/client/ayon_core/modules/royalrender/lib.py index 966eb82ab1..73383d482c 100644 --- a/client/ayon_core/modules/royalrender/lib.py +++ b/client/ayon_core/modules/royalrender/lib.py @@ -108,9 +108,7 @@ class BaseCreateRoyalRenderJob(pyblish.api.InstancePlugin, context = instance.context - self._rr_root = self._resolve_rr_path(context, instance.data.get( - "rrPathName")) # noqa - self.log.debug(self._rr_root) + self._rr_root = instance.data.get("rrPathName") if not self._rr_root: raise KnownPublishError( ("Missing RoyalRender root. " @@ -210,20 +208,6 @@ class BaseCreateRoyalRenderJob(pyblish.api.InstancePlugin, """Host specific mapping for RRJob""" raise NotImplementedError - @staticmethod - def _resolve_rr_path(context, rr_path_name): - # type: (pyblish.api.Context, str) -> str - rr_settings = context.data["project_settings"]["royalrender"] - rr_paths = rr_settings["rr_paths"] - selected_paths = rr_settings["selected_rr_paths"] - - rr_servers = { - path_key: rr_paths[path_key] - for path_key in selected_paths - if path_key in rr_paths - } - return rr_servers[rr_path_name][platform.system().lower()] - def expected_files(self, instance, path, start_frame, end_frame): """Get expected files. diff --git a/client/ayon_core/modules/royalrender/plugins/publish/collect_rr_path_from_instance.py b/client/ayon_core/modules/royalrender/plugins/publish/collect_rr_path_from_instance.py index f43ed1ca49..d860df4684 100644 --- a/client/ayon_core/modules/royalrender/plugins/publish/collect_rr_path_from_instance.py +++ b/client/ayon_core/modules/royalrender/plugins/publish/collect_rr_path_from_instance.py @@ -19,6 +19,9 @@ class CollectRRPathFromInstance(pyblish.api.InstancePlugin): # type: (pyblish.api.Instance) -> str """Get Royal Render pat name from render instance.""" + # TODO there are no "rrPaths" on instance, if Publisher should expose + # this (eg. artist could select specific server) it must be added + # to publisher instance_rr_paths = instance.data.get("rrPaths") if instance_rr_paths is None: return "default" diff --git a/client/ayon_core/modules/royalrender/plugins/publish/submit_jobs_to_royalrender.py b/client/ayon_core/modules/royalrender/plugins/publish/submit_jobs_to_royalrender.py index 5e25464186..dcec2ac810 100644 --- a/client/ayon_core/modules/royalrender/plugins/publish/submit_jobs_to_royalrender.py +++ b/client/ayon_core/modules/royalrender/plugins/publish/submit_jobs_to_royalrender.py @@ -25,16 +25,6 @@ class SubmitJobsToRoyalRender(pyblish.api.ContextPlugin): self._submission_parameters = [] def process(self, context): - rr_settings = ( - context.data - ["system_settings"] - ["modules"] - ["royalrender"] - ) - - if rr_settings["enabled"] is not True: - self.log.warning("RoyalRender modules is disabled.") - return # iterate over all instances and try to find RRJobs jobs = [] @@ -51,7 +41,7 @@ class SubmitJobsToRoyalRender(pyblish.api.ContextPlugin): instance_rr_path = instance.data["rrPathName"] if jobs: - self._rr_root = self._resolve_rr_path(context, instance_rr_path) + self._rr_root = instance_rr_path if not self._rr_root: raise KnownPublishError( ("Missing RoyalRender root. " @@ -100,17 +90,3 @@ class SubmitJobsToRoyalRender(pyblish.api.ContextPlugin): def get_submission_parameters(self): return [SubmitterParameter("RequiredMemory", "0")] - - @staticmethod - def _resolve_rr_path(context, rr_path_name): - # type: (pyblish.api.Context, str) -> str - rr_settings = context.data["project_settings"]["royalrender"] - rr_paths = rr_settings["rr_paths"] - selected_paths = rr_settings["selected_rr_paths"] - - rr_servers = { - path_key: rr_paths[path_key] - for path_key in selected_paths - if path_key in rr_paths - } - return rr_servers[rr_path_name][platform.system().lower()]