Package nukescripts :: Package pyQtExamples :: Module pyQtRender2
[hide private]
[frames] | no frames]

Source Code for Module nukescripts.pyQtExamples.pyQtRender2

 1  # Copyright (c) 2009 The Foundry Visionmongers Ltd.  All Rights Reserved. 
 2  # This example assumes that PyQt was built and setup with Nuke's Qt Version 
 3  # !! It will only work in this situation !!  
 4  # otherwise use the other example PyQtRender.py 
 5  import sys, os.path 
 6  import nuke 
 7   
 8  from PyQt4 import QtCore, QtGui, uic 
 9   
10 -class pyQtRenderDialog(object):
11 - def __init__(self):
12 # Set up the user interface from Designer. 13 self.ui = uic.loadUi(os.path.join(os.path.dirname(nukescripts.__file__), "pyQtExamples", "pyQtRender.ui")) 14 self.ui.connect(self.ui.renderButton, QtCore.SIGNAL("clicked()"), self.render) 15 nuke.addOnCreate(self.onCreateCallback)
16
17 - def showUI(self):
18 self.ui.show()
19
20 - def onCreateCallback(self):
21 n = nuke.thisNode() 22 if n.Class() == "Write": 23 n.setName(n.name()) 24 self.addItem(n)
25
26 - def addItem(self, n):
27 item = QtGui.QTreeWidgetItem() 28 item.setText(0, n['name'].value()) 29 self.ui.treeWidget.addTopLevelItem(item)
30
31 - def render(self):
32 selectedItems = self.ui.treeWidget.selectedItems() 33 writeNodes = [j for i in selectedItems for j in nuke.allNodes() if j.Class() == "Write" and j['name'].value() == i.text(0)] 34 for i in writeNodes: 35 i['Render'].execute()
36
37 -def initRenderDialog():
38 dialog = pyQtRenderDialog() 39 dialog.showUI()
40