Ejemplo n.º 1
0
def buildCompScript():
    templates = files

    for i, template in enumerate(templates):
        nuke.scriptReadFile(template)
        nuke.selectAll()
        node = nuke.selectedNodes("BackdropNode")[0]

        if i > 0:
            bdNodes = node.getNodes()
            nodePrevX = node.xpos()
            nodePrevY = node.ypos()
            node.setYpos(previousNode.ypos() + 500)
            node.setXpos(previousNode.xpos())

            for n in bdNodes:
                if n.ypos() > nodePrevY:
                    n.setYpos(node.ypos() + (n.ypos() - nodePrevY))
                else:
                    n.setYpos(node.ypos() + (n.ypos() + nodePrevY))
                if n.xpos() > nodePrevX:
                    n.setXpos(node.xpos() + (n.xpos() - nodePrevX))
                else:
                    n.setXpos(node.xpos() + (n.xpos() + nodePrevX))

        previousNode = node
Ejemplo n.º 2
0
def Interval_frame_read_zwz():
    a = nukescripts.PythonPanel('Interval_frame_Read')
    a.addKnob(
        nuke.Text_Knob(
            'Expression: (frame-X)*Y+X\nIf x and y values for empty return null!'
        ))
    a.addKnob(nuke.Int_Knob('X:'))
    a.addKnob(nuke.Int_Knob('Y:'))
    finishedDialog = a.showModalDialog()
    oldfilepath = int(a.knobs()['X:'].getValue())
    newfilepath = int(a.knobs()['Y:'].getValue())
    nuke.selectAll()
    AllNode = nuke.selectedNodes()
    for donode in AllNode:
        donode.setSelected(0)
    if oldfilepath and newfilepath:
        for donode in AllNode:
            if donode.Class() == 'Read':
                donode.knob('frame').setValue(
                    '(frame-%s)*%s+%s' %
                    (oldfilepath, newfilepath, oldfilepath))
    else:
        for donode in AllNode:
            if donode.Class() == 'Read':
                donode.knob('frame').setValue('')
Ejemplo n.º 3
0
    def __init__(self):
        QtGui.QWidget.__init__(self)
        self.verticalLayout_2 = QtGui.QVBoxLayout(self)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.tableWidget = QtGui.QTableWidget(self)
        self.tableWidget.setObjectName("tableWidget")
        self.dirStructure = []
        self.newStructure = []
        self.count = 0

        nuke.selectAll()
        self.readNodes = []
        for n in nuke.selectedNodes('Read'):
            self.readNodes.append(n)

        sceneFullPath = nuke.root().name()
        basePath, baseName = sceneFullPath.split("/comp/scenes")

        baseName = baseName[1:-3]
        baseName = re.search('(.+?)(_v[0-9]{3})', baseName).group(1)
        baseName = baseName.replace("comp", "lig")

        imagesPath = "%s/lighting/images" % basePath
        self.existingDirs = [x for x in os.listdir(imagesPath) if "." not in x]

        self.verticalLayout_2.addWidget(self.tableWidget)
        self.getAll(imagesPath, "")
        self.reorderStructure()
        self.updateUI()
Ejemplo n.º 4
0
def matchAovs():
    node = nuke.thisNode()
    filenames = ''
    for i in range(node.inputs()):
        #path=node[string+'_file'].value()
        path = node.input(i)['file'].value()
        #first=node[string+'first'].value()
        first = node.input(i)['first'].value()
        #last=node[string+'last'].value()
        last = node.input(i)['last'].value()
        renderString = path.split(publishPath)[-1].split('/')[0]
        filepath = path.split('/')[-1]
        filenames += filepath.split('.')[0] + '\n'
        #parent='/'.join(path.split('/')[:-1])#old folder structure
        parent = '/'.join(path.split('/')[:-2])  #refactor
        dirs = os.listdir(parent)
        if i == 1 and "diffuse_color" in dirs:  #if utils, ignore diffuse color from utils
            dirs.remove("diffuse_color")
        print filepath, parent, dirs, i
        with node:
            nuke.selectAll()
            nuke.invertSelection()
            for n in nuke.allNodes('Read'):
                if n.name() in dirs:
                    n['file'].setValue(parent + '/' + n.name() + '/' +
                                       filepath.replace('beauty', n.name()))
                    n['first'].setValue(first)
                    n['last'].setValue(last)
        node['label'].setValue(
            '[lindex [split [lindex [split [value input0.file] /] end] .] 0]\n[lindex [split [lindex [split [value input1.file] /] end] .] 0]'
        )
        nodeName = "_".join(filepath.split('_')[:-3]) + "_REBUILD"
        print nodeName
