Archive for February, 2009

Nuke to Muster

Tuesday, February 24th, 2009

Here’s a python script to submit scripts from Nuke to Muster.
Change: server, username and password to your muster server account.

Usage: If you run the script with nothing selected it renders all Write nodes.
Otherwise it renders the selected Writenodes.

Remember to save your script before submitting.

import re, os
import nuke

server = "address"
username = "username"
password = "password"

def madSubmit():
    a = nuke.knob("first_frame")
    b = nuke.knob("last_frame")
    start = int(a)
    end = int(b)
    incr = 1
    _range = a+","+b
    r = nuke.getInput("Frames to render:", _range)
    if r is not None:
        r = re.sub("[,|-|/]", " ", r)
        t = r.split()
    else:
        return
    if len(t) > 0:
      start = int(t[0])
      end = start
    else:
        return
    if len(t) > 1: end = int(t[1])
    if len(t) > 2: incr = int(t[2])

    cmd = '""%s\\Mrtool.exe" -s %s -u %s -p %s -b -pk 10 -e 28 -n %s -sf %i -ef %i -bf 1 -st 1 -f %s' % (os.getenv("MUSTER", "Failed"), server, username, password, os.path.basename(nuke.value("root.name")).split(".")[0], int(start) ,int(end), nuke.value("root.name"))

    writeNodes = [n for n in nuke.selectedNodes() if n.Class() == "Write"]
    if writeNodes:
        cmd += ' -add "-X '+','.join([node.name() for node in writeNodes])+'"'
    cmd +='"'
    print cmd
    os.system(cmd)