コード例 #1
1
def setup_cryptomatte():
    nuke.addKnobChanged(lambda: cryptomatte_knob_changed_event(
        nuke.thisNode(), nuke.thisKnob()), nodeClass='Cryptomatte')
    nuke.addKnobChanged(lambda: encryptomatte_knob_changed_event(
        nuke.thisNode(), nuke.thisKnob()), nodeClass='Encryptomatte')
    nuke.addOnCreate(lambda: encryptomatte_on_create_event(
        nuke.thisNode(), nuke.thisKnob()), nodeClass='Encryptomatte')
コード例 #2
0
ファイル: gpsNodes.py プロジェクト: all-in-one-of/icarus
def w_presets_callback():
    """ Callback function to fill write nodes automatically with standard GPS presets.
	"""
    writeNode = nuke.thisNode()
    if nuke.thisKnob().name() == 'write_presets':
        presetType = nuke.thisKnob().value()
        w_global_preset(writeNode, presetType)
        filePath = w_path_preset(writeNode, presetType)
        if presetType in ('CG_Comp', 'Precomp', 'Roto', 'Elements'):
            w_fileName_preset(writeNode,
                              filePath,
                              presetType,
                              'exr',
                              proxy=True)
            w_exr_preset(writeNode)
        elif presetType in ('Comp', 'Plate_Raw', 'Plate_Graded'):
            w_fileName_preset(writeNode,
                              filePath,
                              presetType,
                              'dpx',
                              proxy=True)
            w_dpx_preset(writeNode)
        elif presetType == 'Plate_CG':
            w_fileName_preset(writeNode,
                              filePath,
                              presetType,
                              'jpg',
                              proxy=True)
            w_jpg_preset(writeNode)
        return presetType
コード例 #3
0
def setup_cryptomatte():
    nuke.addKnobChanged(lambda: cryptomatte_knob_changed_event(
        nuke.thisNode(), nuke.thisKnob()), nodeClass='Cryptomatte')
    nuke.addKnobChanged(lambda: encryptomatte_knob_changed_event(
        nuke.thisNode(), nuke.thisKnob()), nodeClass='Encryptomatte')
    nuke.addOnCreate(lambda: encryptomatte_on_create_event(
        nuke.thisNode(), nuke.thisKnob()), nodeClass='Encryptomatte')
コード例 #4
0
def updateWriteName(n=""):
    kname = ''
    if nuke.thisKnob():
        kname = nuke.thisKnob().name()

    if nuke.toNode("L_PROJECT") and kname != 'selected':
        if not n:
            n = nuke.thisNode()

        pn = nuke.toNode("L_PROJECT")

        pwrite = pn.knob('proot').getValue() + pn.knob('pproject').getValue(
        ) + '/' + pn.knob('pshot').getValue() + '/out/'
        pwritename = pn.knob('pproject').getValue() + '_' + pn.knob(
            'pshot').getValue() + '_'

        pwrite += pn.knob('ptask').getValue() + '/'
        pwritename += pn.knob('ptask').getValue() + '_'

        if n.knob("pre").getValue():
            pwrite += 'pre/'
            pwritename += 'prerender_'

        if n.knob("preLabel").getValue():
            prelabel = re.sub(r'[\s]', '', n.knob("preLabel").getValue())
            n.knob("preLabel").setValue(prelabel)
            pwrite += prelabel + '/'
            pwritename += prelabel + '_'

        versionnumber = '001'

        if n.knob("versionOverride").getValue():
            versionnumber = re.sub(r'[\D]', '',
                                   n.knob("versionOverride").getValue())
            n.knob("versionOverride").setValue(versionnumber)

        elif nuke.root().name():
            versionnumber = re.search("v\d+",
                                      os.path.basename(
                                          nuke.root().name())).group()[1:]

        pwrite += 'v' + versionnumber + '/'
        pwritename += 'v' + versionnumber + '.####.'

        pwrite += n.knob('file_type').value() + '/'
        pwritename += n.knob('file_type').value()

        n.knob('file').setValue(pwrite + pwritename)
コード例 #5
0
def channelMixer_knobChangedCallback():
    mainKnob = nuke.thisKnob()
    channels = re.findall('()[RGB])_([RGB])', mainKnob.name())
    if not channels:
        return
    channels = channels[0]
    chList = ['R', 'G', 'B']
    chList.pop(chList.index(channels[1]))

    depKnobs = [
        nuke.thisNode()["{0}_{1}".format(channels[0], k)] for k in chList
    ]

    R = mainKnob.getValue()
    Gi = depKnobs[0].getValue()
    Bi = depKnobs[1].getValue()

    G = (1 - R) / 2 if Gi == Bi == 0 else Gi * (1 - R) / (Gi + Bi)
    B = 1 - R - B

    depKnobs[0].setValue(G)
    depKnobs[1].setValue(B)

    nuke.addKnobChanged(channelMixer_knobChangedCallback,
                        nodeClass='channelMixer')
コード例 #6
0
def onPrefsKnobChanged():
    """ Callback from the preferences node.  If the default localisation 
  policy has changed, update it on the read nodes.
  """
    knob = nuke.thisKnob()
    if knob.name() == kLocalizationPolicyDefaultKnob:
        updateReadKnobLocalisationDefaults(knob.value())
コード例 #7
0
def ch_merge_out():
    """channel output for merge node"""
    n = nuke.thisNode()
    k = nuke.thisKnob()

    rgbOnly = [
        'plus',
        'minus',
        'multiply',
        'hypot',
        'color-dodge',
        'color-burn',
        'average',
        'geometric',
        'overlay',
        'soft-light',
    ]

    if k:
        if k.name() == 'operation':
            if k.value() in rgbOnly:
                n['output'].setValue('rgb')
            else:
                n['output'].setValue('rgba')
    else:
        if n['operation'].value() in rgbOnly:
            n['output'].setValue('rgb')
        else:
            n['output'].setValue('rgba')
コード例 #8
0
def knobChanged():
    n = nuke.thisNode()
    k = nuke.thisKnob()

    if k.name() == 'opt_knob':
        if k.value() == 'text':
            n.begin()
            nuke.toNode('watermark_image')['file'].setValue('')
            n.end()

            n['w_text_knob'].setEnabled(True)
            n['wm_file'].setEnabled(False)

            n['tiles'].setValue(7.4)
            n['translate'].setValue(
                [nuke.Root().width() / 2, -nuke.Root().height() / 2])
            n['rotate'].setValue(34)
            n['scale'].setValue(6.3)
        elif k.value() == 'image':
            n.begin()

            nuke.toNode('watermark_image')['file'].fromScript(
                '[value parent.wm_file]')
            n.end()
            n['w_text_knob'].setEnabled(False)
            n['wm_file'].setEnabled(True)

            n['tiles'].setValue(7.4)
            n['translate'].setValue([0, 0])
            n['rotate'].setValue(0)
            n['scale'].setValue(1)
コード例 #9
0
def insert_pt():
    max_pts = int(nuke.thisNode().knob('Max PTS').value())
    MAX_POINTS = int(nuke.thisNode().knob('Max Limit').value())

    if max_pts >= MAX_POINTS:
        nuke.message('Maximum %i points' % (MAX_POINTS))
        return

    pt_num = int(nuke.thisKnob().name()[6:])
    node = nuke.thisNode()

    # Shuffle values upwards
    for pt in xrange(max_pts, pt_num, -1):
        knob_name = 'pt' + str(pt)
        prev_knob = 'pt' + str(pt - 1)
        prev_value = node.knob(prev_knob).value()
        node.knob(knob_name).setValue(prev_value)

    # Set new position to midpoint of adjacent points
    if pt_num > 1:
        ptA = node.knob('pt' + str(pt_num - 1)).value()
    else:
        ptA = node.knob('Start').value()
    ptB = node.knob('pt' + str(pt_num + 1)).value()
    midpoint = [sum(x) / 2 for x in zip(ptA, ptB)]

    node.knob('pt' + str(pt_num)).setValue(midpoint)

    # Reveal next row
    for name in ('pt', 'delete', 'insert'):
        node.knobs()[name + str(max_pts)].setVisible(True)

    node.knob('Max PTS').setValue(max_pts + 1)
コード例 #10
0
    def wrapper(*args, **kwargs):
        knob = nuke.thisKnob()
        if knob is not None:
            if knob.name() in ['xpos', 'ypos', 'selected']:
                return

        return callback(*args, **kwargs)
コード例 #11
0
ファイル: texTab.py プロジェクト: jonntd/dmptools
def refreshTab():
    node = nuke.thisNode()
    knob = nuke.thisKnob()
    if knob:
        # to do when the file knob is changed
        if knob.name():
            texExists, texFile = checkTex()
            if texExists and texFile and node['texConvertCheckbox'].getValue():
                text = 'Tex file found - will be replaced'
                node.knob('checkTex').setValue("<FONT COLOR=\"green\">"+text+"<\FONT>")
            if texExists and texFile and not node['texConvertCheckbox'].getValue():
                text = 'Tex file found'
                node.knob('checkTex').setValue("<FONT COLOR=\"green\">"+text+"<\FONT>")
            if not texExists and texFile:
                text = 'Tex file NOT found'
                node.knob('checkTex').setValue("<FONT COLOR=\"red\">"+text+"<\FONT>")
            if not texExists and texFile and node['texConvertCheckbox'].getValue():
                text = 'Tex file NOT found - will be created'
                node.knob('checkTex').setValue("<FONT COLOR=\"red\">"+text+"<\FONT>")
            if not texExists and not texFile:
                text = 'Tex file NOT found - please fill the file knob'
                node.knob('checkTex').setValue("<FONT COLOR=\"red\">"+text+"<\FONT>")
    else:
        text = '[file not set]'
        node.knob('checkTex').setValue("<FONT COLOR=\"black\">"+text+"<\FONT>")
コード例 #12
0
def pv2_UIKnobChanged():
    import nuke
    knobName = nuke.thisKnob().name()
    if knobName in [
            'pv2_getCameraList', 'pv2_cameraList', 'pv2_refreshEmitterList',
            'pv2_addSelectedObj', 'pv2_emitterList', 'pv2_lockCardToDropDown'
    ]:
        workingNode = nuke.thisNode()
        workingNodeName = nuke.thisNode().name()

        if knobName == 'pv2_getCameraList':
            pv2_getCamerasPress(knobName, workingNode, workingNodeName)

        elif knobName == 'pv2_cameraList':
            pv2_setCam(knobName, workingNode, workingNodeName)

        elif knobName == 'pv2_refreshEmitterList':
            pv2_emitterListRefresh(knobName, workingNode, workingNodeName)

        elif knobName == 'pv2_addSelectedObj':
            pv2_addSelectedNodeToEmitters(knobName, workingNode,
                                          workingNodeName)

        elif knobName == 'pv2_emitterList':
            pv2_emitterObjSelect(knobName, workingNode, workingNodeName)

        elif knobName == 'pv2_lockCardToDropDown':
            pv2_cardLockTo(knobName, workingNode, workingNodeName)
コード例 #13
0
ファイル: TX_Ramp.py プロジェクト: z199416/nuke.env
def getId():
    thisAddBT = nuke.thisKnob().name()
    if thisAddBT == 'start_add':
        id = 0
    else:
        id = int(thisAddBT.strip('p_adremov'))
    return id
コード例 #14
0
def main():
    knob = nuke.thisKnob()
    try:
        obj = knob_Curve(knob)
        obj.Set_value_in_knob()
    except:
        pass
コード例 #15
0
ファイル: TX_Ramp.py プロジェクト: RonThomas/nuke.env
def getId():
	thisAddBT = nuke.thisKnob().name()
	if thisAddBT == 'start_add':
		id = 0
	else:
		id = int(thisAddBT.strip('p_adremov'))
	return id
コード例 #16
0
def insert_pt():
    max_pts = int(nuke.thisNode().knob('Max PTS').value())
    MAX_POINTS = int(nuke.thisNode().knob('Max Limit').value())

    if max_pts >= MAX_POINTS:
        nuke.message('Maximum %i points' % (MAX_POINTS))
        return

    pt_num = int(nuke.thisKnob().name()[6:])
    node = nuke.thisNode()

    # Shuffle values upwards
    for pt in range(max_pts, pt_num, -1):
        knob_name = 'pt' + str(pt)
        prev_knob = 'pt' + str(pt - 1)
        node[knob_name].fromScript(node[prev_knob].toScript())

    # Set new position to midpoint of adjacent points
    if pt_num > 1:
        ptA = node.knob('pt' + str(pt_num - 1)).value()
    else:
        ptA = node.knob('Start').value()
    ptB = node.knob('pt' + str(pt_num + 1)).value()
    midpoint = [sum(x) / 2 for x in zip(ptA, ptB)]

    node.knob('pt' + str(pt_num)).clearAnimated()
    node.knob('pt' + str(pt_num)).setValue(midpoint)

    # Reveal next row
    for name in ('pt', 'delete', 'insert'):
        node.knobs()[name + str(max_pts)].setVisible(True)

    node.knob('Max PTS').setValue(max_pts + 1)
コード例 #17
0
    def knobChanged(self):

        knob = nuke.thisKnob()
        if knob.name() != 'selected':
            return

        node = nuke.thisNode()

        # Prune any that were selected, that arent selected any more
        toRemove = []
        for n in self.__selectedNodes:
            if not n['selected'].getValue():
                toRemove.append(n)

        for t in toRemove:
            self.__selectedNodes.remove(t)

        # Add in our current selection
        if knob.getValue():
            self.__selectedNodes.add(node)
        else:
            if node in self.__selectedNodes:
                self.__selectedNodes.remove(node)

        self.nodesChanged()
コード例 #18
0
def onChange():
    '''knob change function to call'''

    n = nuke.thisNode()
    k = nuke.thisKnob()

    if k.name() in ['mu_type','tx_passname']:
        verType = get_type(n)
        set_versions(n, verType)

        if n['mu_type'].value() not in NO_PASSNAME:
            n['tx_passname'].setVisible(True)
        else:
            n['tx_passname'].setVisible(False)

        n['mu_ver'].setValue(max(n['mu_ver'].values()))
        set_file(n, verType, n['mu_ver'].value())

    if k.name() in ['mu_ver']:
        verType = get_type(n)

        if n['mu_ver'].value() == max(n['mu_ver'].values()):
            n['tx_versionLabel'].setVisible(True)
        else:
            n['tx_versionLabel'].setVisible(False)

        set_file(n, verType, n['mu_ver'].value())

    if k.name() == 'mu_type' and k.value() == 'delivery':
        n['tile_color'].setValue(12533759)
    else:
        n['tile_color'].setValue(0)
コード例 #19
0
ファイル: nkCallback.py プロジェクト: kybin/nuke-script
def changeEverySelectedKnobs():
    node = nuke.thisNode()
    if node not in nuke.Root().nodes():
        # there are many nodes that we can't see, cull them.
        return

    if node.Class() == "BackdropNode":
        # I will not treat Backdrop as a Normal Node.
        return

    knob = nuke.thisKnob()
    kname, kval = knob.name(), knob.value()
    if kname in [
        "xpos",
        "ypos",
        "selected",
        "name",
        "hidePanel",
        "showPanel",
        "label",
        "scene_view",
        "note_font_size",
        "inputChange",
        "bdwidth",
        "bdheight",
    ]:
        return

    print("command node : {0}".format(node.name()))
    print("{0} : {1}".format(kname, kval))

    for n in nuke.selectedNodes():
        n[kname].setValue(kval)
コード例 #20
0
def updateTemplate():
    thisNode = nuke.thisNode()
    # nuke.root().begin()
    if nuke.selectedNodes():
        for sel_node in nuke.selectedNodes():
            if sel_node.Class() == 'Read':
                # oldpass = sel_node['file'].getValue().split('_')[-2]
                nuke.root().end()
                new_path = thisNode['new_path'].getValue()
                pass_list = nuke.getFileNameList(new_path)
                thisknob = nuke.thisKnob().name()

                if thisknob == 'custom':
                    pass_name = thisNode.knob('pass_name').getValue()
                else:
                    pass_name = thisknob
                our_pass = [s for s in pass_list if pass_name in s]

                if our_pass == []:
                    nuke.message('Pass not found !')
                else:
                    sel_node['file'].fromUserText(new_path + str(our_pass[0]))

            elif sel_node:
                if sel_node.name() == thisNode.name():
                    nuke.message('Don\'t select this node !')
            else:
                nuke.message("Select a node first.")
コード例 #21
0
def knobChanged():
    n = nuke.thisNode()
    k = nuke.thisKnob()

    if k.name() == 'opt_knob':
        if k.value() == 'text':
            n.begin()
            nuke.toNode('watermark_image')['file'].setValue('')
            n.end()

            n['w_text_knob'].setEnabled(True)
            n['wm_file'].setEnabled(False)

            n['tiles'].setValue(7.4)
            n['translate'].setValue([nuke.Root().width()/2, -nuke.Root().height()/2])
            n['rotate'].setValue(34)
            n['scale'].setValue(6.3)
        elif k.value() == 'image':
            n.begin()

            nuke.toNode('watermark_image')['file'].fromScript('[value parent.wm_file]')
            n.end()
            n['w_text_knob'].setEnabled(False)
            n['wm_file'].setEnabled(True)

            n['tiles'].setValue(7.4)
            n['translate'].setValue([0, 0])
            n['rotate'].setValue(0)
            n['scale'].setValue(1)
コード例 #22
0
ファイル: nextVersion.py プロジェクト: simonjokuschies/nuke
def performCustomAction():
	
	node = nuke.thisNode()
	knob = nuke.thisKnob()

	fileValue = node["file"].getValue()
	renderPath = os.path.dirname(fileValue)

	#reveal in explorer
	if knob.name() == "reveal in explorer":
		if renderPath!="":
			try:
				if platform.system() == "Windows":
					os.startfile(renderPath)
				elif platform.system() == "Darwin":
					subprocess.Popen(["open", renderPath])
				else:
					subprocess.Popen(["xdg-open", renderPath])
			except:
				nuke.message("couldn't open render path. No such directory")
		else:
			nuke.message("Please make sure to set a render path")

	#create next version
	if knob.name() == "create next version":	
		if renderPath != "":
			nukescripts.clear_selection_recursive()
			node.setSelected(True)
			nukescripts.version_up()
			node.setSelected(False)

			fileValue = node["file"].getValue()
			renderPath = os.path.dirname(fileValue)

			if not os.path.isdir(renderPath):
				os.makedirs(renderPath)
				nuke.message("successfully versioned up")
			else:
				nuke.message("Renderfolder '%s' seems to exist" % renderPath)
		else:
			nuke.message("Please make sure to set a render path")

	#force create directory
	if knob.name() == "force create directory":
		if renderPath != "":	
			if not os.path.isdir(renderPath):
				os.makedirs(renderPath)
				nuke.message("successfully created render directory at: \n\n%s" % renderPath)
			else:
				nuke.message("render directory exists")	
		else:
			nuke.message("Please make sure to set a render path")
	
	#save backup
	if knob.name() == "save backup":
		if knob.getValue() == 1.0:
			node["beforeRender"].setValue("nextVersion.saveBackup('%s')" % node.name())
		else:
			node["beforeRender"].setValue("")
コード例 #23
0
ファイル: shotAssembler.py プロジェクト: kiryha/AnimationDNA
 def knobChanged(self,knob):
     if nuke.thisKnob().name() == "ASSEMBLE":
         global codePart,codeSequence,codeShot #set codePart,codeSequence.codeShot as global variables
         codePart =  self.reel.getValue()
         codeSequence =  self.seq.getValue()
         codeShot =  self.shot.getValue()
         buildShotDic() 
         assemble() 
コード例 #24
0
 def knobChanged(self, knob):
     if nuke.thisKnob().name() == "ASSEMBLE":
         global codePart, codeSequence, codeShot  #set codePart,codeSequence.codeShot as global variables
         codePart = self.reel.getValue()
         codeSequence = self.seq.getValue()
         codeShot = self.shot.getValue()
         buildShotDic()
         assemble()
コード例 #25
0
def knobChanged():
    k = nuke.thisKnob()  # knob that was just changed
    # LUT selection changed, update LUT node file path
    if k.name() == 'lut_pulldown':
        _main().setLut()
    # project set, load list of luts
    elif k.name() == 'project':
        _main().getLuts()
コード例 #26
0
ファイル: getKnobName.py プロジェクト: kuchinal/lamakaha
def getKnobName():
    n = nuke.thisNode()
    k = nuke.thisKnob()
    s_text = k.name()
    from PySide import QtCore, QtGui
    qclip = QtGui.QApplication.clipboard()
    qclip.clear()
    qclip.setText(s_text)
コード例 #27
0
def Fader():
    curFrameA = nuke.frame()
    inFrame = nuke.frame() - 1
    outFrame = nuke.frame() + 1
    n = nuke.thisNode()
    k = nuke.thisKnob()
    curValue = k.getValue()
    k.setAnimated()

    class ShapePanel(nukescripts.PythonPanel):
        def __init__(self):
            nukescripts.PythonPanel.__init__(self, 'Fader menu')

            self.Value = nuke.Array_Knob("value", 'value', 4)
            self.Value.setValue(0, 0)
            self.Value.setValue(curValue, 1)
            self.Value.setValue(curValue, 2)
            self.Value.setValue(0, 3)

            self.Frame = nuke.Array_Knob("frame", 'frame', 4)
            self.Frame.setValue(inFrame, 0)
            self.Frame.setValue(curFrameA, 1)
            self.Frame.setValue(curFrameA, 2)
            self.Frame.setValue(outFrame, 3)

            self.Check = nuke.Boolean_Knob('Delete Current Animation')
            self.addKnob(self.Check)

            for k in (self.Frame, self.Value):
                self.addKnob(k)

    ### displays panel
    p = ShapePanel()
    p.showModalDialog()

    ### checks the checkerboard and deletes the animation if selected
    getCheck = p.Check.value()

    if getCheck == True:
        for curve in k.animations():
            curve.clear()

    ### creates the animation
    inV = p.Value.value(0)
    inF = p.Frame.value(0)
    k.setValueAt(inV, inF)

    curV = p.Value.value(1)
    curF = p.Frame.value(1)
    k.setValueAt(curV, curF)

    curVopt = p.Value.value(2)
    curFopt = p.Frame.value(2)
    k.setValueAt(curVopt, curFopt)

    outV = p.Value.value(3)
    outF = p.Frame.value(3)
    k.setValueAt(outV, outF)
コード例 #28
0
ファイル: menu.py プロジェクト: Rotomator/noid
def write_knobChanged():
    node = nuke.thisNode()
    knob = nuke.thisKnob()

    if knob.name() == "lock":
        if knob.value() == 1:
            node['file'].setEnabled(False)
        else:
            node['file'].setEnabled(True)
コード例 #29
0
ファイル: watermark.py プロジェクト: TDChina/NukeClass3
def on_knob_changed():
    n = nuke.thisNode()
    k = nuke.thisKnob()
    if k.name() == 'inputChange':
        if n.inputs() and n.input(0).Class() == 'Read':
            fname = show_read_file_name(n)
            add_checkbox_by_name(n, fname)
        else:
            clear_name(n)
コード例 #30
0
def stabilize():
    node = nuke.thisGroup() 
    t = node['S']
    h = node['HighPass']

    if t.value() == 0:
       nuke.thisKnob().setLabel('<font color="Red"><b>Stabilized')
       t.setValue(1)
       nuke.toNode("StabFrameHold")['disable'].setValue(0)
       nuke.toNode("StabFrameHold")['first_frame'].setValue(node['refFrame'].value())
       nuke.toNode("StabRef")['first_frame'].setValue(node['refFrame'].value())
       nuke.toNode("StabSwitch")['disable'].setValue(0)
    else:
       nuke.thisKnob().setLabel('Stabilize')
       t.setValue(0)
       h.setValue(0)
       nuke.toNode("StabFrameHold")['disable'].setValue(1)
       nuke.toNode("StabSwitch")['disable'].setValue(1)
コード例 #31
0
ファイル: iFilter03.py プロジェクト: z199416/nuke.env
def knobChanged():
    n = nuke.thisNode()
    k = nuke.thisKnob()
    filter = n["Filter"].value()
    steps = n['Steps'].value()
    previousAmount = n['previousAmount'].value()

    if k.name() == 'Steps':
        iFilter03(filter, steps, previousAmount)
コード例 #32
0
def pythonKnobEdit():
    if nuke.thisKnob().name() == 'showPanel':  # TODO: is there a 'knob added' knobchanged?
        node = nuke.thisNode()
        global timer
        timer = QtCore.QTimer()
        timer.setSingleShot(True)
        timer.setInterval(10)
        timer.timeout.connect(partial(addTextKnobs, node))
        timer.start()
コード例 #33
0
ファイル: spillsuppress.py プロジェクト: liaokongVFX/thorium
 def disable_channel_mix_callback():
     """Disables the channel mix average float if `useMax` is checked"""
     # Stop any knob except `useMax` from triggering
     if nuke.thisKnob().name() != 'useMax':
         return
     else:
         node = nuke.thisNode()
         useMax = node['useMax']
         node['chanMix'].setEnabled(not useMax.value())
コード例 #34
0
ファイル: iFilter03.py プロジェクト: RonThomas/nuke.env
def knobChanged():
  n = nuke.thisNode()
  k = nuke.thisKnob()
  filter = n["Filter"].value()
  steps = n['Steps'].value()
  previousAmount = n['previousAmount'].value()
 
  if k.name() == 'Steps':
    iFilter03 (filter, steps, previousAmount)
コード例 #35
0
ファイル: nk_gui.py プロジェクト: adrianloh/nk_module
	def callback():
		k = nuke.thisKnob()
		name, v = k.name(), k.value()
		if not deltas.has_key(name):
			deltas[name] = v
			d = deltas[name]
		else:
			d = diff(v,deltas[name])
			deltas[name] = v
		[n[name].setValue(add(n[name].value(),d)) for n in nuke._allNodes() if n['selected'].value() and n!=control and n.knobs().has_key(name)]
コード例 #36
0
def knob_key():
    f = nuke.frame()
    knob = nuke.thisKnob()
    value = knob.getValue()
    knob.setAnimated()
    if not isinstance(value, (list, tuple)):
        value = [value]
    for i in range(int(f - 1), int(f + 2)):
        for x in xrange(len(value)):
            knob.setValueAt(value[x], i, x)
コード例 #37
0
ファイル: revealInFinder.py プロジェクト: hanas001/.nuke
def reveal_in_finder():
    node = nuke.thisNode()
    knob = nuke.thisKnob()

    if knob.name() == "revealInFinder":
        path = os.path.dirname(node["file"].getValue())
        if os.path.isdir(path):
            open_folder(path)
        else:
            nuke.message("no such path")
コード例 #38
0
def setup_cryptomatte():
    nuke.addKnobChanged(lambda: cryptomatte_knob_changed_event(
        nuke.thisNode(), nuke.thisKnob()), nodeClass='Cryptomatte')

    if nuke.GUI:
        toolbar = nuke.menu("Nodes")
        automatte_menu = toolbar.addMenu("Cryptomatte", "cryptomatte_logo.png")
        automatte_menu.addCommand("Cryptomatte", "import cryptomatte_utilities as cu; cu.cryptomatte_create_gizmo();")
        automatte_menu.addCommand("Decryptomatte All", "import cryptomatte_utilities as cu; cu.decryptomatte_all();")
        automatte_menu.addCommand("Decryptomatte Selection", "import cryptomatte_utilities as cu; cu.decryptomatte_selected();")
コード例 #39
0
def forward_one_zero():
    """
    Animate selected knob's value at current frame to 1 and next frame to 0.
    :return: None
    :rtype: None
    """
    knob = nuke.thisKnob()
    knob.setAnimated()
    knob.setValueAt(1, previous_current_next_frame()[1])
    knob.setValueAt(0, previous_current_next_frame()[2])
コード例 #40
0
def backward_zero_one():
    """
    Animate selected knob's value at previous frame to 0 and current frame to 1.
    :return: None
    :rtype: None
    """
    knob = nuke.thisKnob()
    knob.setAnimated()
    knob.setValueAt(0, previous_current_next_frame()[0])
    knob.setValueAt(1, previous_current_next_frame()[1])
コード例 #41
0
def file_type_changed():
    node = nuke.thisNode()
    knob = nuke.thisKnob()

    if knob.name() == "file_type":
        try:
            path = node["file"].value()
            node["file"].setValue("{0}.{1}".format(
                os.path.splitext(path)[0], knob.value()))
        except:
            pass
コード例 #42
0
ファイル: default.py プロジェクト: simonjokuschies/nuke
def resetToDefault():
	'''
	reset to standard knob default value
	'''

	n = nuke.thisNode()
	k = nuke.thisKnob()

	k.setValue(k.defaultValue())
	nuke.knobDefault("{node}.{knob}".format(node=n.Class(), knob=k.name()), "{val}".format(val=k.defaultValue()))
	updateKnobInit(n.Class(),k.name(),"","del")
コード例 #43
0
def revealInFinder():
	'''
	get filepath and reveal src in finder
	'''

	n = nuke.thisNode()
	k = nuke.thisKnob()
	if k.name() == "revealInFinder":
		f = n.knob("file").value()
		path = "/".join(f.split("/")[:-1])
		openFolder(path)
コード例 #44
0
ファイル: pipelNukeMenu.py プロジェクト: skarone/PipeL
def mergeColor():
	n = nuke.thisNode()
	k = nuke.thisKnob()
	if k.name() == "mix":
		v = k.value()
		green = v
		red = 1 - int(v)
		r = red
		g = green
		b = 0
		hexColour = int('%02x%02x%02x%02x' % (r*255,g*255,b*255,1),16)
		n["tile_color"].setValue(hexColour)
コード例 #45
0
ファイル: panoTool.py プロジェクト: jonntd/dmptools
def _add_callback_on_knob():
    node = nuke.thisNode()
    knob = nuke.thisKnob()
    if knob.name() == 'cameras':
        for n in nuke.allNodes():
            if 'PanoTool_camera' in n.name():
                nuke.delete(n)
        camerasN = knob.value()
        print camerasN
        for i in range(float(camerasN)):
            initalRotation = int(360/camerasN)
            createCamera(node, i, i*initalRotation)
コード例 #46
0
ファイル: default.py プロジェクト: simonjokuschies/nuke
def createDefault():
	'''
	create custom knobDefault value
	'''

	n = nuke.thisNode()
	k = nuke.thisKnob()
	
	#set default for current nuke session
	nuke.knobDefault("{node}.{knob}".format(node=n.Class(), knob=k.name()), "{val}".format(val=k.value()))

	# set 
	updateKnobInit(n.Class(),k.name(),k.value(),"write")
コード例 #47
0
ファイル: menu.py プロジェクト: jwesstrom/nukeStuffaroni
def multiselectCallback():
    global multiSelect
    if multiSelect:
        n = nuke.thisNode()
        k = nuke.thisKnob()
        nodes = nuke.selectedNodes()
        dontbother=['selected','xpos','ypos'] # might need to add to this list
        if (not(k.name() in dontbother) and (n in nodes)): # node is selected, and knob is not in ignored list
            # this is nice for debugging:
            # print str(k.name()) +' : '+ str(k.value()) 
            for node in nuke.selectedNodes():
                if node is not n:
                    if k.name() in node.knobs().keys():
                        node.knob(k.name()).setValue(k.value())
コード例 #48
0
ファイル: read.py プロジェクト: skarone/PipeL
def fillVersions():
	"""docstring for fillVersions"""
	settings = sti.Settings()
	gen = settings.General
	node = nuke.thisNode()
	knob = nuke.thisKnob()
	if gen:
		basePath = gen[ "basepath" ]
		if basePath:
			if basePath.endswith( '\\' ):
				basePath = basePath[:-1]
			prj.BASE_PATH = basePath.replace( '\\', '/' )
		renderPath = gen[ "renderpath" ]
	if not node[ 'seqSel' ].value() == '0':
		node[ '_version' ].setValues( sh.Shot( node[ 'shotSel' ].value(),sq.Sequence( node[ 'seqSel' ].value(), prj.Project( node[ 'projectSel' ].value() ))).renderedLayerVersions( renderPath, node[ 'layerSel' ].value() ) )
コード例 #49
0
ファイル: autoRender.py プロジェクト: gobomus/toolset
def sb_autoRenderKnobChanged():

	n = nuke.thisNode()
	k = nuke.thisKnob()

	if k.name() in ["xpos", "ypos", "selected", "onCreate", "onDestroy"]:
		return

	# If not a sb_autoRender node, return.
	try:
		n["sb_autoRender"]
	except:
		return

	if k.name() == "rootFolderMethod":
		
		rfui = n["rootFolderUserInput"]
		crfp = n["customRootFolderPath"]
		
		if n["rootFolderMethod"].value() == "search word":
			rfui.setVisible(True)
			rfui.setLabel("search word")
			crfp.setVisible(False)
		elif n["rootFolderMethod"].value() == "environment variables":
			rfui.setVisible(True)
			rfui.setLabel("env variables/path")
			crfp.setVisible(False)
		elif n["rootFolderMethod"].value() == "custom path":
			rfui.setVisible(False)
			crfp.setVisible(True)

	if k.name() == "renderName":

		if n["renderName"].value() == "custom name":
			n["customName"].setVisible(True)
		else:
			n["customName"].setVisible(False)

	if k.name() == "use_ocio":

		if n["use_ocio"].value():
			n["colorspace"].setEnabled(False)
			n["raw"].setEnabled(False)
			n["raw"].setValue(True)
		else:
			n["colorspace"].setEnabled(True)
			n["raw"].setEnabled(True)
			n["raw"].setValue(False)
