Skip to content

Instantly share code, notes, and snippets.

@jtomori
Last active May 23, 2024 23:07
Show Gist options
  • Save jtomori/3dc6c7618c0dffdceae1a13d870c58f2 to your computer and use it in GitHub Desktop.
Save jtomori/3dc6c7618c0dffdceae1a13d870c58f2 to your computer and use it in GitHub Desktop.
Initial setup for Nuke

env.bat

@echo off

rem set globals
set "ROOT=//isilonai/LAFM"

rem set nuke config path
set "NUKE_PATH=%ROOT%/010_pipeline/software/nuke"
set "NUKE_PATH=%NUKE_PATH:\=/%"
set "HOME=%ROOT%/020_user/%USERNAME%"

rem add nuke to PATH
set "NUKE_DIR=C:\Program Files\%NUKE_VERSION%\"
set "PATH=%NUKE_DIR%;%PATH%"

nuke_launcher.bat

@echo off

rem set Nuke version
set "NUKE_VERSION=Nuke11.2v4"

rem source global env
call \\isilonai\LAFM\010_pipeline\software\env.bat

rem fire up nuke with drag-n-dropped file
start Nuke11.2.exe --nukex "%~1"

menu.py

import os
import nuke

def addGizmos(path, menu_main=None, menu_name="Gizmos"):
	"""
	Traverses "path" folder and adds found gizmos as commands to "menu_name" menu
	"""
	m = menu_main.addMenu(menu_name)
	for root, dirs, files in os.walk(path):
		for fileNameCompl in files:
			fileName, fileExt = os.path.splitext(fileNameCompl)
			if fileExt == ".gizmo":
				folder = (root + "/")[len(path)+1:]
				m.addCommand(folder + fileName, "nuke.createNode('" + fileName + "')")

menu_nodes = nuke.menu('Nodes')
gizmos_path = os.path.join(os.environ["ROOT"], "010_pipeline", "software", "nuke", "gizmos")

addGizmos(gizmos_path, menu_nodes, "LAFM")

# set up defaults
nuke.knobDefault("Root.format", "HD_1080")
nuke.knobDefault("Root.fps", "25")
nuke.knobDefault("Root.project_directory", "[python {nuke.script_directory()}]")
nuke.knobDefault("Root.colorManagement", "OCIO")
nuke.knobDefault("Root.OCIO_config", "aces_1.0.3")

init.py

import os
import sys
import nuke
import platform

# add gizmos to plugin path
gizmos_path = os.path.join(os.environ["ROOT"], "010_pipeline", "software", "nuke", "gizmos")
nuke.pluginAddPath(gizmos_path)

# setup numpy
if platform.system() == "Windows":
    sys.path.append( os.path.join(os.environ["ROOT"], "010_pipeline", "software", "python", "site-packages") )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment