From 7e78937e31b39c9d690d7b6573d8aa0860986ee1 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Wed, 21 Feb 2024 10:38:21 +0100 Subject: [PATCH] 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"])