Thread: Knob names

Reply to Thread
Results 1 to 5 of 5
  1. #1 Knob names 
    Join Date
    Feb 2008
    Posts
    23
    Hello everybody, I'm quite new in nuke scripting and i'm facing this problem: how do I know knob names? and their values?
    For example, I want to get the value of current zoom value inside Viewer1.
    I know I can access the viewer using

    nuke.activeViewer()

    I found an example on the net that uses

    nuke.activeViewer().node()['channels'].setValue('depth')

    this one sets the current viewer's channels on "depth", and you can actually see the knob changing its value on the viewer.

    Let's say I want to access the zoom: what is its name? what are its properties? How can I find one knob's name by myself?

    Thank you very much, help is much apreciated
    Reply With Quote  

  2. #2  
    Join Date
    Jul 2008
    Posts
    105
    You can derive the knobs of any node by simply copying the node and pasting the values into any text editor. Within the brackets for the node properties, the first value will be the knob, the following values will be the values of that knob.

    For example, I made a text node "Text1"

    Copying and pasting it you get this:


    set cut_paste_input [stack 0]
    version 6.2 v4
    push $cut_paste_input
    Text {
    font C:/Windows/Fonts/arial.ttf
    yjustify center
    box {480 270 1440 810}
    center {960 540}
    name Text1
    selected true
    xpos -768
    ypos 453
    }


    I know xpos is the knob and -768 is the value.

    You can also hover over most properties in the properties pane to get a pop up note that tells you the name of the knob.

    Simple syntax to get the value of a knob is like this:

    print nuke.toNode('Text1')['xpos'].value()

    That will return the Text1 xpos value... You can also put this in a variable instead of print it, or use setValue() instead of "value()" to change it via python.

    Hope this helps.
    -----
    VFX Creative Director // Encore Hollywood
    iMDB
    Reply With Quote  

  3. #3  
    Join Date
    Feb 2008
    Posts
    23
    Thank you very much, it has been useful but I still can't understand how to get or change the values of the zoom. It looks like the zoom doesn't have a pop up note with a name. Any guess?
    Reply With Quote  

  4. #4  
    Join Date
    Jul 2008
    Posts
    105
    You can search all the root and active viewer knobs via these snippets, but I can't find anything for yah


    myView = nuke.activeViewer().node()
    for n in myView.knobs():
    print str(n) + " " + str(myView.knob(n).value())


    myView = nuke.root()
    for n in myView.knobs():
    print str(n) + " " + str(myView.knob(n).value())

    -----
    VFX Creative Director // Encore Hollywood
    iMDB
    Reply With Quote  

  5. #5  
    Join Date
    Feb 2008
    Posts
    23
    You have been very useful anyway!
    This zoom thing looks very misterious
    So strange there is no way to get this little number!
    Reply With Quote  

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. set keyframes on an expression linked knob
    By philhub in forum NUKE from The Foundry
    Replies: 1
    Last Post: June 25th, 2011, 03:51 AM
  2. Knob Callbacks or Functions in Expressions
    By scottjwill in forum NUKE from The Foundry
    Replies: 7
    Last Post: June 17th, 2011, 09:15 PM
  3. how to manage knob on the fly using python ?
    By metaclay in forum NUKE from The Foundry
    Replies: 1
    Last Post: May 8th, 2011, 04:18 AM
  4. reserved knob names
    By beaker in forum NUKE from The Foundry
    Replies: 3
    Last Post: May 1st, 2009, 09:30 PM
  5. select channels with similar names
    By arikitraun in forum NUKE from The Foundry
    Replies: 2
    Last Post: March 9th, 2009, 11:19 AM
Bookmarks
Bookmarks
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts