Nuke Python / TCL Question

I am trying to make a value remapping expression – basically emulating the After Effects linear() function-

linear(val,inMin,inMax,outMin,outMax)

I found a python methodology:

def remap(val,inmin,inmax,outmin,outmax):
diffin=inmax-inmin
diffout=outmax-outmin
diffval=val-inmin
newval=outmin+((diffout/diffin)*diffval)
return newval

I can then use the remap() function within an expression on a value to use this. The only issue is that I have to define the remap() function every time the script opens. I know I can add it to my menu.py or some other file – but what if I want to make the script totally portable and render-farm friendly?

Is there a way to embed the "def remap()" code into the script so that it is auto-executed every time the script is opened?

thanks in advance!

No Responses to “Nuke Python / TCL Question”

Post a Comment