value vs knob command

Written by Frank Rueter on .

The simplicity of tcl's command based nature makes it nice and easy to use in Nuke's text knobs, such as labels (you can actually use tcl that way in pretty much any knob in Nuke that can take an expression).
The value and knob commands in particular are very handy to show node properties in the DAG.
In a node's label, simply type the following:

1
[value <knob name>]

Here is an example for the exposure node's "mode" knob:

1
2
[value mode]
rgb: [value red], value green], [value blue]

valueCommand


 

Note that the "value" command will resolve any expressions or animation curves for you, and return their respective current value.
If you want to get the literal content of a knob without prior resolution, use the "knob" command instead:

1
[knob <knob name>]

 

1
[knob rotate]

And here is a combo of value and knob command:
knobCommand

 

 

Comments   

 
0 # neil griffiths 2010-12-07 08:03
hi, is there a way to alter this TCL script to display the frame number of the exact point that an animation has stopped. basically when i am doing rig removal i have a camera and i kill the animation at a particular frame, which i would like displayed in the label. i can use [frame] to display the current frame number but is there a way to display the frame number of the animation.
 
 
0 # julian mann 2012-06-02 08:30
How would I get the exact string value from a text knob that contains a number with leading zeros? For example, a text knob called revision has a value of "006", but when I try to get it in the message of a text node like this: "[ knob groupNode.revis ion]" it returns "6". It strips the zeros.
 
 
0 # julian mann 2012-06-02 08:42
Apologies, its expr that is casting it as a number":
[expr [value groupNode.hasRe vision]?"[ knob groupNode.revis ion]":""]

[ knob groupNode.revis ion] on its own returns 006
 
 
0 # Frank Rueter 2012-06-02 18:32
you could just not use the expression parser and stay in tcl:
[if {[knob groupNode.hasRe vision]==true} {return [knob groupNode.revis ion]} else {return nope}]
 
 
+1 # Florian Einfalt 2012-08-29 09:20
Hi there, is it possible within possibilities of the "Manage User Knobs" interface to have the contents of a text input field define the label of an element in a choice pulldown menu within the same group interface? Or will I need to use Python for that?
Thanks for your help guys.
 
 
0 # Frank Rueter 2012-08-29 15:18
you'd need python callbacks for that as the contents of a pulldown menu don't support expressions afaik. So the callback would listen to the text field's value, and if it changes update the values in the pulldown menu
 
 
0 # Francesco Santucci 2022-10-23 08:21
Hi, I'm going crazy maybe for a stupid thing, but I can't find the solution.
I would like to transfer the label of a cascaded node into the nodal stream.
In the second node I put [value input.label] and it works without problems, but from the third node the value of the expression of the second is always written and not the value. It doesn't change if I use [knob input.label] in the second. I could not find alternatives, I tried everything possible with my (little) current knowledge.
Thanks in advance for any advice.
 

You have no rights to post comments

We have 2500 guests and 96 members online