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

Reply via email to