Skip to content

Instantly share code, notes, and snippets.

@tokejepsen
tokejepsen / mcatu.py
Last active February 23, 2022 13:44
Maya: Convert AiStandardSurface to USDPreview Surface.
"""
Will convert aiStandardSurface to usdPreviewSurface.
Usage:
- Select aiStandardSurface nodes and execute code.
"""
import pymel.core as pc
def list_connections(node, skip_nodes, **kwargs):
@tokejepsen
tokejepsen / mbtnw.py
Created October 29, 2021 14:44
Maya: Batch Transfer Ngskintools Weights
"""
Select targets then source last.
"""
import pymel.core as pc
from ngSkinTools.mllInterface import MllInterface
selection = pc.ls(selection=True)
targets = selection[:-1]
source = selection[-1]
@tokejepsen
tokejepsen / nvm.py
Last active August 25, 2021 14:49
Nuke: Vertical Merge
import nuke
x_separation = 110
y_separation = 110
selection = {}
for node in nuke.allNodes():
if node["selected"].value():
selection[node.name()] = node
@tokejepsen
tokejepsen / ncmtd.py
Created May 16, 2021 13:38
NukeStudio: Copy media to destination
import shutil
import hiero
destination = r"C:\Users\tokejepsen\Desktop\movs"
for item in hiero.selection:
if isinstance(item, hiero.core.EffectTrackItem):
continue
@tokejepsen
tokejepsen / fcf.py
Created January 4, 2021 15:47
ffmpeg concat filter
import subprocess
import os
chunk_frames = 25
chunk_amount = 3
framerate = 25
duration = chunk_frames / framerate
@tokejepsen
tokejepsen / npsg.py
Last active November 25, 2020 10:30
Nuke: Per Shot Grade
import nuke
def main(node):
node["selected"].setValue(False)
average_intensity = 0
keys = 0
for channel in node["intensitydata"].animations():
for key in channel.keys():
average_intensity += key.y
@tokejepsen
tokejepsen / nssfoet.py
Last active November 5, 2021 14:56
Nuke: Start, middle and end frame of each TimeClip
"""
Select all TimeClips and run code.
Will produce a frame hold with start middle and end of the time clips.
"""
import nuke
frames = []
for node in nuke.selectedNodes():
node["selected"].setValue(False)
@tokejepsen
tokejepsen / ntrs.py
Last active November 23, 2020 15:31
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
@tokejepsen
tokejepsen / nrt.py
Created September 22, 2020 13:09
NukeStudio: Remove tag
import hiero
seq = hiero.ui.activeSequence()
selection = hiero.selection
for item in selection:
if isinstance(item, hiero.core.EffectTrackItem):
continue
@tokejepsen
tokejepsen / nctfsc.py
Last active November 23, 2020 15:30
NukeStudio: Copy tags from source clip
import hiero
seq = hiero.ui.activeSequence()
selection = hiero.selection
source_track = "edit"
data = {}
for video_track in seq.videoTracks():