mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-27 06:12:19 +01:00
feat(nks): handling handle_start/end workflow
This commit is contained in:
parent
6e813604c5
commit
1fdcd6bd6a
3 changed files with 62 additions and 45 deletions
|
|
@ -5,18 +5,18 @@ from pyblish import api
|
|||
class CollectClipHandles(api.ContextPlugin):
|
||||
"""Collect Handles from all instanes and add to assetShared."""
|
||||
|
||||
order = api.CollectorOrder + 0.1025
|
||||
order = api.CollectorOrder + 0.0121
|
||||
label = "Collect Handles"
|
||||
hosts = ["nukestudio"]
|
||||
|
||||
def process(self, context):
|
||||
assets_shared = context.data.get("assetsShared")
|
||||
assert assets_shared, "Context data missing `assetsShared` key"
|
||||
|
||||
# find all main types instances and add its handles to asset shared
|
||||
instances = context[:]
|
||||
filtered_instances = []
|
||||
for instance in instances:
|
||||
self.log.debug("_ instance.name: `{}`".format(instance.data["name"]))
|
||||
families = instance.data.get("families", [])
|
||||
families += [instance.data["family"]]
|
||||
if "clip" in families:
|
||||
|
|
@ -28,6 +28,7 @@ class CollectClipHandles(api.ContextPlugin):
|
|||
handles = int(instance.data["handles"])
|
||||
handle_start = int(instance.data["handleStart"])
|
||||
handle_end = int(instance.data["handleEnd"])
|
||||
self.log.debug("_ instance.name: `{}`".format(instance.data["name"]))
|
||||
|
||||
if instance.data.get("main"):
|
||||
name = instance.data["asset"]
|
||||
|
|
@ -51,3 +52,11 @@ class CollectClipHandles(api.ContextPlugin):
|
|||
"handleStart", 0
|
||||
)
|
||||
instance.data["handleEnd"] = s_asset_data.get("handleEnd", 0)
|
||||
self.log.debug("_ s_asset_data: `{}`".format(
|
||||
s_asset_data))
|
||||
self.log.debug("_ instance.data[handles]: `{}`".format(
|
||||
instance.data["handles"]))
|
||||
self.log.debug("_ instance.data[handleStart]: `{}`".format(
|
||||
instance.data["handleStart"]))
|
||||
self.log.debug("_ instance.data[handleEnd]: `{}`".format(
|
||||
instance.data["handleEnd"]))
|
||||
|
|
|
|||
|
|
@ -38,10 +38,6 @@ class CollectHierarchyInstance(pyblish.api.ContextPlugin):
|
|||
clip = instance.data["item"]
|
||||
asset = instance.data.get("asset")
|
||||
|
||||
# create asset_names conversion table
|
||||
if not context.data.get("assetsShared"):
|
||||
context.data["assetsShared"] = dict()
|
||||
|
||||
# build data for inner nukestudio project property
|
||||
data = {
|
||||
"sequence": (
|
||||
|
|
@ -193,12 +189,12 @@ class CollectHierarchyContext(pyblish.api.ContextPlugin):
|
|||
handle_start = int(instance.data["handleStart"] + handles)
|
||||
handle_end = int(instance.data["handleEnd"] + handles)
|
||||
|
||||
instance.data['startFrame'] = (
|
||||
instance.data["item"].timelineIn() - handle_start
|
||||
)
|
||||
instance.data['endFrame'] = (
|
||||
instance.data["item"].timelineOut() + handle_end
|
||||
)
|
||||
# instance.data['startFrame'] = (
|
||||
# instance.data["item"].timelineIn() - handle_start
|
||||
# )
|
||||
# instance.data['endFrame'] = (
|
||||
# instance.data["item"].timelineOut() + handle_end
|
||||
# )
|
||||
|
||||
# inject assetsShared to other plates types
|
||||
assets_shared = context.data.get("assetsShared")
|
||||
|
|
@ -239,8 +235,10 @@ class CollectHierarchyContext(pyblish.api.ContextPlugin):
|
|||
# get custom attributes of the shot
|
||||
in_info['custom_attributes'] = {
|
||||
'handles': int(instance.data.get('handles')),
|
||||
'fstart': int(instance.data["startFrame"]),
|
||||
'fend': int(instance.data["endFrame"]),
|
||||
'handle_start': handle_start,
|
||||
'handle_end': handle_end,
|
||||
'fstart': int(instance.data["startFrame"] - handle_start),
|
||||
'fend': int(instance.data["endFrame"] + handle_end),
|
||||
'fps': context.data["framerate"],
|
||||
"edit_in": int(instance.data["startFrame"]),
|
||||
"edit_out": int(instance.data["endFrame"])
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import json
|
|||
from pyblish import api
|
||||
|
||||
|
||||
class CollectClipTagHandles(api.InstancePlugin):
|
||||
class CollectClipTagHandles(api.ContextPlugin):
|
||||
"""Collect Handles from selected track items."""
|
||||
|
||||
order = api.CollectorOrder + 0.012
|
||||
|
|
@ -10,38 +10,48 @@ class CollectClipTagHandles(api.InstancePlugin):
|
|||
hosts = ["nukestudio"]
|
||||
families = ['clip']
|
||||
|
||||
def process(self, instance):
|
||||
# gets tags
|
||||
tags = instance.data["tags"]
|
||||
def process(self, context):
|
||||
assets_shared = context.data.get("assetsShared")
|
||||
for instance in context[:]:
|
||||
# gets tags
|
||||
tags = instance.data["tags"]
|
||||
assets_shared_a = assets_shared[instance.data["asset"]]
|
||||
for t in tags:
|
||||
t_metadata = dict(t["metadata"])
|
||||
t_family = t_metadata.get("tag.family", "")
|
||||
|
||||
for t in tags:
|
||||
t_metadata = dict(t["metadata"])
|
||||
t_family = t_metadata.get("tag.family", "")
|
||||
# gets only task family tags and collect labels
|
||||
if "handles" in t_family:
|
||||
# gets value of handles
|
||||
t_value = int(t_metadata.get("tag.value", ""))
|
||||
|
||||
# gets only task family tags and collect labels
|
||||
if "handles" in t_family:
|
||||
# gets value of handles
|
||||
t_value = int(t_metadata.get("tag.value", ""))
|
||||
# gets arguments if there are any
|
||||
t_args = t_metadata.get("tag.args", "")
|
||||
|
||||
# gets arguments if there are any
|
||||
t_args = t_metadata.get("tag.args", "")
|
||||
# distribute handles
|
||||
if not t_args:
|
||||
# add handles to both sides
|
||||
instance.data['handles'] = t_value
|
||||
self.log.info("Collected Handles: `{}`".format(
|
||||
instance.data['handles']))
|
||||
else:
|
||||
t_args = json.loads(t_args.replace("'", "\""))
|
||||
# add in start
|
||||
if 'start' in t_args['where']:
|
||||
instance.data["handleStart"] += t_value
|
||||
self.log.info("Collected Handle Start: `{}`".format(
|
||||
instance.data["handleStart"]))
|
||||
|
||||
# distribute handles
|
||||
if not t_args:
|
||||
# add handles to both sides
|
||||
instance.data['handles'] = t_value
|
||||
self.log.info("Collected Handles: `{}`".format(
|
||||
instance.data['handles']))
|
||||
else:
|
||||
t_args = json.loads(t_args.replace("'", "\""))
|
||||
# add in start
|
||||
if 'start' in t_args['where']:
|
||||
instance.data["handleStart"] += t_value
|
||||
self.log.info("Collected Handle Start: `{}`".format(
|
||||
instance.data["handleStart"]))
|
||||
# add in end
|
||||
if 'end' in t_args['where']:
|
||||
instance.data["handleEnd"] += t_value
|
||||
self.log.info("Collected Handle End: `{}`".format(
|
||||
instance.data["handleEnd"]))
|
||||
|
||||
# add in end
|
||||
if 'end' in t_args['where']:
|
||||
instance.data["handleEnd"] += t_value
|
||||
self.log.info("Collected Handle End: `{}`".format(
|
||||
instance.data["handleEnd"]))
|
||||
# adding handles to asset_shared on context
|
||||
if instance.data.get("handleEnd"):
|
||||
assets_shared_a["handleEnd"] = instance.data["handleEnd"]
|
||||
if instance.data.get("handleStart"):
|
||||
assets_shared_a["handleStart"] = instance.data["handleStart"]
|
||||
if instance.data.get("handles"):
|
||||
assets_shared_a["handles"] = instance.data["handles"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue