1
2
3
4 import sys, os.path
5 from nukescripts import pyQtAppUtils, utils
6 import nuke
7
9 from PyQt4 import QtCore, QtGui, uic
10
11 class pyQtRenderDialog(object):
12 def __init__(self):
13
14 self.ui = uic.loadUi(os.path.join(os.path.dirname(nukescripts.__file__), "pyQtExamples", "pyQtRender.ui"))
15 self.ui.connect(self.ui.renderButton, QtCore.SIGNAL("clicked()"), self.render)
16 nuke.addOnCreate(self.onCreateCallback)
17 self.ui.show()
18
19 def onCreateCallback(self):
20 n = nuke.thisNode()
21 if n.Class() == "Write":
22 n.setName(n.name())
23 self.addItem(n)
24
25 def addItem(self, n):
26 item = QtGui.QTreeWidgetItem()
27 item.setText(0, n['name'].value())
28 self.ui.treeWidget.addTopLevelItem(item)
29
30 def render(self):
31 selectedItems = self.ui.treeWidget.selectedItems()
32 writeNodes = [j for i in selectedItems for j in nuke.allNodes() if j.Class() == "Write" and j['name'].value() == i.text(0)]
33 for i in writeNodes:
34 utils.executeInMainThread(i['Render'].execute)
35
36 app = pyQtApp.getApplication(appArgv)
37 dialog = pyQtRenderDialog()
38 app.exec_()
39
44