Ejemplo n.º 1
0
        def showModalDialog(self):
            '''
		    Show the panel
		    '''
            result = nukescripts.PythonPanel.showModalDialog(self)
            nuke.removeKnobChanged(self.knobChanged)
            if not result:
                nodes = nuke.allNodes()
                for n in nodes:
                    for key, values in self.n_dic.iteritems():
                        if n == key:
                            if n.Class() == 'BackdropNode':
                                n['bdwidth'].setValue(values[2])
                                n['bdheight'].setValue(values[3])
                                n.setXYpos(
                                    int(values[0] -
                                        key['bdwidth'].value() / 2),
                                    int(values[1] -
                                        key['bdheight'].value() / 2))

                            else:
                                n.setXYpos(
                                    int(values[0]) - key.screenWidth() / 2,
                                    int(values[1]) - key.screenHeight() / 2)
                return
Ejemplo n.º 2
0
 def ytStop(self):
     if self.gangModifierRunning:
         self.selectedNodes = []
         self.files = {}
         nuke.removeKnobChanged(self.run)
         self.gangModifierRunning = False
         self.icon.setStatus(ytVariables.ytIcon.ytIcon_status_stopped)
         yl.info('gangModifier is stoped')
Ejemplo n.º 3
0
 def removeNukeCallback(self):
     '''remove method from Nuke callback list'''
     yl.debug('nukeDestroyNodeCallback')
     if '*' in nuke.onCreates and (self.nukeCreateNodeCallback, (), {}, None) in nuke.onCreates['*']:
         nuke.removeOnCreate(self.nukeCreateNodeCallback)
     if '*' in nuke.onDestroys and (self.nukeDestroyNodeCallback, (), {}, None) in nuke.onDestroys['*']:
         nuke.removeOnDestroy(self.nukeDestroyNodeCallback)
     if '*' in nuke.knobChangeds or (self.nukeSelectionCallback, (), {}, None) in nuke.knobChangeds['*']:
         nuke.removeKnobChanged(self.nukeSelectionCallback)
Ejemplo n.º 4
0
    def onScriptClose (self) :
        log ("onScriptClose")
        nuke.removeOnDestroy (self.onDestroy)
        nuke.removeKnobChanged (self.knobChanged)

        if (self.rvc.connected) :
            log ("    disconnecting from rv")
            #self.rvc.disconnect()
            self.running = False
            log ("    sleeping after disconnect")
            time.sleep (0.3)
Ejemplo n.º 5
0
    def onScriptClose(self):
        log("onScriptClose")
        nuke.removeOnDestroy(self.onDestroy)
        nuke.removeKnobChanged(self.knobChanged)

        if (self.rvc.connected):
            log("    disconnecting from rv")
            #self.rvc.disconnect()
            self.running = False
            log("    sleeping after disconnect")
            time.sleep(0.3)
Ejemplo n.º 6
0
def toggleKiss():
    '''
	globally toggle enable/disable the kiss function
	save node data
	'''

    #save all nodenames, positions and dimensions
    for node in nuke.allNodes():
        nodeName.append(node.name())
        nodeX.append(node.xpos())
        nodeY.append(node.ypos())
        nodeWidth.append(node.screenWidth())
        nodeHeight.append(node.screenHeight())

    #toggle KISS
    if nuke.KISS == False:
        nuke.KISS = True
        nuke.addKnobChanged(kissNodes)
        print "enable kiss"
    else:
        nuke.KISS = False
        nuke.removeKnobChanged(kissNodes)
        print "disable kiss"
Ejemplo n.º 7
0
def reveal_in_finder():
    """
	点击删除按钮,删除面板按钮和这个tab
	click the delete button delete this tab
	点击reveal in finder在文件浏览器中查看路径对应文件
	click the reveal in finder open the file path in file explore
	:return:
	"""
    node = nuke.thisNode()
    knob = nuke.thisKnob()
    knobs = node.knobs()
    if knob.name() == "deletetheKnob":
        print("testfile")
        nuke.removeKnobChanged(knob, node=node)
        node.removeKnob(knob)
        node.removeKnob(knobs["revealInFinder"])
        node.removeKnob(knobs["custom"])
    if knob.name() == "revealInFinder":
        path = os.path.dirname(node["file"].getValue())
        if os.path.isdir(path):
            open_folder(path)
        else:
            nuke.message("can not open in finder")
Ejemplo n.º 8
0
def toggleKiss():
	'''
	globally toggle enable/disable the kiss function
	save node data
	'''

	#save all nodenames, positions and dimensions
	for node in nuke.allNodes():
		nodeName.append(node.name())
		nodeX.append(node.xpos())
		nodeY.append(node.ypos())
		nodeWidth.append(node.screenWidth())
		nodeHeight.append(node.screenHeight())

	#toggle KISS
	if nuke.KISS==False:
		nuke.KISS=True
		nuke.addKnobChanged(kissNodes)
		print "enable kiss"
	else:
		nuke.KISS=False
		nuke.removeKnobChanged(kissNodes)
		print "disable kiss"
Ejemplo n.º 9
0
  out = nuke.toNode ("iFilterFinalMerge")
  iFilterSwitch = nuke.toNode ('iFilterSwitch')
  out.setInput (1, creaKey)
  iFilterSwitch.setInput (0, creaKey)
    
####Fora del loop reposiciono els ultims nodes d'expressio i de Blur pa posar-los al comensament i que els cables no es creuin
  nom.knob("xpos").setValue (-10)
  nom.knob("ypos").setValue (100)

  blr.knob("xpos").setValue (-10)
  blr.knob("ypos").setValue (150)

####info
  a.knob("info").setValue (".:  Current filter: "+str(filter)+" with "+str(int(float(steps)))+" steps  (Click button to update ...) :.")




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)
    
#nuke.addKnobChanged (knobChanged, nodeClass='Group')
nuke.removeKnobChanged (knobChanged, nodeClass='Group')
Ejemplo n.º 10
0
    def restoreBegin(self):
        log("restoreBegin")

        nuke.removeKnobChanged(self.knobChanged)
        nuke.removeOnCreate(self.onCreate)
        nuke.removeOnDestroy(self.onDestroy)
Ejemplo n.º 11
0
	def changeNodeColor(thisName):
		if nuke.thisNode().name() == thisName:
			nuke.executeInMainThread(nuke.toNode(thisName)['tile_color'].setValue,552079871)
			nuke.executeInMainThread(nuke.toNode(thisName)['postage_stamp'].setValue,True)
			nuke.removeKnobChanged(changeNodeColor,thisName,{},"Write")
Ejemplo n.º 12
0
 def removeCallback(self):
     nuke.removeKnobChanged(PythonPanelKnobChanged,
                            args=self,
                            nodeClass='PanelNode',
                            node=self.__node)
Ejemplo n.º 13
0
def kissNodes():
	'''
	kiss function
	check if selectedNode is near other nodes. 
	If so then connect the input of the selectedNode to the nearby node
	'''

	sel = nuke.selectedNodes()
	nodeToConnect=""
	nX=0
	nY=0
	tollerance=30

	# selected node's position data
	if len(sel) > 0 and nuke.KISS==True:
		actNode = sel[0]
		nX = actNode.xpos()
		nY = actNode.ypos()

	#check for overlap between selected node and nearby nodes
	for i in range(0,len(nodeName)):
		if nX>=nodeX[i]-tollerance and nX <= ( nodeX[i] + nodeWidth[i]+tollerance):
			if nY>=nodeY[i]-100 and nY <= ( nodeY[i] + nodeHeight[i]+tollerance):
				if actNode.name() != nodeName[i] and nodeName[i] != "":
	
					nodeToConnect = nuke.toNode(nodeName[i])

					if nY < nodeY[i]:
						'''
						selected node is higher than the nearby node
						connect output of selected node to input of nearby node
						'''
						if (actNode.maxOutputs()>0):

							if nodeToConnect.maxInputs()>0:
								'''
								connect the next available input
								check which input is free and count
								'''
								k=0
								for inp in range(0,nodeToConnect.inputs()):
									if nodeToConnect.input(k)!=None:
										k+=1
									else:
										break

								nodeToConnect.setInput(k,actNode)
								nuke.removeKnobChanged(kissNodes)
								nuke.KISS=False

					else:
						'''
						selected node is under the nearby node
						connect input of selected node to output of nearby node
						'''
						if (actNode.maxInputs()>0):
							
							if nodeToConnect.maxOutputs()>0:
								'''
								connect the next available input
								check which input is free and count
								'''
								k=0
								for inp in range(0,actNode.inputs()):
									if actNode.input(k)!=None:
										k+=1
									else:
										break

								actNode.setInput(k,nodeToConnect)
								nuke.removeKnobChanged(kissNodes)
								nuke.KISS=False
									
					#no expression arrows
					try:
						_internal_expression_arrow_cmd()
					except:
						pass		
					break
Ejemplo n.º 14
0
def pv2_removeCallbacks():
	import nuke
	nuke.removeKnobChanged(pv2_UIKnobChanged, nodeClass = 'Group') 
Ejemplo n.º 15
0
    iFilterSwitch = nuke.toNode('iFilterSwitch')
    out.setInput(1, creaKey)
    iFilterSwitch.setInput(0, creaKey)

    ####Fora del loop reposiciono els ultims nodes d'expressio i de Blur pa posar-los al comensament i que els cables no es creuin
    nom.knob("xpos").setValue(-10)
    nom.knob("ypos").setValue(100)

    blr.knob("xpos").setValue(-10)
    blr.knob("ypos").setValue(150)

    ####info
    a.knob("info").setValue(".:  Current filter: " + str(filter) + " with " +
                            str(int(float(steps))) +
                            " steps  (Click button to update ...) :.")


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)


#nuke.addKnobChanged (knobChanged, nodeClass='Group')
nuke.removeKnobChanged(knobChanged, nodeClass='Group')
Ejemplo n.º 16
0
def pv2_removeCallbacks():
	import nuke
	nuke.removeKnobChanged(pv2_UIKnobChanged, nodeClass = 'Group') 
            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)

#Adding callback
nuke.removeKnobChanged(knobChanged, nodeClass='dushyant_info_watermark_node')

nuke.addKnobChanged(knobChanged, nodeClass='dushyant_info_watermark_node')

def watermark_main(what, type, text, file, path):

    deselect()
    if len(what) == 0:
        nuke.message('Nothing selected')
        return
    for selected in what:
        if selected.Class() == 'Read':
            watermark_proc(selected, type, text, file, path)
        else:
            nuke.message( 'works only on read nodes, skipping %s' % selected['name'].getValue() )
    else:
Ejemplo n.º 18
0
    def restoreBegin (self) :
        log ("restoreBegin")

        nuke.removeKnobChanged (self.knobChanged)
        nuke.removeOnCreate (self.onCreate)
        nuke.removeOnDestroy (self.onDestroy)
            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)


#Adding callback
nuke.removeKnobChanged(knobChanged, nodeClass='dushyant_info_watermark_node')

nuke.addKnobChanged(knobChanged, nodeClass='dushyant_info_watermark_node')


def watermark_main(what, type, text, file, path):

    deselect()
    if len(what) == 0:
        nuke.message('Nothing selected')
        return
    for selected in what:
        if selected.Class() == 'Read':
            watermark_proc(selected, type, text, file, path)
        else:
            nuke.message('works only on read nodes, skipping %s' %
Ejemplo n.º 20
0
 def stop(self):
     self.selectedNodes = []
     self.files = {}
     nuke.removeKnobChanged(self.run)
     self.gangModifierRunning = False
     yl.info('gangModifyer is stoped')
Ejemplo n.º 21
0
def kissNodes():
    '''
	kiss function
	check if selectedNode is near other nodes. 
	If so then connect the input of the selectedNode to the nearby node
	'''

    sel = nuke.selectedNodes()
    nodeToConnect = ""
    nX = 0
    nY = 0
    tollerance = 30

    # selected node's position data
    if len(sel) > 0 and nuke.KISS == True:
        actNode = sel[0]
        nX = actNode.xpos()
        nY = actNode.ypos()

    #check for overlap between selected node and nearby nodes
    for i in range(0, len(nodeName)):
        if nX >= nodeX[i] - tollerance and nX <= (nodeX[i] + nodeWidth[i] +
                                                  tollerance):
            if nY >= nodeY[i] - 100 and nY <= (nodeY[i] + nodeHeight[i] +
                                               tollerance):
                if actNode.name() != nodeName[i] and nodeName[i] != "":

                    nodeToConnect = nuke.toNode(nodeName[i])

                    if nY < nodeY[i]:
                        '''
						selected node is higher than the nearby node
						connect output of selected node to input of nearby node
						'''
                        if (actNode.maxOutputs() > 0):

                            if nodeToConnect.maxInputs() > 0:
                                '''
								connect the next available input
								check which input is free and count
								'''
                                k = 0
                                for inp in range(0, nodeToConnect.inputs()):
                                    if nodeToConnect.input(k) != None:
                                        k += 1
                                    else:
                                        break

                                nodeToConnect.setInput(k, actNode)
                                nuke.removeKnobChanged(kissNodes)
                                nuke.KISS = False

                    else:
                        '''
						selected node is under the nearby node
						connect input of selected node to output of nearby node
						'''
                        if (actNode.maxInputs() > 0):

                            if nodeToConnect.maxOutputs() > 0:
                                '''
								connect the next available input
								check which input is free and count
								'''
                                k = 0
                                for inp in range(0, actNode.inputs()):
                                    if actNode.input(k) != None:
                                        k += 1
                                    else:
                                        break

                                actNode.setInput(k, nodeToConnect)
                                nuke.removeKnobChanged(kissNodes)
                                nuke.KISS = False

                    #no expression arrows
                    try:
                        _internal_expression_arrow_cmd()
                    except:
                        pass
                    break