mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
hiero use folder and task entities
This commit is contained in:
parent
a5589d313a
commit
321e9ff96c
5 changed files with 24 additions and 36 deletions
|
|
@ -588,7 +588,7 @@ def imprint(track_item, data=None):
|
|||
|
||||
Examples:
|
||||
data = {
|
||||
'asset': 'sq020sh0280',
|
||||
'folderPath': '/shots/sq020sh0280',
|
||||
'productType': 'render',
|
||||
'productName': 'productMain'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -409,8 +409,9 @@ class ClipLoader:
|
|||
"Cannot Load selected data, look into database "
|
||||
"or call your supervisor")
|
||||
|
||||
# inject asset data to representation dict
|
||||
self._get_asset_data()
|
||||
# inject folder data to representation dict
|
||||
folder_entity = self.context["folder"]
|
||||
self.data["folderAttributes"] = folder_entity["attrib"]
|
||||
log.info("__init__ self.data: `{}`".format(pformat(self.data)))
|
||||
log.info("__init__ options: `{}`".format(pformat(options)))
|
||||
|
||||
|
|
@ -424,7 +425,7 @@ class ClipLoader:
|
|||
self.active_sequence = lib.get_current_sequence(new=True)
|
||||
self.active_sequence.setFramerate(
|
||||
hiero.core.TimeBase.fromString(
|
||||
str(self.data["assetData"]["fps"])))
|
||||
str(self.data["folderAttributes"]["fps"])))
|
||||
else:
|
||||
self.active_sequence = lib.get_current_sequence()
|
||||
|
||||
|
|
@ -447,7 +448,7 @@ class ClipLoader:
|
|||
# create name
|
||||
repr = self.context["representation"]
|
||||
repr_cntx = repr["context"]
|
||||
asset = str(repr_cntx["asset"])
|
||||
folder_name = str(repr_cntx["asset"])
|
||||
product_name = str(repr_cntx["subset"])
|
||||
representation = str(repr_cntx["representation"])
|
||||
self.data["clip_name"] = self.clip_name_template.format(**repr_cntx)
|
||||
|
|
@ -470,7 +471,7 @@ class ClipLoader:
|
|||
hierarchy = str("/".join((
|
||||
"Loader",
|
||||
repr_cntx["hierarchy"].replace("\\", "/"),
|
||||
asset
|
||||
folder_name
|
||||
)))
|
||||
|
||||
self.data["binPath"] = hierarchy
|
||||
|
|
@ -487,16 +488,6 @@ class ClipLoader:
|
|||
file = file.replace(frame, "#" * padding)
|
||||
self.data["path"] = file
|
||||
|
||||
def _get_asset_data(self):
|
||||
""" Get all available asset data
|
||||
|
||||
joint `data` key with asset.data dict into the representation
|
||||
|
||||
"""
|
||||
|
||||
asset_doc = self.context["asset"]
|
||||
self.data["assetData"] = asset_doc["data"]
|
||||
|
||||
def _make_track_item(self, source_bin_item, audio=False):
|
||||
""" Create track item with """
|
||||
|
||||
|
|
@ -533,9 +524,9 @@ class ClipLoader:
|
|||
self.handle_start = self.data["versionData"].get("handleStart")
|
||||
self.handle_end = self.data["versionData"].get("handleEnd")
|
||||
if self.handle_start is None:
|
||||
self.handle_start = self.data["assetData"]["handleStart"]
|
||||
self.handle_start = self.data["folderAttributes"]["handleStart"]
|
||||
if self.handle_end is None:
|
||||
self.handle_end = self.data["assetData"]["handleEnd"]
|
||||
self.handle_end = self.data["folderAttributes"]["handleEnd"]
|
||||
|
||||
self.handle_start = int(self.handle_start)
|
||||
self.handle_end = int(self.handle_end)
|
||||
|
|
@ -552,11 +543,11 @@ class ClipLoader:
|
|||
last_timeline_out = int(last_track_item.timelineOut()) + 1
|
||||
self.timeline_in = last_timeline_out
|
||||
self.timeline_out = last_timeline_out + int(
|
||||
self.data["assetData"]["clipOut"]
|
||||
- self.data["assetData"]["clipIn"])
|
||||
self.data["folderAttributes"]["clipOut"]
|
||||
- self.data["folderAttributes"]["clipIn"])
|
||||
else:
|
||||
self.timeline_in = int(self.data["assetData"]["clipIn"])
|
||||
self.timeline_out = int(self.data["assetData"]["clipOut"])
|
||||
self.timeline_in = int(self.data["folderAttributes"]["clipIn"])
|
||||
self.timeline_out = int(self.data["folderAttributes"]["clipOut"])
|
||||
|
||||
log.debug("__ self.timeline_in: {}".format(self.timeline_in))
|
||||
log.debug("__ self.timeline_out: {}".format(self.timeline_out))
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class LoadEffects(load.LoaderPlugin):
|
|||
Arguments:
|
||||
context (dict): context of version
|
||||
name (str): name of the version
|
||||
namespace (str): asset name
|
||||
namespace (str): Folder name.
|
||||
data (dict): compulsory attribute > not used
|
||||
|
||||
Returns:
|
||||
|
|
@ -46,10 +46,10 @@ class LoadEffects(load.LoaderPlugin):
|
|||
active_sequence, "Loaded_{}".format(name))
|
||||
|
||||
# get main variables
|
||||
namespace = namespace or context["asset"]["name"]
|
||||
namespace = namespace or context["folder"]["name"]
|
||||
object_name = "{}_{}".format(name, namespace)
|
||||
clip_in = context["asset"]["data"]["clipIn"]
|
||||
clip_out = context["asset"]["data"]["clipOut"]
|
||||
clip_in = context["folder"]["attrib"]["clipIn"]
|
||||
clip_out = context["folder"]["attrib"]["clipOut"]
|
||||
|
||||
data_imprint = {
|
||||
"objectName": object_name,
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@ import json
|
|||
|
||||
import pyblish.api
|
||||
|
||||
from ayon_core.client import get_asset_name_identifier
|
||||
|
||||
|
||||
class CollectFrameTagInstances(pyblish.api.ContextPlugin):
|
||||
"""Collect frames from tags.
|
||||
|
|
@ -104,8 +102,7 @@ class CollectFrameTagInstances(pyblish.api.ContextPlugin):
|
|||
|
||||
# first collect all available product tag frames
|
||||
product_data = {}
|
||||
context_asset_doc = context.data["assetEntity"]
|
||||
context_folder_path = get_asset_name_identifier(context_asset_doc)
|
||||
context_folder_path = context.data["folderEntity"]["path"]
|
||||
|
||||
for tag_data in sequence_tags:
|
||||
frame = int(tag_data["start"])
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ class PrecollectInstances(pyblish.api.ContextPlugin):
|
|||
if k not in ("id", "applieswhole", "label")
|
||||
})
|
||||
|
||||
asset, asset_name = self._get_asset_data(tag_data)
|
||||
asset, asset_name = self._get_folder_data(tag_data)
|
||||
|
||||
product_name = tag_data.get("productName")
|
||||
if product_name is None:
|
||||
|
|
@ -242,13 +242,13 @@ class PrecollectInstances(pyblish.api.ContextPlugin):
|
|||
self.log.debug(
|
||||
"_ instance.data: {}".format(pformat(instance.data)))
|
||||
|
||||
def _get_asset_data(self, data):
|
||||
def _get_folder_data(self, data):
|
||||
folder_path = data.pop("folderPath", None)
|
||||
|
||||
if data.get("asset_name"):
|
||||
asset_name = data["asset_name"]
|
||||
folder_name = data["asset_name"]
|
||||
else:
|
||||
asset_name = data["asset"]
|
||||
folder_name = data["asset"]
|
||||
|
||||
# backward compatibility for clip tags
|
||||
# which are missing folderPath key
|
||||
|
|
@ -257,10 +257,10 @@ class PrecollectInstances(pyblish.api.ContextPlugin):
|
|||
hierarchy_path = data["hierarchy"]
|
||||
folder_path = "/{}/{}".format(
|
||||
hierarchy_path,
|
||||
asset_name
|
||||
folder_name
|
||||
)
|
||||
|
||||
return folder_path, asset_name
|
||||
return folder_path, folder_name
|
||||
|
||||
def create_audio_instance(self, context, **data):
|
||||
product_name = "audioMain"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue