Last active
October 18, 2024 05:17
-
-
Save greenvfx/8eb1ae0c42b56efcae0abe631022258d to your computer and use it in GitHub Desktop.
single and multiline python expression in Nuke
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#multiline py nuke's expression | |
b = nuke.nodes.Blur() | |
kb = b.knob('size') | |
multiline_python_expr = ''' | |
[python -execlocal { | |
def myFunction(x): | |
return x*2 | |
t = nuke.frame() | |
x = myFunction(t) | |
ret = x | |
}]''' | |
kb.setExpression( multiline_python_expr ) | |
b.knob('label').setValue('multiline') | |
#single line py nuke's expression | |
b = nuke.nodes.Blur() | |
kb = b.knob('size') | |
singleline_py_expr = """ [python nuke.frame()/10 ]""" | |
kb.setExpression( singleline_py_expr ) | |
b.knob('label').setValue('single line') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment