top of page

Integer Slider

Not long ago a colleague, Julien Rousseau approached me with an interesting task.
He was working on a gizmo that needed an integer slider.

​​

I looked into knob flags that Guillermo Algora collected very nicely​ as I know from my

previous user knob collection that Nuke doesn't have integer slider out of the box,

so the idea was to add an integer_knob and use the slider flag.

​​

Although there is a knob flag to create slider for numeric knobs it doesn't hold up for some reasons

when added to the integer knob.

So every time you create a new node the flag sadly disappears.

​​

So applied an onCreate callback that adds the flag to the node every time it's created and that seemed to fix the problem.

​

Later, I found that this problem was already solved by Ivan Busquets 

on the Foundry forum a while ago.

​

Still, it felt like a handy trick worth sharing again!

​

So here is a step by step guide on how to create this knob on a NoOp as a test subject.

Step by step

1. Let's add an Integer knob by right clicking on a node and selecting Manage User Knobs... then selecting Integer Knob.

001.jpg

2. I named it integer_slider but you can name it anything as long as it's matches with the knob name later in the python snippet.

002.jpg

3. When successfully created a new knob will appear on a new User tab.

003.jpg

4. New let's open the Script Editor and copy paste the snippet below.

You need to select the (single) node you want to add this code to.

Here you can also set the range you want your slider to have, it's currently on -15, 15.

004_2.jpg

5. Once the code ran you won't see a difference on the node yet as the code only ran when the node is created. You can copy it and check in any text editor that the onCreate knob has the right value.

005_2.jpg

6. When copied back to Nuke the slider should finally appear!

When the new node is saved to a Toolbox or anywhere else in your .nuke folder it should keep the onCreate callback.

006.jpg

7. DONE!

Keep in mind that this user knob is not connected to anything just yet.

Leaving it for your creativity to find a good use for it.

Here are some ways you can use it to link with other user knobs.

spongebob-done.gif

Hope you will find it useful! 

© 2014 by GATIMEDIA

bottom of page