Another idea... you can do this pretty easily by creating nodes which you don't want to persist inside of a gizmo context. The next time your script is loaded, the gizmo internals are sourced again from the gizmo file.
E.g... https://gist.github.com/anonymous/46a6e356b3a11baa0bc9 Put Foo.gizmo somewhere in your path, launch Nuke, nuke.createNode("Foo"), then execute the button in its properties. An internal CheckerBoard is created. Save your script, reload, and the internal CheckerBoard is gone. Incidentally, I discovered this by mistake a long time ago when I was trying to make the internals *persist* (now I use Group nodes instead for dynamic internal node trees but call them like gizmos). Never actually had cause to create non-persistent nodes, so am a little curious why you want to do this? -E On Tue, Oct 14, 2014 at 2:22 AM, Richard Bobo <richb...@mac.com> wrote: > Thanks, Nathan! I’ll keep that one in my back pocket. > > Rich > > > > On Oct 13, 2014, at 9:17 PM, Nathan Rusch <nathan_ru...@hotmail.com> > wrote: > > You can also set the `nuke.DO_NOT_WRITE` flag on knobs that you don't > want to be written to the script; you'll need to do this every time an > instance of that node is created via a callback or something, since the > DO_NOT_WRITE flag prevents itself from being written as well. Preventing an > entire node from being written is probably a bad idea, because it could > potentially screw up the structure of the node graph. > > -Nathan > > > *From:* Richard Bobo <richb...@mac.com> > *Sent:* Monday, October 13, 2014 2:32 PM > *To:* Nuke Python discussion <nuke-python@support.thefoundry.co.uk> > *Subject:* Re: [Nuke-python] How to prevent certain nodes from being > saved withscript? > > Just an update on this subject… > > It turns out that, because I’m using a full Python path to my function > call in the hidden knobChanged knob, Nuke actually finds the function when > the script gets saved and reloaded — bonus!! So, in other words, I don’t > need to do anything at all — and it just works! 8^) > > Rich > > > On Oct 13, 2014, at 3:52 PM, Richard Bobo <richb...@mac.com> wrote: > > Johannes, > > On Oct 13, 2014, at 3:12 PM, Johannes Hezer <j.he...@studiorakete.de> > wrote: > > Hi Rich, > > lame answer, but callbacks seem to be the way to go here :-) > At least I cannot think of another way to achieve this besides using > callbacks. > But the nodes would be deleted then each time one hits ctrl+s ?! > > > Hahaha! Yes, that would be a rather annoying side effect! ;^) And, since > I am the "king of excessive versioning”, I would be affected the most! LOL > > I guess I was looking for a way to make the nodes “invisible” to the > script save routine. To ignore them, if you will. That could cause other, > unexpected problems, I suppose. I guess I’ll have to think about some other > options… Hmm... > > Thanks. > > Rich > > > > sth like > > def deleteCustomNode() > customNodes = nuke.allNodes('customClass') > for node in customNodes: > nuke.delete(node) > > addOnSCriptSave(deleteCustomNode) > > Couldnt you stuff the function back into the knob instead ? > I dont know what the idea behind all this is, but maybe that could work > too... > > Cheers > Johannes > > Am 10/13/14 20:58 PM, schrieb Richard Bobo: > > Hi, > > I have some nodes I am creating that I don’t want the user to save with > the script. On their hidden “knobChanged” knobs, they reference an > in-memory-only function that only gets loaded when the nodes are created. > So, if they are saved with the script, the function is not found when they > are restored and the custom knobs do nothing. So, I would like to prevent > the nodes from being saved with the script. That way, the user will have to > create new nodes the next time; the function will be referenced and loaded > into memory and all will be well… What’s the best way to prevent a node > from being saved? Should I use the onScriptSave callback? Or, is there a > better way? > > Thanks, > Rich > > > Rich Bobo > Senior VFX Compositor > Armstrong White > Email: rich.b...@armstrong-white.com > http://armstrong-white.com/ > > Email: richb...@mac.com > Mobile: (248) 840-2665 > Web: http://richbobo.com/ > > "The nobler sort of man emphasizes the good qualities in others, and does > not accentuate the bad. The inferior does." > - Confucius > > > > > > > > > > > > ____ ESET 10555 (20141013) ____ > The message was checked by ESET Mail Security. > > _______________________________________________ > Nuke-python mailing listnuke-pyt...@support.thefoundry.co.uk, > http://forums.thefoundry.co.uk/http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > > > > ____ ESET 10555 (20141013) ____ > The message was checked by ESET Mail Security. > > > > -- > STUDIO RAKETE GmbH > Johannes Hezer, Compositing TD & Stereoscopic SV > Schomburgstr. 120 > D - 22767 Hamburg > j.hezer@studiorakete.deTel:+49 <+49> (0)40 - 380 375 69 - 0 > Fax:+49 (0)40 - 380 375 69 - 99 > > ------------------------------------------------------ > Pflichtangaben laut Handelsgesetzbuch und GmbH-Gesetz: > > STUDIO RAKETE GmbH > Schomburgstr. 120 D - 22767 Hamburg > www.studiorakete.de / i...@studiorakete.de > > Geschaeftsfuehrer: Jana Bohl > > Die Gesellschaft ist eingetragen im Handelregister des > Amtsgerichts Hamburg unter der Nummer HR B 95660 > USt.-ID Nr.: DE 245787817 > > > > ____ ESET 10555 (20141013) ____ > The message was checked by ESET Mail Security. > _______________________________________________ > 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 > > > _______________________________________________ > 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 > > > > ------------------------------ > _______________________________________________ > 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 > _______________________________________________ > 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 > > > > _______________________________________________ > 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 > >
_______________________________________________ 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