Ejemplo n.º 5
0
def main():
    nSel = nuke.selectedNodes()
    nuke.selectAll()
    nuke.invertSelection()
    for n in nSel:
        #get other passes from selected Read
        buildGrp(n, 0)
def setPath():
    tmpWrite = nuke.createNode('WritePrism')
    tmpWrite.hideControlPanel()
    tmpWrite.knob('name').setValue('tmp_WP')
    fullPath = pcore.appPlugin.getOutputPath(
        nuke.toNode('tmp_WP').node("WritePrismBase"), nuke.selectedNode())
    #print fullPath

    relPath = fullPath.split('01_Workflow')[0]
    nuke.root()['project_directory'].setValue(relPath)

    for i in nuke.allNodes():
        nodeClass = i.Class()
        if nodeClass == 'Read':
            i.knob('selected').setValue(True)
            filename = i.knob('file').value()
            oldPath = filename.split('01_Workflow')[0]
            filename = filename.replace(oldPath, './')
            i.knob('file').setValue(filename)

    print "Project path is: \n" + relPath + "\n\nPath changed to relative."

    nuke.delete(tmpWrite)
    nuke.selectAll()
    nuke.invertSelection()
Ejemplo n.º 7
0
 def update(self):
     nuke.selectAll()
     nuke.invertSelection()
     a.nodeList[self.things.currentRow()].knob('selected').setValue(True)
     node = nuke.selectedNode()
     xC = node.xpos() + node.screenWidth() / 2
     yC = node.ypos() + node.screenHeight() / 2
     nuke.zoom(2, [xC, yC])
Ejemplo n.º 8
0
 def update(self):
     nuke.selectAll()
     nuke.invertSelection()
     a.nodeList[self.things.currentRow()].knob('selected').setValue(True)
     node = nuke.selectedNode()
     xC = node.xpos() + node.screenWidth()/2
     yC = node.ypos() + node.screenHeight()/2
     nuke.zoom( 2, [ xC, yC ])
Ejemplo n.º 9
0
def disconnectViewers():
    nuke.selectAll()
    nuke.invertSelection()

    for n in nuke.allNodes():
        if n.Class() == "Viewer":
            n['selected'].setValue(True)

    nuke.extractSelected()
 def MergRGBChannel():

    # Create Merge RGB Channel
	MergeRGB = nuke.createNode("Merge2", inpanel = False)
	MergeRGB['operation'].setValue('max')
	MergeRGB = nuke.selectConnectedNodes()
	for MergeRGB in nuke.selectedNodes():
	    nuke.autoplace(MergeRGB)
	nuke.selectAll()
Ejemplo n.º 11
0
def matchCutref():

    orig_sel = nuke.selectedNodes('Read')
    


    if len(orig_sel) < 1:
        
        nk_file = nuke.Root().name() #Q:/Impulse/IMP210/05_COMP/IMP210_017_070/IMP210_017_070_Comp_V002.nk
        if nk_file == 'Root':
            nuke.message('Untitled script. You can only run this command inside of a shot script. Or you must select a plate to run this on.')
            return
        shot_name = nk_file.split('/')[-2] #IMP210_017_070
        precomp_lut_dir = '/'.join(nk_file.split('/')[0:-1])+'/02_OUTPUT/01_precomp/'+shot_name+'_LUT.csp'
        print 'Creating matchgrade template based on nuke file name : {0}'.format(shot_name) 
        try:
            c = importAssets.ImportAssets().importCutrefs()[-1]
        except TypeError:
            nuke.message('Could not find a cutref for this shot.')
            c = nuke.createNode('NoOp', inpanel=False)  
            c.setSelected(False)
        try:
            p = importAssets.ImportAssets().importPlates()[0]
        except TypeError:
            nuke.message('Could not find a plate for this shot.')
            p = nuke.createNode('NoOp', inpanel=False)  
            p.setSelected(False)
        matchgrade_setup(precomp_lut_dir,p,c)

    else:
        for p in orig_sel:
            
            plate_file = p['file'].value() #Q:/Impulse/IMP210/01_PLATES/IMP210_017_070/PLATE/PLATE_O/01_EXRS/IMP210_017_070.####.exr
            proj_plate_dir = grabPattern(plate_file, r".*/01_PLATES/")
            shot_plate_dir = grabPattern(plate_file, r".*/01_PLATES/(\w)*/")
            if shot_plate_dir == '':
                nuke.message('Are you sure the selected node is EXR/DPX plate inside the 01_PLATES directory?')
                return
            shot_comp_dir = shot_plate_dir.replace('01_PLATES', '05_COMP')
            shot_name = shot_comp_dir.split('/')[-2]
            precomp_lut_dir = shot_comp_dir + '/02_OUTPUT/01_precomp/' + shot_name + '_LUT.csp'
            plate_file = plate_file.replace('01_PLATES', '05_COMP')
            plate_file = '/'.join(plate_file.split('/')[0::-1])
            
            print 'Creating matchgrade template based on selected read node : {0}'.format(shot_name)

            try:
                c = importAssets.ImportAssets().importCutrefs()[-1]
            except TypeError:
                nuke.message('Could not find a cutref for this shot.')
                c = nuke.createNode('NoOp', inpanel=False)  
                c.setSelected(False)

            nuke.selectAll()
            nuke.invertSelection()
            p.setSelected(True)
            matchgrade_setup(precomp_lut_dir, p, c)
