I suppose your problem is that template.nk doesn't ever actually "load". Its contents are imported into an empty script instead. Point is, I don't think the onScriptLoad callback will ever be triggered unless you load an actual script.
However, you can probably use an onCreate callback instead, just targeting the creation of the Root node. Using your example: def hi(text='nothing here'): nuke.message(text) nuke.addOnCreate(hi, "this is a test", nodeClass='Root') On Sun, Dec 18, 2011 at 2:12 PM, Robin Graham < [email protected]> wrote: > ** > I must be missing something simple but I just can't figure this out. I > want a simple nume.message('hi') to appear right after template.nk loads > (when the user starts nuke, or creates a new script). I tried adding a > simple nuke.message function in init.py and calling it via > nuke.addOnScriptLoad(hi, "this is a test", ) in the template.nk, but > nothing happens. I also tried adding it to the python tab in the settings > panel for the template.nk but again no luck. > > I also tried this: > > def hi(text='nothing here'): > nuke.message(text) > > if nuke.Root().name() == 'Root': > nuke.addOnScriptLoad(hi, "this is a test", ) > print 'test' > > in the init.py, but again nothing happened. 'test' was printed when nuke > started, but no popup was seen. > > Eventually I want to make a function that will show a popup when nuke > starts that lets the user click to open a few pre-defined template files. > Something like "Welcome to Nuke! Would you like to *Open a blank script* > *Open a comp template* *Open a lightcomp template*" > > This shouldn't be that hard right? I figured once I get the nuke.message > working on template.nk I could figure out the rest without too many > problems. > > -- > *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 > > 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 > [email protected], http://forums.thefoundry.co.uk/ > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > >
_______________________________________________ Nuke-python mailing list [email protected], http://forums.thefoundry.co.uk/ http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
