diff --git a/openpype/client/__init__.py b/openpype/client/__init__.py index 861f828e67..e4c01fc0cc 100644 --- a/openpype/client/__init__.py +++ b/openpype/client/__init__.py @@ -22,6 +22,7 @@ from .entities import ( get_representation, get_representation_by_name, get_representations, + get_representation_parents, get_representations_parents, get_thumbnail, @@ -52,6 +53,7 @@ __all__ = ( "get_representation", "get_representation_by_name", "get_representations", + "get_representation_parents", "get_representations_parents", "get_thubmnail", diff --git a/openpype/client/entities.py b/openpype/client/entities.py index 4b52f8cf2d..e9b820dd1a 100644 --- a/openpype/client/entities.py +++ b/openpype/client/entities.py @@ -641,6 +641,15 @@ def get_representations_parents(project_name, representations): return output +def get_representation_parents(project_name, representation): + if not representation: + return None + + repre_id = representation["_id"] + parents_by_repre_id = get_representations(project_name, [representation]) + return parents_by_repre_id.get(repre_id) + + def get_thumbnail_id_from_source(project_name, src_type, src_id): if not src_type or not src_id: return None