Jausn
08-30-2010, 06:28 AM
Hi, guys. I want to make a Panel to do something.
This is my Test PyPanel created using Class:
import nuke
import nukescripts
class testPyPanelClass(nukescripts.PythonPanel):
def __init__(self):
nukescripts.PythonPanel.__init__(self, 'Test PyPanel', 'testPanel')
self.fileTypeEnu = nuke.Enumeration_Knob('fileType', 'File Type', ['mov', 'jpeg', 'targa'])
self.movCodecTypeEnu = nuke.Enumeration_Knob('movCodecType', 'Mov Codec Type', ['H264', 'Photo - JPEG'])
self.setRawBl = nuke.Boolean_Knob('setRaw', 'Raw Data')
self.addKnob(self.fileTypeEnu)
self.addKnob(self.movCodecTypeEnu)
self.addKnob(self.setRawBl)
def knobChanged(self, knob):
if knob == self.fileTypeEnu:
fileType = self.fileTypeEnu.value()
writeNode = nuke.selectedNode()
writeNode['file_type'].setValue(fileType)
if knob == self.movCodecTypeEnu:
movCodecType = self.movCodecTypeEnu.value()
writeNode = nuke.selectedNode()
if movCodecType == 'H264':
writeNode['codec'].setValue('avc1')
writeNode['quality'].setValue('High')
if movCodecType == 'Photo - JPEG':
writeNode['codec'].setValue('jpeg')
writeNode['quality'].setValue('High')
if knob == self.setRawBl:
writeNode = nuke.selectedNode()
if self.setRawBl.value() == True:
writeNode['raw'].setValue(True)
if self.setRawBl.value() == False:
writeNode['raw'].setValue(False)
# add it on panel
def addPanel():
return testPyPanelClass().addToPane()
menu = nuke.menu('Pane')
menu.addCommand('Test PyPanel', addPanel)
When I changed the write node's file_type property with my Panel, its related Options didn't show up so I can't set the quality of mov or jpeg as you can see the attached picture.
http://www.vfxtalk.com/forum/attachment.php?attachmentid=10359
Where's my problem?
This is my Test PyPanel created using Class:
import nuke
import nukescripts
class testPyPanelClass(nukescripts.PythonPanel):
def __init__(self):
nukescripts.PythonPanel.__init__(self, 'Test PyPanel', 'testPanel')
self.fileTypeEnu = nuke.Enumeration_Knob('fileType', 'File Type', ['mov', 'jpeg', 'targa'])
self.movCodecTypeEnu = nuke.Enumeration_Knob('movCodecType', 'Mov Codec Type', ['H264', 'Photo - JPEG'])
self.setRawBl = nuke.Boolean_Knob('setRaw', 'Raw Data')
self.addKnob(self.fileTypeEnu)
self.addKnob(self.movCodecTypeEnu)
self.addKnob(self.setRawBl)
def knobChanged(self, knob):
if knob == self.fileTypeEnu:
fileType = self.fileTypeEnu.value()
writeNode = nuke.selectedNode()
writeNode['file_type'].setValue(fileType)
if knob == self.movCodecTypeEnu:
movCodecType = self.movCodecTypeEnu.value()
writeNode = nuke.selectedNode()
if movCodecType == 'H264':
writeNode['codec'].setValue('avc1')
writeNode['quality'].setValue('High')
if movCodecType == 'Photo - JPEG':
writeNode['codec'].setValue('jpeg')
writeNode['quality'].setValue('High')
if knob == self.setRawBl:
writeNode = nuke.selectedNode()
if self.setRawBl.value() == True:
writeNode['raw'].setValue(True)
if self.setRawBl.value() == False:
writeNode['raw'].setValue(False)
# add it on panel
def addPanel():
return testPyPanelClass().addToPane()
menu = nuke.menu('Pane')
menu.addCommand('Test PyPanel', addPanel)
When I changed the write node's file_type property with my Panel, its related Options didn't show up so I can't set the quality of mov or jpeg as you can see the attached picture.
http://www.vfxtalk.com/forum/attachment.php?attachmentid=10359
Where's my problem?