Ejemplo n.º 12
0
def getMissingFrames(node):
    parent = os.path.dirname(node['file'].value())
    if len(nuke.getFileNameList(parent)) > 1:
        nuke.selectAll()
        nuke.invertSelection()
        node.setSelected(1)
        nuke.zoomToFitSelected()
        nuke.message('missing frames: ' +
                     ",".join(nuke.getFileNameList(parent)))
Ejemplo n.º 13
0
def buildCompScript(layerOrderFile, compScriptFile, isRunningFromScript):

    #imported nuke here as importing it outside was breaking argparse
    if not isRunningFromScript:
        import nuke

    #kept here if script is run from the comp itself
    if not os.path.isfile(layerOrderFile):
        print "Could not find layer_order.yml in " + shotDir
        sys.exit()

    if isRunningFromScript:
        # get nuke script to build
        nuke.scriptOpen(compScriptFile)

    # arrange templates in the given nuke script in vertical order
    templates = getTemplateList(layerOrderFile)

    for i, template in enumerate(templates):
        nuke.scriptReadFile(template)
        nuke.selectAll()
        node = nuke.selectedNodes("BackdropNode")[0]
        dotNode = nuke.selectedNodes('Dot')[0]
        if i > 0:
            bdNodes = node.getNodes()
            nodePrevX = node.xpos()
            nodePrevY = node.ypos()
            node.setYpos(previousNode.ypos() + 500)
            node.setXpos(previousNode.xpos())

            for n in bdNodes:
                if n.ypos() > nodePrevY:
                    n.setYpos(node.ypos() + (n.ypos() - nodePrevY))
                else:
                    n.setYpos(node.ypos() + (n.ypos() + nodePrevY))
                if n.xpos() > nodePrevX:
                    n.setXpos(node.xpos() + (n.xpos() - nodePrevX))
                else:
                    n.setXpos(node.xpos() + (n.xpos() + nodePrevX))

            if i > 1:
                dotNode.setInput(0, previousDotNode.dependent()[0])
            else:
                dotNode.setInput(0, previousDotNode)

        previousNode = node
        previousDotNode = dotNode

        if isRunningFromScript:
            #save nuke script
            nuke.scriptSave(compScriptFile)

        # remove temp files
        for template in templates:
            if "temp" in template:
                os.remove(template)