コード例 #50
0
def updateVersionKnob():
    '''
    Add as callback to list versions per type in Read node's user knob
    In menu.py or init.py:
       nuke.addKnobChanged( fin_assetManager.updateVersionKnob, nodeClass='Read' )  
    '''
    node = nuke.thisNode()
    knob = nuke.thisKnob()

    # RUN ONLY IF THE TYPE KNOB CHANGES OR IF THE NODE PANEL IS OPENED.
    if not knob or knob.name() in [ 'versionType', 'showPanel' ]:
        # GET THE VERSION DICTIONARY
        versionDict = getVersions()
        # POPULATE THE VERSION KNOB WITH THE VERSIONS REQUESTED THROUGH THE TYPE KNOB
        node['_version'].setValues( versionDict[ node['versionType'].value() ] )
        # SET THE A VALUE TO THE FIRST ITEM IN THE LIST
        node['_version'].setValue(0)
コード例 #51
0
ファイル: am_nuke.py プロジェクト: pixo/hk
def hkAssetChanged ():
    n = nuke.thisNode()
    k = nuke.thisKnob()
    name = k.name()

    params = hkGetParams ( n.Class () )

    values = list ()
    if name in params :

        for i in range ( params.index ( name ), len ( params ) ) :
            param = params[i]
            values = hkAssetUpdate ( param = param )

        hkSetNodes ()

    elif name in ( "repository", "extension", ) :
        hkAssetUpdateAll ( node = n )
コード例 #52
0
ファイル: nodes.py プロジェクト: chippey/dpa-pipe
def read_sub_knob_changed(node=None, knob=None):

    if not node:
        node = nuke.thisNode()

    if not knob:
        knob = nuke.thisKnob()

    if knob.name() == 'product_repr_select':
        product_repr_str = node['product_repr_select'].value()

        if (product_repr_str == DEFAULT_REPR_STR or 
            product_repr_str not in PRODUCT_REPR_STR_TO_PATH):
            node['product_seq_select'].setValues([])
            node['file'].setValue('')
            return

        repr_dir = PRODUCT_REPR_STR_TO_PATH[product_repr_str]

        # populate the possible file names
        file_specs = {}
        frame_regex = re.compile('([,\w]+).(\d{4})\.(\w+)')
        for file_name in os.listdir(repr_dir):
            
            matches = frame_regex.search(file_name)
            if matches:
                (file_base, frame_num, file_ext) = matches.groups()
                spec = file_base + '.####.' + file_ext
                file_specs[spec] = None

        file_specs = sorted(file_specs.keys())
        node['product_seq_select'].setValues(file_specs)

        file_str = os.path.join(repr_dir, file_specs[0]) 
        node['file'].setValue(file_str)

    if knob.name() == 'product_seq_select':
        
        repr_dir = os.path.dirname(node['file'].value())
        file_spec = node['product_seq_select'].value()

        file_str = os.path.join(repr_dir, file_spec)
        
        node['file'].setValue(file_str)
コード例 #53
0
def knobChange():
    G = nuke.thisNode()
    K = nuke.thisKnob()
    
    if K.name() == 'shotList':
        try:
            shot = K.value()
            NukeSequenceManager().setShot(shot)
        except:
            pass
            
    if K.name() == 'sceneList':
        try:
            scene = K.value()
            NukeSequenceManager().refreshShots(scene)
            G.knob('jobname').setValue("<FONT COLOR=\"#33EE5E\">"+os.getenv('JOB')+" "+scene+"<\FONT>")
            G.knob('label').setValue("[python os.getenv('JOB')] - [python os.getenv('SCENE')]/[python os.getenv('SHOTNAME')]")
        except:
            pass
コード例 #54
0
ファイル: nukeCallbacks.py プロジェクト: elliottjames/jeeves
def findChangedKnob():
    knob = nuke.thisKnob()
    node = nuke.thisNode()
    if knob.name() == 'renderType':
	output_type = knob.value()
	if output_type == 'matte':
	    nuke.tprint ('matte selected')
	    output_path = '[value dirName]/[value renderType]/[value fileName]/[value fileName].%04d.tiff'
	    node['file'].setValue(output_path)
	    node['file_type'].setValue('tiff')
	    node['datatype'].setValue('8')
	    node['colorspace'].setValue('srgb')
	    node['channels'].setValue('alpha')
	elif output_type in ['slapcomp', 'prerender', 'cleanup']:
	    output_path = "[value dirName]/[value renderType]/[value fileName]/[value fileName].%04d.dpx"
	    node['file'].setValue(output_path)
	    node['file_type'].setValue('dpx')
	    node['colorspace'].setValue('linear')
	    node['datatype'].setValue('10')
	    node['channels'].setValue('rgb')
コード例 #55
0
def delete_pt():
    max_pts = int(nuke.thisNode().knob('Max PTS').value()) - 1

    if max_pts < 2:
        nuke.message('Minimum 2 points')
        return

    pt_num = int(nuke.thisKnob().name()[6:])
    node = nuke.thisNode()

    for pt in xrange(pt_num, max_pts):
        knob_name = 'pt' + str(pt)
        next_knob = 'pt' + str(pt + 1)
        next_value = node.knob(next_knob).value()
        node.knob(knob_name).setValue(next_value)

    node.knob('pt' + str(max_pts)).setValue([0, 0])

    for name in ('pt', 'delete', 'insert'):
        node.knobs()[name + str(max_pts)].setVisible(False)

    node.knob('Max PTS').setValue(max_pts)
