Hi Fredrik,
The ast.parse() should work for any knob that can store a string actually. The 
.command() is from the Python script button.
Hope it helps. 
Cheers, Diogo


_____________________________
From: Fredrik Averpil <fred...@averpil.com>
Sent: Monday, March 6, 2017 04:32
Subject: Re: [Nuke-python] How to store function on node?
To: Nuke Python discussion <nuke-python@support.thefoundry.co.uk>




Hi Diogo,

Which knob type has the command argument?
I’m trying to use the Multiline_Eval_String_Knob for readability.

Cheers,
Fredrik​
On Sat, Mar 4, 2017 at 4:05 PM Diogo Girondi <diogogiro...@gmail.com> wrote:
Maybe the ast.parse() does what you are after.
import ast
ast.parse(nuke.toNode('NoOp1').knob('script').command())
print printer("string")

Cheers,Diogo

On Thu, Mar 2, 2017 at 9:09 AM, Hugo Léveillé <hu...@fastmail.net> wrote:
Another way would be to sub class a node and add your own function. But I have 
never tried it and might not be possible at all



--
  Hugo Léveillé
  Head of 2D, MELS
  hu...@fastmail.net



On Thu, Mar 2, 2017, at 07:05, Hugo Léveillé wrote:
http://pastebin.com/eJNqwPLt

Yes this basically store the code on the knob and then you can execute it with 
the execute function. But this won't give you what you want (Node.function)



--
  Hugo Léveillé
  Head of 2D, MELS
  hu...@fastmail.net



On Thu, Mar 2, 2017, at 06:52, Fredrik Averpil wrote:
Oh. It doesn't seem like my pickled example worked either... as it requires the 
original function to still be registered in the python environment.

Hmm...

_______________________________________________
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

Reply via email to