Ejemplo n.º 14
0
def buildCompScript(layerOrderFile, compScriptFile, isRunningFromScript):
    # kept here if script is run from the comp itself
    if not os.path.isfile(layerOrderFile):
        print "Could not find layer_order.yml in " + shotDir
        sys.exit()

    if not isRunningFromScript:
        nuke.scriptClear()
        # get nuke script to build
        nuke.scriptOpen(compScriptFile)
        nuke.selectAll()
        [nuke.delete(node) for node in nuke.selectedNodes()]

    # arrange templates in the given nuke script in vertical order
    templates = getTemplateList(layerOrderFile)

    for i, template in enumerate(templates):
        nuke.nodePaste(template)
        bdNodes = nuke.selectedNodes()
        node = nuke.selectedNodes("BackdropNode")[0]
        dotNode = nuke.selectedNodes('Dot')[0]

        if i > 0:
            bdNodes.remove(node)
            nodePrevX = node.xpos()
            nodePrevY = node.ypos()
            node.setYpos(previousNode.ypos() + 500)
            node.setXpos(previousNode.xpos())

            for n in bdNodes:
                if n.ypos() > nodePrevY:
                    n.setYpos(node.ypos() + (n.ypos() - nodePrevY))
                else:
                    n.setYpos(node.ypos() + (n.ypos() + nodePrevY))
                if n.xpos() > nodePrevX:
                    n.setXpos(node.xpos() + (n.xpos() - nodePrevX))
                else:
                    n.setXpos(node.xpos() + (n.xpos() + nodePrevX))

            if i > 1:
                dotNode.setInput(0, previousDotNode.dependent()[0])
            else:
                dotNode.setInput(0, previousDotNode)

        previousNode = node
        previousDotNode = dotNode

    if not isRunningFromScript:
        # save nuke script
        nuke.scriptSave(compScriptFile)
        # avoid opening GUI and getting extra nodes from previous script
        nuke.scriptClose()

    # remove temp files
    [os.remove(template) for template in templates if "temp" in template]
Ejemplo n.º 15
0
def versionDown():
    node = nuke.thisNode()
    path = node['file'].value()
    renderString = path.split(publishPath)[-1].split('/')[0]
    with node:
        nuke.selectAll()
        nuke.invertSelection()
        for n in nuke.allNodes('Read'):
            if renderString in n['file'].value():
                n.setSelected(1)
        versionTools.version_down()
Ejemplo n.º 16
0
def gq_enableAll():
    nuke.root().begin()
    nuke.selectAll()
    allNodes = nuke.selectedNodes()

    for node in allNodes:
        if node.knob("disable"):
            node.knob("disable").setValue(False)

        else:
            print(node.name() + " has no Disable")
Ejemplo n.º 17
0
def createArtifact():

    if nuke.GUI == True:

        filepath = nuke.value("root.name")
        nukescript = filepath[:-3]
        nuke.selectAll()
        nuke.nodeCopy(nukescript + '_artifact.nk')
        nukescripts.clear_selection_recursive()

    return
Ejemplo n.º 18
0
def gq_selectClass(self):
    userClasses = self.classInput.getValue()

    userClassesSplit = userClasses.split(" ")

    nuke.root().begin()
    nuke.selectAll()
    allNodes = nuke.root().selectedNodes()

    for node in allNodes:
        if node.Class() not in userClassesSplit:
            node.setSelected(False)
Ejemplo n.º 19
0
def showPublishTemplatePanel():

    # Add GUI elements
    panel = nuke.Panel("Publish Template", 450)

    currentScriptName = nuke.Root().name().split('/')[-1][0:-3]

    panel.addSingleLineInput("Script Name:", currentScriptName)
    panel.addFilenameSearch("Output Path:", "Select Output Path")
    panel.addEnumerationPulldown("Select Nodes:", "All Selected")
    panel.addButton("Cancel")
    panel.addButton("Publish Template")

    # Show GUI
    result = panel.show()

    #if user publishes the template
    if result == 1:

        outputPath = panel.value("Output Path:")
        scriptName = panel.value("Script Name:")
        outputNodes = panel.value("Select Nodes:")

        ##Check for output path errors
        if outputPath == "Select Output Path":
            nuke.message("Please select output path")
            showPublishTemplatePanel()

        #Check if user input is all or selected nodes
        if outputNodes == "All":  # ALL NODES IN THE CURRENT SCRIPT
            #pick all read nodes
            nodes = nuke.allNodes("Read")

            #select all the nodes
            nuke.selectAll()

            #copy selected nodes to a new nuke script
            nuke.nodeCopy(outputPath + scriptName + '.nk')
            return outputPath, scriptName, nodes
        else:
            ## Check if user has selected nodes
            if nuke.selectedNodes() == []:
                nuke.message("Please select the nodes.")
                #Don't bring up the tool
                return

            nodes = nuke.selectedNodes(
                "Read")  # SELECTED NODES IN THE CURRENT SCRIPT
            # copy selected nodes to a new nuke script
            nuke.nodeCopy(outputPath + scriptName + '.nk')

            return outputPath, scriptName, nodes
