Nuke to Muster

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)

3 Responses to “Nuke to Muster”

  1. doug_at_buck Says:

    so i save this as madSubmit.py. i changed it a bit as you suggested.

    if i load it into the script editor and run through it line by line, it seems to work ok by the time i get down to os.system(cmd) But when i try to source it, and then type madSubmit i get :

    # Result:
    nothing happens. am i doing something wrong?

  2. doug_at_buck Says:

    could you just give a little tip about how one goes about using this. shall i save the script to my .nuke directory? how to i run it, as a python command?

  3. Kontantkort Says:

    Bra sida, hittade den på Yahoo. Har gjort ett bokmärke och kommer att komma tillbaka. :)

Leave a Reply