mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
changed way how get_latest_version is used in nuke's collect_review
This commit is contained in:
parent
27dfb15943
commit
96048ce6d7
1 changed files with 15 additions and 10 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import os
|
||||
import pyblish.api
|
||||
import pype.api
|
||||
from avalon import io, api
|
||||
|
|
@ -26,20 +27,24 @@ class CollectReview(pyblish.api.InstancePlugin):
|
|||
if not node["review"].value():
|
||||
return
|
||||
|
||||
# Add audio to instance if it exists.
|
||||
try:
|
||||
version = pype.api.get_latest_version(
|
||||
instance.context.data["assetEntity"]["name"], "audioMain"
|
||||
)
|
||||
representation = io.find_one(
|
||||
{"type": "representation", "parent": version["_id"]}
|
||||
# * Add audio to instance if exists.
|
||||
# Find latest versions document
|
||||
version_doc = pype.api.get_latest_version(
|
||||
instance.context.data["assetEntity"]["name"], "audioMain"
|
||||
)
|
||||
repre_doc = None
|
||||
if version_doc:
|
||||
# Try to find it's representation (Expected there is only one)
|
||||
repre_doc = io.find_one(
|
||||
{"type": "representation", "parent": version_doc["_id"]}
|
||||
)
|
||||
|
||||
# Add audio to instance if representation was found
|
||||
if repre_doc:
|
||||
instance.data["audio"] = [{
|
||||
"offset": 0,
|
||||
"filename": api.get_representation_path(representation)
|
||||
"filename": api.get_representation_path(repre_doc)
|
||||
}]
|
||||
except AssertionError:
|
||||
pass
|
||||
|
||||
instance.data["families"].append("review")
|
||||
instance.data['families'].append('ftrack')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue