Thread: setExpression x and y values

Reply to Thread
Results 1 to 3 of 3
  1. #1 setExpression x and y values 
    Join Date
    Sep 2009
    Posts
    8
    I'm sure this is something really simple but I can't seem to figure it out. I'm trying to set an expression on a center knob for x and y. This is essentially what I want to do...
    Code:
    n['center'].setExpression('width/2', 'height/2')
    but the only way I can seem to get it to work is using....
    Code:
    n['center'].setExpression('width/2')
    which sets both x and y to 'width/2'

    Thanks for the help.
    Reply With Quote  

  2. #2  
    Join Date
    Feb 2007
    Posts
    993
    Since the "Center" knob is an XY_Knob, you have to specify the index you're trying to set the expression on.
    Code:
    # Set expression on X component
    n['center'].setExpression("width/2", 0)
    # Set expression on Y component
    n['center'].setExpression("width/2", 1)
    Reply With Quote  

  3. #3  
    Join Date
    Sep 2009
    Posts
    8
    Of course, that makes perfect sense. I'm still a little green in python, learning more every day though. I was wondering what that second variable was for. Thanks.
    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. Simple question re. averaging RGB values
    By 1:1 in forum Beginners Talk
    Replies: 2
    Last Post: April 25th, 2010, 02:53 AM
  2. Replies: 1
    Last Post: February 27th, 2010, 06:38 PM
  3. clamp values
    By ironhalo in forum Digital Fusion / DFX+
    Replies: 3
    Last Post: July 31st, 2009, 04:37 PM
  4. Image Sampling over time to Drive Luminosity Values
    By moriko in forum NUKE from The Foundry
    Replies: 4
    Last Post: November 18th, 2008, 01:00 PM
  5. compressing values above a certain point
    By seagoat8888 in forum NUKE from The Foundry
    Replies: 5
    Last Post: August 18th, 2008, 06:17 PM
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