Ejemplo n.º 20
0
def nukeWriteNodes():
    # this finds all the write nodes in the scene and loads them into a table

    widget.ui.nuke_write_table.setRowCount(0)
    widget.ui.nuke_write_table.setColumnWidth(0, 23)
    i = 0
    nuke.selectAll()
    for n in nuke.selectedNodes('Write'):
        widget.ui.nuke_write_table.insertRow(i)
        node = QtGui.QTableWidgetItem(n['name'].value())
        #path = QtGui.QTableWidgetItem(n['file'].value())

        nodename = n['name'].value()
        filename = widget.ui.job_name.text()
        pathname = widget.ui.image_folder.text()
        path = pathname + "/" + nodename + "/" + filename + "_" + nodename + ".####.exr"
        print path

        nuke.toNode(nodename)['file'].setValue(path)

        font = QtGui.QFont()
        font.setPointSize(8)

        node.setFont(font)
        #path.setFont(font)

        disable = QtGui.QTableWidgetItem()
        createPath = QtGui.QTableWidgetItem()
        createPath.setIcon(foldericon)
        if n['disable'].value() == 1:
            disable.setIcon(nukecrossicon)
            disable.setText("off")
        elif n['disable'].value() == 0:
            disable.setIcon(nukecheckicon)
            disable.setText("on")
            filename = widget.ui.job_name.text()
            pathname = widget.ui.image_folder.text()
            nodepath = pathname + "/" + nodename
            nodepath = nodepath.replace("/", "\\")
            if os.path.isdir(nodepath) is False:
                os.makedirs(nodepath)

        disable.setTextAlignment(QtCore.Qt.AlignHCenter)

        widget.ui.nuke_write_table.setItem(i, 0, disable)
        widget.ui.nuke_write_table.setItem(i, 1, node)
        widget.ui.nuke_write_table.setItem(i, 2, createPath)

    widget.ui.nuke_write_table.itemChanged.connect(renameWriteNode)

    deselect()
Ejemplo n.º 21
0
def precomp_copyToGroup(precomp):

  ## group context is set to precomp, so back up one level.
  nuke.endGroup()

  g = nuke.nodes.Group()
  with precomp:
    nuke.selectAll()
    nuke.nodeCopy ( '%clipboard%' )

  with g:
    nuke.nodePaste( '%clipboard%' )

  for k in ['label', 'icon', 'indicators', 'tile_color', 'disable']:
    v =  precomp[k].getValue()
    if v:
      g[k].setValue( v )
Ejemplo n.º 22
0
def replaceNode(old,new,grp): 
    with grp:
        n=old
        # remove any previous selections to avoid unwanted wiring of the new node 
        nuke.selectAll() 
        nuke.invertSelection() 
        # create a new node of the replacement Class 
        c = new
        c.setXYpos(n.xpos(), n.ypos()) 
        # connect inputs 
        for i in range(n.inputs()): 
            c.setInput(i,n.input(i)) 
        # connect outputs 
        for d in n.dependent(nuke.INPUTS,forceEvaluate=False): 
            for input in [i for i in range(d.inputs()) if d.input(i) == n]: 
                d.setInput(input,c) 
        name=n.name()
        #delete original 
        nuke.delete(n) 
Ejemplo n.º 23
0
 def makeGroup(self):
     if len(self.lista) >= 2:
         nuke.selectAll()
         nuke.invertSelection()
         for shuffleknob in self.sGroup:
             shuffleknob['selected'].setValue(True)
         #for shuffleknob in self.readNodes:
         #shuffleknob['selected'].setValue(True)
         node = nuke.collapseToGroup(show=False)
         node['xpos'].setValue(self.mainBeautyLayer.xpos())
         node['ypos'].setValue(self.mainBeautyLayer.ypos() + 100)
         #node.autoplace()
         #gName = node.name()
         #nuke.tprint((self.mainBeautyLayer))
         #nuke.toNode(gName)["name"].setValue("Exr Merge %s" %'hello')
         #self.nIncrement += 1
         #node.lock_connections(True)
     else:
         pass
