From 397de774fee4779993be8fb62c181765a001a159 Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Wed, 2 Oct 2024 00:26:40 +0200 Subject: [PATCH 1/2] Allow representation switch on update if representation does not exist (e.g. `ma` -> `mb` representation) --- client/ayon_maya/api/plugin.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/client/ayon_maya/api/plugin.py b/client/ayon_maya/api/plugin.py index 00d57f08..5a06b376 100644 --- a/client/ayon_maya/api/plugin.py +++ b/client/ayon_maya/api/plugin.py @@ -1064,6 +1064,14 @@ def _organize_containers(nodes, container): }: cmds.sets(node, forceElement=container) + def update_allowed_representation_switches(self): + return { + # Allow switching between `ma` and `mb` representations if new + # version happens to contain only the other representation + "ma": ["mb"], + "mb": ["ma"] + } + class MayaLoader(LoaderPlugin): """Base class for loader plugins.""" From 752f4f81f59231476ddbba6d7f5528de40cecc18 Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Wed, 2 Oct 2024 19:26:58 +0200 Subject: [PATCH 2/2] Refactor to updated Loader method definition in https://github.com/ynput/ayon-core/pull/932 --- client/ayon_maya/api/plugin.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/client/ayon_maya/api/plugin.py b/client/ayon_maya/api/plugin.py index 5a06b376..aba52e2c 100644 --- a/client/ayon_maya/api/plugin.py +++ b/client/ayon_maya/api/plugin.py @@ -1064,13 +1064,14 @@ def _organize_containers(nodes, container): }: cmds.sets(node, forceElement=container) - def update_allowed_representation_switches(self): + @classmethod + def get_representation_name_aliases(cls, representation_name): + # Allow switching between `ma` and `mb` representations if new + # version happens to contain only the other representation return { - # Allow switching between `ma` and `mb` representations if new - # version happens to contain only the other representation "ma": ["mb"], "mb": ["ma"] - } + }.get(representation_name, []) class MayaLoader(LoaderPlugin):