One Issue of Building Panel By Creating Class

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 08 August 2010   #1
Unhappy One Issue of Building Panel By Creating Class

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.



Where's my problem?
 
Old 01 January 2011   #2
i have the same problem! have you found any solutions?

Cheers
 
Old 01 January 2011   #3
Originally Posted by DavidHarter: i have the same problem! have you found any solutions?

Cheers


I haven't found any solution.
The only thing I can do is not to wrap the code into a class.

You can try this method.
 
Old 01 January 2011   #4
I believe this is a consequence of Nuke's known limitation that callbacks cannot trigger other callbacks. Your Panel's knobChanged callback is running code that would ordinarily trigger a knobChanged callback on the Write if it was done in a standard script block or through the GUI. The second callback would then show the codec- or type-specific knobs, but since callbacks don't chain, the call to expose these knobs never fires.
 
Old 01 January 2011   #5
Why not just make your own custom write node instead or set defaults for the write node?
__________________
-deke
 
Old 01 January 2011   #6
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 09:04 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.