Skip to content

Instantly share code, notes, and snippets.

@tokejepsen
Last active November 23, 2020 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tokejepsen/0d80d78a24911035f6d00881ba362acc to your computer and use it in GitHub Desktop.
Save tokejepsen/0d80d78a24911035f6d00881ba362acc to your computer and use it in GitHub Desktop.
NukeStudio: Tag reuse shots
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