Has anyone been able to have any luck figuring out what is going on here? 
Does anyone know of a better way to have a python button in a pane run a 
function that creates another python button in the same pane? Or maybe this is 
just a bug with the new roto node? It doesn't seem to crash on any other type 
of node.

-=Robin


On 12/27/2011 08:39 PM, Robin Graham wrote:
SORRY! I made the mistake of not changing the name of every function for my 
test code, so the last code was working for me because I was defining one of 
the functions somewhere else as well. Here is the code again. Everything is 
changed this time so it should work on anyone's nuke install and show the 
problem I am having.

Once again please run this code, add the test panel, click the button, then add 
a roto node. I need a python button in a custom panel that can create more 
knobs in that panel yet not crash when you add a roto node (phew). Thanks 
everyone! This is a hard one for me.

*************************************************************************

import nuke, os
import nukescripts


def createTextKnob(text):
    knob = nuke.Text_Knob("robin2"," test ",text)
    TestPanel.addKnob(knob)

class TestPanelClass( nukescripts.PythonPanel ):

    def __init__( self ):

        nukescripts.PythonPanel.__init__( self, 'test panel', 
'com.robin.sgGetPanel')
        getLD = nuke.PyScript_Knob('getLD', 'createsknob', 
'createTextKnob(\'hi\')')
        self.addKnob( getLD )

def addTestPanel():
    global TestPanel
    TestPanel = TestPanelClass()
    return TestPanel.addToPane()


paneMenu = nuke.menu( 'Pane' )
paneMenu.addCommand( 'test panel', addTestPanel )
nukescripts.registerPanel('com.robin.TestPanel', addTestPanel )


*************************************************************************


This e-mail and any attachments are intended only for use by the addressee(s) 
named herein and may contain confidential information. If you are not the 
intended recipient of this e-mail, you are hereby notified any dissemination, 
distribution or copying of this email and any attachments is strictly 
prohibited. If you receive this email in error, please immediately notify the 
sender by return email and permanently delete the original, any copy and any 
printout thereof. The integrity and security of e-mail cannot be guaranteed.
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to