mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-27 14:22:37 +01:00
feat(nukestudio): collecting handles from tags
This commit is contained in:
parent
6a2f94ee9c
commit
104b62861b
1 changed files with 52 additions and 0 deletions
52
pype/plugins/nukestudio/publish/collect_handles.py
Normal file
52
pype/plugins/nukestudio/publish/collect_handles.py
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
import json
|
||||
from pyblish import api
|
||||
|
||||
class CollectClipHandles(api.InstancePlugin):
|
||||
"""Collect Handles from selected track items."""
|
||||
|
||||
order = api.CollectorOrder + 0.006
|
||||
label = "Collect Handles"
|
||||
hosts = ["nukestudio"]
|
||||
families = ['clip']
|
||||
|
||||
def process(self, instance):
|
||||
# gets tags
|
||||
tags = instance.data["tags"]
|
||||
|
||||
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 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']:
|
||||
hs = instance.data.get('handle_start')
|
||||
if not hs:
|
||||
instance.data['handle_start'] = 0
|
||||
instance.data['handle_start'] += t_value
|
||||
self.log.info("Collected Handle Start: `{}`".format(
|
||||
instance.data['handle_start']))
|
||||
|
||||
# add in end
|
||||
if 'end' in t_args['where']:
|
||||
hs = instance.data.get('handle_end')
|
||||
if not hs:
|
||||
instance.data['handle_end'] = 0
|
||||
instance.data['handle_end'] += t_value
|
||||
self.log.info("Collected Handle End: `{}`".format(
|
||||
instance.data['handle_end']))
|
||||
Loading…
Add table
Add a link
Reference in a new issue