Last active
November 23, 2020 15:31
-
-
Save tokejepsen/0d80d78a24911035f6d00881ba362acc to your computer and use it in GitHub Desktop.
NukeStudio: Tag reuse shots
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hiero | |
selection = hiero.selection | |
comment_tag = None | |
for item in selection[0].project().tagsBin().items(): | |
if item.name() == "Comment": | |
comment_tag = item | |
break | |
data = {} | |
for item in selection: | |
if isinstance(item, hiero.core.EffectTrackItem): | |
continue | |
if isinstance(item, hiero.core.Transition): | |
continue | |
path = item.source().mediaSource().firstpath() | |
try: | |
data[path].append(item) | |
except KeyError: | |
data[path] = [item] | |
target_track = "cuts" | |
track_data = {} | |
for track in selection[0].sequence().videoTracks(): | |
if track.name() != target_track: | |
continue | |
for item in track.items(): | |
track_data[item.name()] = item | |
break | |
for key, value in data.items(): | |
if len(value) == 1: | |
continue | |
comment_tag.setNote("Reuse of {}".format(value[0].name())) | |
for count in range(1, len(value)): | |
if value[count].name() not in track_data.keys(): | |
continue | |
track_data[value[count].name()].addTag(comment_tag) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment