Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3900 from pypeclub/bugfix/fix_links_query_on_hero…
Browse files Browse the repository at this point in the history
…_version

General: Fix links query on hero version
  • Loading branch information
iLLiCiTiT authored Oct 10, 2022
2 parents 92cc179 + 3418a94 commit 1421b78
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
15 changes: 12 additions & 3 deletions openpype/client/entity_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from .entities import (
get_assets,
get_asset_by_id,
get_version_by_id,
get_representation_by_id,
convert_id,
)
Expand Down Expand Up @@ -127,12 +128,20 @@ def get_linked_representation_id(
if not version_id:
return []

version_doc = get_version_by_id(
project_name, version_id, fields=["type", "version_id"]
)
if version_doc["type"] == "hero_version":
version_id = version_doc["version_id"]

if max_depth is None:
max_depth = 0

match = {
"_id": version_id,
"type": {"$in": ["version", "hero_version"]}
# Links are not stored to hero versions at this moment so filter
# is limited to just versions
"type": "version"
}

graph_lookup = {
Expand Down Expand Up @@ -187,7 +196,7 @@ def _process_referenced_pipeline_result(result, link_type):
referenced_version_ids = set()
correctly_linked_ids = set()
for item in result:
input_links = item["data"].get("inputLinks")
input_links = item.get("data", {}).get("inputLinks")
if not input_links:
continue

Expand All @@ -203,7 +212,7 @@ def _process_referenced_pipeline_result(result, link_type):
continue

for output in sorted(outputs_recursive, key=lambda o: o["depth"]):
output_links = output["data"].get("inputLinks")
output_links = output.get("data", {}).get("inputLinks")
if not output_links:
continue

Expand Down
6 changes: 5 additions & 1 deletion openpype/tools/loader/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,11 @@ def _repre_contexts_for_loaders_filter(self, items):
repre_doc["parent"]
for repre_doc in repre_docs
]
version_docs = get_versions(project_name, version_ids=version_ids)
version_docs = get_versions(
project_name,
version_ids=version_ids,
hero=True
)

version_docs_by_id = {}
version_docs_by_subset_id = collections.defaultdict(list)
Expand Down

0 comments on commit 1421b78

Please sign in to comment.