Ejemplo n.º 24
0
def doubleClick():
    if widget.ui.nuke_write_table.currentColumn() == 0:
        row = widget.ui.nuke_write_table.currentRow()
        rows = widget.ui.nuke_write_table.rowCount()
        item = widget.ui.nuke_write_table.currentItem()
        name = widget.ui.nuke_write_table.item(row, 1).text()

        nuke.selectAll()
        nodes = nuke.selectedNodes('Write')
        deselect()

        if item.text() == "on":
            for node in nodes:
                node['disable'].setValue(False)
            for x in range(rows):
                disable = QtGui.QTableWidgetItem()
                disable.setIcon(nukecheckicon)
                disable.setText("on")
                widget.ui.nuke_write_table.setItem(
                    x, 0, disable)  # change widget icon to X
            disable = QtGui.QTableWidgetItem()
            disable.setIcon(nukecrossicon)
            disable.setText("off")
            widget.ui.nuke_write_table.setItem(
                row, 0, disable)  # change widget icon back to enable
            nuke.toNode(name)['disable'].setValue(True)

        elif item.text() == "off":
            for node in nodes:
                node['disable'].setValue(True)  # disable all nuke write nodes
            for x in range(rows):
                disable = QtGui.QTableWidgetItem()
                disable.setIcon(nukecrossicon)
                disable.setText("off")
                widget.ui.nuke_write_table.setItem(
                    x, 0, disable)  # change widget icon to X
            disable = QtGui.QTableWidgetItem()
            disable.setIcon(nukecheckicon)
            disable.setText("on")
            widget.ui.nuke_write_table.setItem(
                row, 0, disable)  # change widget icon back to enable
            nuke.toNode(name)['disable'].setValue(False)
Ejemplo n.º 25
0
def addAssetGizmos(*args):
    global assetGizmos
    if len(args):
        assetGizmos = assetGizmos + '/' + args[0]
    nuke.selectAll()
    nuke.invertSelection()
    node = nuke.thisNode()
    addedGizmos = []
    assetMetadata = getMetadata('Asset')

    with node:
        for n in nuke.allNodes('NoOp'):
            if n.name().endswith("_OUT"):
                aov = n.name().split("_OUT")[0]
                gizmos = findAssetGizmos(aov, assetMetadata)
                lastNode = n.dependencies()[0]
                addedGizmos.extend(gizmos)
                for g in gizmos:
                    lastNode.setSelected(True)
                    giz = nuke.createNode(g, inpanel=False)
                    nuke.selectAll()
                    nuke.invertSelection()
                    giz.setInput(0, lastNode)
                    giz.setXYpos(lastNode.xpos(), lastNode.ypos() + 30)
                    giz['tile_color'].setValue(16711935)
                    lastNode = giz
                n.setInput(0, lastNode)
    if len(addedGizmos):
        nuke.message('ADDING ASSETS:\n' + "\n".join(addedGizmos))
        #show data
        aList = 'Assets:\n'
        for data in getMetadata2("Asset", node):
            aList += data + '\n'
        node['assetList'].setValue(aList)
        mList = 'Materials:\n'
        for data in getMetadata2("Material", node):
            mList += data + '\n'
        node['matList'].setValue(mList)
        eList = 'Existing:\n'
        for assetGizmo in getAssetGizmos2(node):
            eList += assetGizmo + '\n'
        node['existList'].setValue(eList)
Ejemplo n.º 26
0
def matchgrade_setup(outfile,plate,cutref):
    
    nuke.nodePaste("//qumulo/Libraries/HAL/LIVEAPPS/apps/Scripts/NUKE/scripts/MatchCutref.nk")

    for i in nuke.selectedNodes('MatchGrade'):
        i['outfile'].setValue(outfile)

    for i in nuke.selectedNodes('Dot'):
        if i['label'].value().lower() == 'plate':
            i.setInput(0,plate)
            plate['xpos'].setValue(i['xpos'].value() - plate.screenWidth()/2)
            plate['ypos'].setValue(i['ypos'].value() - plate.screenHeight()*2)
            
        if i['label'].value().lower() == 'cutref':
            i.setInput(0,cutref)
            cutref['xpos'].setValue(i['xpos'].value() - cutref.screenWidth()/2)
            cutref['ypos'].setValue(i['ypos'].value() - cutref.screenHeight()*2)
            
    
    nuke.selectAll()
    nuke.invertSelection()
