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 ) ************************************************************************* On 12/27/2011 08:06 PM, Robin Graham wrote: Maybe someone can help me solve this strange riddle. I have a nuke pane with a python knob that creates another knob in the same pane. This works fine, but for some reason if I try to create a roto node after I press this button it will immediately crash nuke. No popup or anything, nuke just disappears. This only happens when creating a roto node, and only after I click on the python knob in the pane. I am using nuke 6.2v4 but this also happens in 6.3v5 Give it a shot. Run this from the script editor, add the new pane named 'test panel', click on the knob, and then add a roto node to the graph. Be prepared for a swift exit. Is it because I have the getLDPy function within the panel class? In the actual panel the function to create the new knobs is quite big so I have to break it out somehow. *********************************************************** import nuke, os import nukescripts class sgGetPanelClass( nukescripts.PythonPanel ): def __init__( self ): def getLDPy(): knob = nuke.Text_Knob("robin2"," test ","test2") self.addKnob(knob) nukescripts.PythonPanel.__init__( self, 'test panel', 'com.robin.sgGetPanel') getLD = nuke.PyScript_Knob('getLD', 'createsknob', 'getLDPy()') self.addKnob( getLD ) def addsgGetPanel(): global sgGetPanel sgGetPanel = sgGetPanelClass() return sgGetPanel.addToPane() paneMenu = nuke.menu( 'Pane' ) paneMenu.addCommand( 'test panel', addsgGetPanel ) nukescripts.registerPanel('com.robin.sgGetPanel', addsgGetPanel ) ******************************************** -- Robin Graham | method studios la t: +1 310 434 6500 | f: +1 310 434 6501 730 arizona ave | santa monica | ca 90401 | www.methodstudios.com<http://www.methodstudios.com> 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. -- Robin Graham | method studios la t: +1 310 434 6500 | f: +1 310 434 6501 730 arizona ave | santa monica | ca 90401 | www.methodstudios.com<http://www.methodstudios.com> 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