mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
fix(nks): collecting effects was renamed to Lut and also improved the data collection with assignedTo attribute
This commit is contained in:
parent
e058913fc3
commit
c6a3911f56
1 changed files with 63 additions and 56 deletions
|
|
@ -2,17 +2,19 @@ import pyblish.api
|
|||
import hiero.core
|
||||
|
||||
|
||||
class CollectVideoTracksEffects(pyblish.api.InstancePlugin):
|
||||
class CollectVideoTracksLuts(pyblish.api.InstancePlugin):
|
||||
"""Collect video tracks effects into context."""
|
||||
|
||||
order = pyblish.api.CollectorOrder + 0.1015
|
||||
label = "Effects from video tracks"
|
||||
label = "Collect Soft Lut Effects"
|
||||
families = ["clip"]
|
||||
|
||||
def process(self, instance):
|
||||
|
||||
self.log.debug("Finding soft effect for subset: `{}`".format(instance.data.get("subset")))
|
||||
|
||||
# taking active sequence
|
||||
subset = instance.data["subset"]
|
||||
sequence = instance.context.data['activeSequence']
|
||||
effects_on_tracks = instance.context.data.get("subTrackUsedTracks")
|
||||
sub_track_items = instance.context.data.get("subTrackItems")
|
||||
|
|
@ -32,71 +34,76 @@ class CollectVideoTracksEffects(pyblish.api.InstancePlugin):
|
|||
'select_cccid', 'mix', 'version']
|
||||
|
||||
# creating context attribute
|
||||
effects = dict()
|
||||
|
||||
effects = {"assignTo": subset, "effects": dict()}
|
||||
|
||||
for subtrack_item in sub_track_items:
|
||||
sub_track = subtrack_item.parentTrack().name()
|
||||
|
||||
# ignore anything not EffectTrackItem
|
||||
if isinstance(subtrack_item, hiero.core.EffectTrackItem):
|
||||
et_item = subtrack_item
|
||||
# ignore item if not enabled
|
||||
if et_item.isEnabled():
|
||||
node = et_item.node()
|
||||
node_serialized = {}
|
||||
# loop trough all knobs and collect not ignored
|
||||
# and any with any value
|
||||
for knob in node.knobs().keys():
|
||||
# skip nodes in ignore keys
|
||||
if knob in _ignoring_keys:
|
||||
continue
|
||||
if not isinstance(subtrack_item, hiero.core.EffectTrackItem):
|
||||
continue
|
||||
et_item = subtrack_item
|
||||
|
||||
# get animation if node is animated
|
||||
if node[knob].isAnimated():
|
||||
# grab animation including handles
|
||||
knob_anim = [node[knob].getValueAt(i)
|
||||
for i in range(timeline_in_h, timeline_out_h + 1)]
|
||||
# ignore item if not enabled
|
||||
if not et_item.isEnabled():
|
||||
continue
|
||||
|
||||
node_serialized[knob] = knob_anim
|
||||
else:
|
||||
node_serialized[knob] = node[knob].value()
|
||||
node = et_item.node()
|
||||
node_serialized = {}
|
||||
# loop trough all knobs and collect not ignored
|
||||
# and any with any value
|
||||
for knob in node.knobs().keys():
|
||||
# skip nodes in ignore keys
|
||||
if knob in _ignoring_keys:
|
||||
continue
|
||||
|
||||
# pick track index from subTrackItem
|
||||
pick_sub_track = [indx for indx, vt in enumerate(sequence.videoTracks())
|
||||
if vt.name() in sub_track]
|
||||
# pick track index from trackItem
|
||||
pick_track = [indx for indx, vt in enumerate(sequence.videoTracks())
|
||||
if vt.name() in track]
|
||||
# collect timelineIn/Out
|
||||
effect_t_in = int(et_item.timelineIn())
|
||||
effect_t_out = int(et_item.timelineOut())
|
||||
# get animation if node is animated
|
||||
if node[knob].isAnimated():
|
||||
# grab animation including handles
|
||||
knob_anim = [node[knob].getValueAt(i)
|
||||
for i in range(timeline_in_h, timeline_out_h + 1)]
|
||||
|
||||
# controle if parent track has video trackItems
|
||||
items_check = et_item.parent().items()
|
||||
node_serialized[knob] = knob_anim
|
||||
else:
|
||||
node_serialized[knob] = node[knob].value()
|
||||
|
||||
# filter out all track items under any track with effects
|
||||
# also filter out track item bellow
|
||||
if (pick_track[0] in effects_on_tracks) and (pick_sub_track[0] >= pick_track[0]):
|
||||
if (effect_t_in == timeline_in) and (effect_t_out == timeline_out):
|
||||
effects.update({et_item.name(): {
|
||||
"timelineIn": effect_t_in,
|
||||
"timelineOut": effect_t_out,
|
||||
"subTrackIndex": et_item.subTrackIndex(),
|
||||
"trackIndex": pick_track[0],
|
||||
# "node": node_serialized
|
||||
}})
|
||||
# for subTrackItem on track without any trackItems
|
||||
elif len(items_check) == 0:
|
||||
effects.update({et_item.name(): {
|
||||
"timelineIn": effect_t_in,
|
||||
"timelineOut": effect_t_out,
|
||||
"subTrackIndex": et_item.subTrackIndex(),
|
||||
"trackIndex": pick_track[0],
|
||||
"node": node_serialized
|
||||
}})
|
||||
# pick track index from subTrackItem
|
||||
pick_sub_track = [indx for indx, vt
|
||||
in enumerate(sequence.videoTracks())
|
||||
if vt.name() in sub_track]
|
||||
# pick track index from trackItem
|
||||
pick_track = [indx for indx, vt in enumerate(sequence.videoTracks())
|
||||
if vt.name() in track]
|
||||
# collect timelineIn/Out
|
||||
effect_t_in = int(et_item.timelineIn())
|
||||
effect_t_out = int(et_item.timelineOut())
|
||||
|
||||
# controle if parent track has video trackItems
|
||||
items_check = et_item.parent().items()
|
||||
|
||||
# filter out all track items under any track with effects
|
||||
# also filter out track item bellow
|
||||
if (pick_track[0] in effects_on_tracks) and (pick_sub_track[0] >= pick_track[0]):
|
||||
if (effect_t_in == timeline_in) and (effect_t_out == timeline_out):
|
||||
effects["effects"].update({et_item.name(): {
|
||||
"timelineIn": effect_t_in,
|
||||
"timelineOut": effect_t_out,
|
||||
"subTrackIndex": et_item.subTrackIndex(),
|
||||
"trackIndex": pick_track[0],
|
||||
"node": node_serialized
|
||||
}})
|
||||
# for subTrackItem on track without any trackItems
|
||||
elif len(items_check) == 0:
|
||||
effects["effects"].update({et_item.name(): {
|
||||
"timelineIn": effect_t_in,
|
||||
"timelineOut": effect_t_out,
|
||||
"subTrackIndex": et_item.subTrackIndex(),
|
||||
"trackIndex": pick_track[0],
|
||||
"node": node_serialized
|
||||
}})
|
||||
|
||||
instance.data["effectTrackItems"] = effects
|
||||
if len(instance.data.get("effectTrackItems", {}).keys()) > 0:
|
||||
instance.data["families"] += ["effects"]
|
||||
instance.data["families"] += ["lut"]
|
||||
self.log.debug("effects.keys: {}".format(instance.data.get("effectTrackItems", {}).keys()))
|
||||
self.log.debug("effects: {}".format(instance.data.get("effectTrackItems", {})))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue