Hello,
I've been looking through the archives and noting past bugs with dynamically
creating nodes in python panels -- sorry if this one has been mentioned with
regard to Nuke 6.3v6. Basically, I've attached sample code below that creates a
modular python panel with a Boolean Knob that adds and removes two additional
PytScript knobs when checked and unchecked -- that works fine, no problem...
the issues is when I use one of the dynamically created PyScript knobs to
toggle the "setEnabled" state of the other. Is this a known bug? Any
suggestions?
Cheers,
Jep
### Test panel to demonstrate issues when manipulating dynaically added knobs
import nukescripts, nuke
class TEST_O_Panel(nukescripts.PythonPanel):
def __init__( self ):
nukescripts.PythonPanel.__init__( self, 'Test-O-maticĀ®',
'com.j3pnyc.Test-O-matic')
# CREATE BASE KNOBS THEN ADD THEM
self.test = nuke.Boolean_Knob('test','Check to test')
self.test.setFlag( nuke.STARTLINE )
self.addKnob( self.test )
### Defining these here alone causes "knob already attached to a node" error
when removed and re-added
# self.a = nuke.PyScript_Knob('a', "Button A")
# self.a.setFlag( nuke.STARTLINE )
# self.b = nuke.PyScript_Knob('b', "Button B")
# self.b.setEnabled(False)
self.added=0
def addButtons(self):
self.a = nuke.PyScript_Knob('a', "Button A")
self.a.setFlag( nuke.STARTLINE )
self.b = nuke.PyScript_Knob('b', "Button B")
self.b.setEnabled(False)
self.addKnob( self.a )
self.addKnob( self.b )
self.added=1
def removeButtons(self):
self.removeKnob( self.a )
self.removeKnob( self.b )
self.added=0
def knobChanged( self, knob ):
if knob == (self.test):
if self.test.value() == True:
if self.added==1:
self.removeButtons()
self.addButtons()
else:
if self.added==1:
self.removeButtons()
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python