Ejemplo n.º 27
0
def addAssets(grp):
    nuke.selectAll()
    nuke.invertSelection()
    addedGizmos = []
    for n in nuke.allNodes('NoOp'):
        if n.name().endswith("_OUT"):
            aov = n.name().split("_OUT")[0]
            gizmos = findAssetGizmos(aov, grp)
            lastNode = n.dependencies()[0]
            addedGizmos.extend(gizmos)
            for g in gizmos:
                lastNode.setSelected(True)
                giz = nuke.createNode(g, inpanel=False)
                nuke.selectAll()
                nuke.invertSelection()
                giz.setInput(0, lastNode)
                giz.setXYpos(lastNode.xpos(), lastNode.ypos() + 30)
                lastNode = giz
            n.setInput(0, lastNode)
    if len(addedGizmos):
        nuke.message('ADDING ASSETS:\n' + "\n".join(addedGizmos))
Ejemplo n.º 28
0
def flopViewer():
    """input process to flop the viewer"""
    allV = nuke.allNodes('Viewer')
    pV = allV[0]
    List = nuke.selectedNodes()
    nuke.selectAll()
    nuke.invertSelection()
    try:
        n = nuke.toNode('VIEWER_INPUT')
        if n.Class() == 'Mirror':
            n['Vertical'].setValue(not n['Vertical'].value())
            for i in allV:
                i['input_process'].setValue(not n['Vertical'].value() + n['Horizontal'].value() == 0)
            if n['Vertical'].value() + n['Horizontal'].value() == 0:
                nuke.delete(n)
            nuke.selectAll()
            nuke.invertSelection()
        else:
            nuke.message("Another Viewer Input already exists.\nAborting to avoid conflict")
        
    except:
        n = nuke.Node('Mirror',inpanel=False)
        n['xpos'].setValue(pV.xpos()+150)
        n['ypos'].setValue(pV.ypos())
        n['name'].setValue('VIEWER_INPUT')
        n['hide_input'].setValue(1)
        n['Vertical'].setValue(not n['Vertical'].value())
        nuke.selectAll()
        nuke.invertSelection()
        for i in List:
            i['selected'].setValue(True)
    for i in List:
        i['selected'].setValue(True)
Ejemplo n.º 29
0
    def collectFootage(self):

        self.name_ = os.path.join(self.path, self.finalName)
        os.mkdir(self.name_)
        self.nukeScriptName = self.name_ + '/' + self.finalName + '.nk'
        nuke.scriptSaveAs(self.nukeScriptName)

        #### Getting Filepaths, StartFrame and EndFrame from ReadNodes
        nuke.selectAll()
        self.tmpDir = []
        self.rs = []
        self.stF = []
        self.edF = []
        for elm in nuke.selectedNodes('Read'):
            self.rs.append(elm.knob('name').value())
            self.stF.append(elm.knob('first').value())
            self.edF.append(elm.knob('last').value())
            self.tmpDir.append(elm.knob('file').value())
        self.tmpF = []
        self.tmpD = []
        for el in self.tmpDir:
            self.tp = os.path.dirname(el)
            self.tmpD.append(self.tp + '/')
            self.lp = len(self.tp) + 1
            self.tmpF.append(el[self.lp:])

    #### Setting the Directory to save to
        self.sc = nuke.Root().name()
        self.scPath = os.path.dirname(nuke.Root().name())
        self.pl = len(os.path.dirname(nuke.Root().name())) + 1
        self.scName = self.sc[self.pl:-3]
        self.fdir = self.scName + '_Footage'
        self.fd = self.scPath + '/' + self.fdir
        os.mkdir(self.fd)
        self.ftdir = self.fd + '/'
        self.rdir = []
        for n in self.rs:
            os.mkdir(self.ftdir + n)
            self.rdir.append(self.ftdir + n + '/')
        self.CopyAndBag()
Ejemplo n.º 30
0
def do_LeftToRightImages_zwz():
    ErrorV = 0
    flagR = 0
    nuke.selectAll()
    AllNode = nuke.selectedNodes()
    for donode in AllNode:
        donode.setSelected(0)
    for donode in AllNode:
        if donode.Class() == 'Read':
            flagR += 1
            path = changePath_zwz(donode)
            if path:
                donode.knob('file').setValue(path)
            else:
                ErrorV = 1
    if flagR:
        if ErrorV:
            nuke.message(
                'Warning:\n1、Please check the existence of the right eye frame material\n2、Please check whether the correct naming material (containing camL)'
            )
    else:
        nuke.message('No material!')