コード例 #56
0
ファイル: read.py プロジェクト: skarone/PipeL
def updateVersionKnob():
	'''
	Add as callback to list versions per type in Read node's user knob
	In menu.py or init.py:
	   nuke.addKnobChanged( nuk.general.read.updateVersionKnob, nodeClass='Read' )  
	'''
	"""update list of version of the render in the node"""
	node = nuke.thisNode()
	knob = nuke.thisKnob()

	# RUN ONLY IF THE TYPE KNOB CHANGES OR IF THE NODE PANEL IS OPENED.
	settings = sti.Settings()
	gen = settings.General
	if gen:
		basePath = gen[ "basepath" ]
		if basePath:
			if basePath.endswith( '\\' ):
				basePath = basePath[:-1]
			prj.BASE_PATH = basePath.replace( '\\', '/' )
		renderPath = gen[ "renderpath" ]
	#UPDATE SEQUENCES BECAUSE PROJECTSEL HAS CHANGE
	if not knob or knob.name() in [ 'projectSel', 'showPanel' ]:
		node[ 'seqSel' ].setValues( [s.name for s in prj.Project( node[ 'projectSel' ].value() ).sequences] )

	#UPDATE SHOTS BECAUSE SEQSEL HAS CHANGE
	if not node[ 'seqSel' ].value() == '0' or not node[ 'seqSel' ].value() == '':
		if not knob or knob.name() in [ 'seqSel', 'showPanel' ]:
			node[ 'shotSel' ].setValues( [ s.name for s in sq.Sequence( node[ 'seqSel' ].value(), prj.Project( node[ 'projectSel' ].value() )).shots ]  )
	
	#UPDATE SHOTS BECAUSE SEQSEL HAS CHANGE
	if not node[ 'shotSel' ].value() == '0' or not node[ 'shotSel' ].value() == '':
		if not knob or knob.name() in [ 'shotSel', 'showPanel' ]:
			node[ 'layerSel' ].setValues( sh.Shot( node[ 'shotSel' ].value(),sq.Sequence( node[ 'seqSel' ].value(), prj.Project( node[ 'projectSel' ].value() ))).renderedLayers( renderPath ) )

	#UPDATE SHOTS BECAUSE SEQSEL HAS CHANGE
	if not node[ 'shotSel' ].value() == '0' or not node[ 'shotSel' ].value() == '':
		if not knob or knob.name() in [ 'layerSel', 'showPanel' ]:
			node[ '_version' ].setValues( sh.Shot( node[ 'shotSel' ].value(),sq.Sequence( node[ 'seqSel' ].value(), prj.Project( node[ 'projectSel' ].value() ))).renderedLayerVersions( renderPath, node[ 'layerSel' ].value() ) )
コード例 #57
0
def pv2_UIKnobChanged():
	import nuke
	knobName = nuke.thisKnob().name()
	if knobName in ['pv2_getCameraList','pv2_cameraList','pv2_refreshEmitterList','pv2_addSelectedObj','pv2_emitterList', 'pv2_lockCardToDropDown'] :
		workingNode = nuke.thisNode()
		workingNodeName = nuke.thisNode().name()
			
		if knobName == 'pv2_getCameraList' :
			pv2_getCamerasPress(knobName, workingNode, workingNodeName)
			
		elif knobName == 'pv2_cameraList' :
			pv2_setCam(knobName, workingNode, workingNodeName)
			
		elif knobName == 'pv2_refreshEmitterList':
			pv2_emitterListRefresh(knobName, workingNode, workingNodeName)
			
		elif knobName == 'pv2_addSelectedObj':
			pv2_addSelectedNodeToEmitters(knobName, workingNode, workingNodeName)
			
		elif knobName == 'pv2_emitterList':
			pv2_emitterObjSelect(knobName, workingNode, workingNodeName)
			
		elif knobName == 'pv2_lockCardToDropDown':
			pv2_cardLockTo(knobName, workingNode, workingNodeName)
コード例 #58
0
def resize_to_grid():
    n = nuke.thisNode();
    k = nuke.thisKnob();
    if knob_to_grid(k, 'bdwidth', grid_width) or knob_to_grid(k, 'bdheight', grid_height):
        nuke.autoplaceSnap(n)
コード例 #59
0
ファイル: viewerSync.py プロジェクト: ThoriumGroup/thorium
def sync_viewers(viewers):
    """Syncs all the given viewers to the settings on the caller node.

    This is the primary callback for viewerSync. Through it, the actual sync
    happens. Before the callback executes, we compare the calling knob to a
    list of knobs that viewerSync is concerned about. If the caller knob isn't
    on the white-list, or the calling knob isn't currently set to sync (via the
    caller node's settings) we return early.

    Otherwise we sync the knob values for the knob that called us.

    Args:
        viewers : [str]
            This list of absolute viewer names will be resolved into
            <nuke.nodes.Viewer>s, which will be synced to the caller
            node's knob values.

    Returns:
        None

    Raises:
        N/A

    """

    caller = nuke.thisNode()
    caller_knob = nuke.thisKnob().name()

    # We need to check what knob is calling us first- if that knob isn't a
    # syncing knob, we'll return.
    if caller_knob not in ['inputChange', 'knobChanged']:
        if caller_knob not in SYNC_DEFAULTS.keys() + VIEWER_SYNC_KNOBS:
            return

        if caller_knob not in VIEWER_SYNC_KNOBS:
            if not caller['vs_{knob}'.format(knob=caller_knob)].value():
                # Sync setting is false for this knob
                return

    # Grab our viewer nodes and remove any that have been deleted.
    viewer_nodes = [
        nuke.toNode(viewer) for viewer in viewers if nuke.toNode(viewer)
    ]

    if caller_knob in VIEWER_SYNC_KNOBS:
        # Sync setting and continue
        _sync_knob(caller, viewer_nodes, caller_knob)
        if caller[caller_knob].value():
            caller_knob = caller_knob.replace('vs_', '')

    if caller_knob in ['inputChange', 'inputs']:
        if caller['vs_inputs'].value():
            for viewer in viewer_nodes:
                for i in xrange(caller.inputs()):
                    viewer.setInput(i, caller.input(i))
        return
    elif caller_knob == 'knobChanged':
        knob_list = [
            knob for knob in SYNC_DEFAULTS.keys() if SYNC_DEFAULTS[knob]
        ]
    else:
        knob_list = [caller_knob]

    # Update remaining viewers to point at our current node.
    for knob in knob_list:
        _sync_knob(caller, viewer_nodes, knob)