Author Topic: trouble with in-app Nuke submit for windows  (Read 4595 times)

njushchyshyn

  • Full Member
  • ***
  • Posts: 20
trouble with in-app Nuke submit for windows
« on: November 21, 2008, 12:05:20 AM »
I seem to need some help getting an in-app submit script working for Nuke5.0 running on WindowsXP ... Qube! 5.3.

Here is the python code being run in Nuke to invoke the Nuke cmndline submit dialog.
Code: [Select]
import os
import os.path
import sys
import nuke

def addMenuItems():
    menubar = nuke.menu('Nuke')
    renderMenu = menubar.findItem('Render')
    if renderMenu == False:
        renderMenu = menubar.addMenu('&Render')
renderMenu.addCommand("-", "", "")
    renderMenu.addCommand("+ DiveQube: Render Selected...", "import diveQube; diveQube.submitNuke_renderSelected()", "#F7")


def launchgui(qubeguiPath='', submitDict={}, guiargs=''):
    '''launch the QubeGUI with the specified parameters'''
    # Construct parameter list
    cmdDict = {
                'qubeguiPath': qubeguiPath,
                'qubeguiArgString': '',
              }
    if len(submitDict) > 0:  cmdDict['qubeguiArgString'] += ' --submitDict "%s"'%submitDict
    if len(guiargs) > 0   :  cmdDict['qubeguiArgString'] += ' '+guiargs

    # Construct command for the specific platforms       
    if sys.platform[:3] == 'win':
        if cmdDict['qubeguiPath'] == '': cmdDict['qubeguiPath'] = 'C:\Program Files\pfx\qube\bin\qube.exe'
        cmd = r'start "%(qubeguiPath)s" %(qubeguiArgString)s'% cmdDict
    elif sys.platform == 'darwin':
        if cmdDict['qubeguiPath'] == '': cmdDict['qubeguiPath'] = '/Applications/pfx/qube/qube.app'
        cmd = r'%(qubeguiPath)s/Contents/MacOS/qube %(qubeguiArgString)s >/dev/null 2>&1  &'% cmdDict
    elif sys.platform[:5] == 'linux':
        if cmdDict['qubeguiPath'] == '': cmdDict['qubeguiPath'] = '/usr/local/pfx/qube/bin/qube'
        cmd = r'%(qubeguiPath)s %(qubeguiArgString)s >/dev/null 2>&1  &'% cmdDict
    else:
        raise "Unknown platform"
   
    # Run command
    nuke.tprint("COMMAND = '%s'"%cmd)
    os.system(cmd)

   
def submitNuke_render(executeNodes=''):
    thisscript = nuke.root().name()
    divehome = os.getenv("DIVEHOME")
    thisscript = thisscript.replace(divehome, "$DIVEHOME")

    '''launch the qubegui submit dialog for nuke'''
    allNodes = nuke.allNodes()
    allNodes_Write  = [str(i.name()) for i in allNodes if i.Class() == 'Write']
    allNodes_Viewer = [str(i.name()) for i in allNodes if i.Class() == 'Viewer']
    nuke.tprint(allNodes_Write)
    nuke.tprint(allNodes_Viewer)
    range = '%s-%s' % (int(nuke.animationStart()), int(nuke.animationEnd()))
    rangeInc = int(nuke.animationIncrement())
    if rangeInc > 1:
        range += 'x%s' % rangeInc
    submitDict = {
        'name'      : 'nuke '+os.path.basename(str(nuke.root().name())),
        'prototype' : 'cmdrange',
        'package' : {
            'simpleCmdType': 'Nuke (cmdline)',
            'script': str(thisscript),
            'range' : range,
            'executeNodes' : executeNodes,
            'allNodes_Write' : ','.join(allNodes_Write),
            'allNodes_Viewer' : ','.join(allNodes_Viewer),
            }
        }
    return launchgui(submitDict=submitDict)


def submitNuke_renderAll():
    return submitNuke_render(executeNodes='')


def submitNuke_renderSelected():
executeNodes = ','.join([i.name() for i in nuke.selectedNodes()])

#first, make sure the write file uses DIVEHOME
for x in nuke.selectedNodes():
_class = x.Class()
if _class == "Write":
thisfile = nuke.filename(x)

divehome = os.getenv("DIVEHOME")
print divehome
thisfile = thisfile.replace(divehome, "[getenv DIVEHOME]")
print thisfile
x.knob("file").setValue(thisfile)

#make sure the write path exists
checkpath = thisfile
print "CHECKPATH1: "+ checkpath
checkpath = checkpath.replace("[getenv DIVEHOME]", divehome)
checkpath = checkpath.replace(os.getenv("DSHOTDIR") + "/comps/","")
print "CHECKPATH2: "+  checkpath
pathsteps = checkpath.split("/")
checkdir = os.getenv("DSHOTDIR") + "/comps"
if not os.path.exists(checkdir):
os.mkdir(checkdir)
checkdir = checkdir + "/" + pathsteps[0]
if not os.path.exists(checkdir):
os.mkdir(checkdir)
checkdir = checkdir + "/" + os.getenv("DSHOWRES")
if not os.path.exists(checkdir):
os.mkdir(checkdir)

#next, replace read paths with DIVEHOME environment variable
allnodes = nuke.allNodes(nuke.root())
for r in allnodes:
_class = r.Class()
if _class == "Read":
thisfile = nuke.filename(r)
divehome = os.getenv("DIVEHOME")
print divehome
thisfile = thisfile.replace(divehome, "[getenv DIVEHOME]")
print thisfile
thisname = r.knob("name").value()
if thisname.find("ReadWrite_") < 0:
     r.knob("file").setValue(thisfile)

#save the modified script
nuke.scriptSave()

return submitNuke_render(executeNodes=executeNodes)


This is working fine on our Mac workstations, but in windows, qube is reporting: "qube.exe: error: no such option: --submitDict"

is there some modification needed to get this working on windows?

Scot Brew

  • Hero Member
  • *****
  • Posts: 272
    • PipelineFX
Re: trouble with in-app Nuke submit for windows
« Reply #1 on: November 21, 2008, 08:57:27 PM »
The in-application submission for Nuke leverages the QubeGUI for the submission dialog.  As a result, you need to download and install QubeGUI 5.4.x as that version exposes the new "--submitDict" commandline parameter that the Nuke in-application submission is looking for. 

Note: The QubeGUI 5.4.x is fully compatible with the Qube 5.3 Supervisor and Workers.