Skip to content

Instantly share code, notes, and snippets.

@kpprt
Last active August 31, 2017 11:07
Show Gist options
  • Save kpprt/ed61679f5193d0c2d495d83ffae1d70d to your computer and use it in GitHub Desktop.
Save kpprt/ed61679f5193d0c2d495d83ffae1d70d to your computer and use it in GitHub Desktop.
A utility node for Nuke to map values from a certain range to a certain range.
set cut_paste_input [stack 0]
version 10.5 v3
push $cut_paste_input
Group {
name CS_MapValue1
label "Output: \[value out]"
selected true
xpos 400
ypos -88
addUserKnob {20 CS_MapValue}
addUserKnob {7 in l InputValue t "The input value to be transformed." R 0 100}
in 80
addUserKnob {26 "" +STARTLINE}
addUserKnob {7 inMin l InputMin t "The minimum of the input value." R 0 100}
addUserKnob {7 inMax l InputMax t "The maximum of the input value." -STARTLINE R 0 100}
inMax 100
addUserKnob {7 outMin l OutputMin t "The new minimum of the output." R 0 100}
outMin 80
addUserKnob {7 outMax l OutputMax t "The new maximum of the output." -STARTLINE R 0 100}
outMax 40
addUserKnob {26 ""}
addUserKnob {7 out l Output t "The result with a value in the new range." R 0 100}
out {{"(in - inMin) / (inMax - inMin) * (outMax - outMin) + outMin"}}
addUserKnob {22 UpdateLabel t "Updates the label of this node in the Node Graph. This could be necessary when values are linked via expressions. The update is executed automatically on frame changes." T nuke.updateUI() +STARTLINE}
addUserKnob {26 ""}
addUserKnob {26 Creator l "" +STARTLINE T "CS_MapValue v1.0 by Christian Schulze - www.christian-schulze.eu"}
}
Input {
inputs 0
name Input
xpos -40
ypos 206
}
Output {
name Output
xpos -40
ypos 302
}
end_group
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment