View difference between Paste ID: 06azNCzx and NzStQNhk
SHOW: | | - or go back to the newest paste.
1
import nuke
2
import nukescripts
3
import threading
4
5
class tmpPanel(nukescripts.PythonPanel):
6-
	def __init__(self):
6+
7
    def __init__(self):
8-
		nukescripts.PythonPanel.__init__(self, "tmp panel")
8+
9-
		self.writes = nuke.Enumeration_Knob("writes", "writes", ["Write1", "Write2"])
9+
        nukescripts.PythonPanel.__init__(self, "tmp panel")
10-
		self.render = nuke.PyScript_Knob("render", "render")
10+
        self.writes = nuke.Enumeration_Knob("writes", "writes", [node.name() for node in self.getWrites()])
11
        self.render = nuke.PyScript_Knob("render", "render")
12-
		for i in [self.writes, self.render]:
12+
13-
			self.addKnob(i)
13+
        for i in [self.writes, self.render]:
14
            self.addKnob(i)
15-
	def knobChanged(self, knob):
15+
16-
		if knob is self.render:
16+
    def knobChanged(self, knob):
17-
			self.renderWrites()
17+
18
        if knob is self.render:
19-
	def renderWrites(self):
19+
            self.renderWrites()
20
21-
		writeNode = self.writes.value()
21+
    def renderWrites(self):
22
23-
		nuke.execute(nuke.toNode(writeNode), 1, 5, 1)
23+
        writeNode = self.writes.value()
24
        node = nuke.toNode(writeNode)
25
        threading.Thread(target = nuke.execute, args= (node , 1, 5, 1)).start()
26
27
    def getWrites(self): 
28
       
29
        return (node for node in nuke.allNodes() if node.Class() == "Write")
30
        
31
tmpPanel().show()