Get both json and ma representation with one query

This commit is contained in:
Roy Nieterau 2024-03-29 13:32:18 +01:00
parent fe6990a647
commit 7375587c87

View file

@ -1897,12 +1897,15 @@ def assign_look_by_version(nodes, version_id):
project_name = get_current_project_name()
# Get representations of shader file and relationships
look_representation = ayon_api.get_representation_by_name(
project_name, "ma", version_id
)
json_representation = ayon_api.get_representation_by_name(
project_name, "json", version_id
representations = ayon_api.get_representations(
project_name=project_name,
representation_names={"ma", "json"},
version_ids=[version_id]
)
look_representation = next(
repre for repre in representations if repre["name"] == "ma")
json_representation = next(
repre for repre in representations if repre["name"] == "json")
# See if representation is already loaded, if so reuse it.
host = registered_host()