It’s kind of a pain, but it is possible. The 'Python' mode is really just a TCL 
command that evaluates Python expressions, so turning it on is just adding 
another command to the TCL string.

# Simple expressions
frame()/12     becomes  [python frame()/12]
frame() / 12   becomes  [python frame()\\ /\\ 12]

For multiline expressions, the TCL command gets an extra flag.

# (Pointless example)

x = frame()
ret = x / 15

# becomes

[python -execlocal x\\ =\\ frame()\\nret\\ =\\ x\\ /\\ 15]


Not fun, but doable.

-Nathan



From: andi 
Sent: Thursday, May 17, 2012 2:09 PM
To: [email protected] 
Subject: [Nuke-python] activate python mode when using expression

hi, does anyone know how to toggle python expression button and the 'R' button 
next to it (which are accessible when we edit expression). i want to put 
multiline python statement using .setExpression(), but it will always set the 
expression mode to TCL. Anyone know how to set flag to activate python mode , 
instead of tcl mode ?


--------------------------------------------------------------------------------
_______________________________________________
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

Reply via email to