Ejemplo n.º 31
0
    def create(self):
        for i, info in enumerate(self.infos):

            self.shot_code = info[0]
            self.base_path = info[1]

            cmps = self.get_comp()
            nuke.selectAll()
            nuke.invertSelection()
            for cmp in cmps:
                cmp['selected'].setValue(True)
                nuke.autoplace(cmp)
            #nuke.autoplace_all()
            #_autoplace()

            x = autoBackdrop.autoBackdrop()
            x['bdheight'].setValue(x['bdheight'].value() + 100)
            x['ypos'].setValue(x['ypos'].value() - 50)
            nuke.selectAll()
            nuke.invertSelection()

            p = self.get_plate()
            p['xpos'].setValue(x['xpos'].value() + 20)
            p['ypos'].setValue(x['ypos'].value() + 20)
            c = self.get_cutref()
            if c:
                c['xpos'].setValue(p['xpos'].value() + 100)
                c['ypos'].setValue(p['ypos'].value())
                c['selected'].setValue(True)
            p['selected'].setValue(True)

            x['label'].setValue(self.shot_code)
            x['ypos'].setValue(x['ypos'].value() - 40)
            x['bdheight'].setValue(x['bdheight'].value() + 40)
            #print nuke.selectedNode()['tile_color'].value()
            if i % 2:
                x['tile_color'].setValue(1431655935)
            else:
                x['tile_color'].setValue(2088533247)
Ejemplo n.º 32
0
def buildCompScript(layerOrderFile, compScriptFile):
    # get nuke script to build
    nuke.scriptOpen(compScriptFile)

    # arrange templates in the given nuke script in vertical order
    templates = getTemplateList(layerOrderFile)

    for i, template in enumerate(templates):
        nuke.scriptReadFile(template)
        nuke.selectAll()
        node = nuke.selectedNodes("BackdropNode")[0]
        dotNode = nuke.selectedNodes('Dot')[0]
        if i > 0:
            bdNodes = node.getNodes()
            nodePrevX = node.xpos()
            nodePrevY = node.ypos()
            node.setYpos(previousNode.ypos() + 500)
            node.setXpos(previousNode.xpos())

            for n in bdNodes:
                if n.ypos() > nodePrevY:
                    n.setYpos(node.ypos() + (n.ypos() - nodePrevY))
                else:
                    n.setYpos(node.ypos() + (n.ypos() + nodePrevY))
                if n.xpos() > nodePrevX:
                    n.setXpos(node.xpos() + (n.xpos() - nodePrevX))
                else:
                    n.setXpos(node.xpos() + (n.xpos() + nodePrevX))

            if i > 1:
                dotNode.setInput(0, previousDotNode.dependent()[0])
            else:
                dotNode.setInput(0, previousDotNode)

        previousNode = node
        previousDotNode = dotNode

        # save nuke script
        nuke.scriptSave(compScriptFile)
Ejemplo n.º 33
0
def prepare_current_project():
    global globalprogress
    global project_file_name
    global project_file_dir
    global backup_root_dir
    global backup_project_dir 
    global backup_project_name 

    nuke.selectAll();

    errorcnt 		= 0;

    backup_project_name = backup_root_dir + '/' + backup_project_dir 


    if os.path.lexists( backup_root_dir ) == False:
	os.mkdir( backup_root_dir )

    if os.path.lexists( backup_project_name ) == False:
	os.mkdir( backup_project_name )



    project_fps       = nuke.Root()['fps'].value()
    project_file_name = nuke.Root()['name'].value()
    project_file_dir  = nuke.root()['project_directory'].value() ;

    
    if  project_file_dir != "" :
        project_file_dir  = nuke.root()['project_directory'].value() + '/';
#//	+ '/'


    globalprogress = nuke.ProgressTask("Plemkes consolidator")
    globalprogress.setProgress(0)

    return 0
Ejemplo n.º 34
0
def selectSimilarType():
	if nuke.selectedNodes():
		nuke.selectSimilar(nuke.MATCH_CLASS)
	else:
		nuke.selectAll()
Ejemplo n.º 35
0
	def deselectAll(self):
		#Select All to invert the selection XD
		nuke.selectAll()
		nuke.invertSelection() 
Ejemplo n.º 36
0
def deselect_all():
	"""Deselect All"""

	#Select All to invert the selection XD
	nuke.selectAll()
	nuke.invertSelection()