Jump to content


andreaskal

Change Constraint Clamp Distance Value

Recommended Posts

Let's say we want to have a XPresso Tag on an object.

And that same object has a Constraint Tag, with Clamp.

 

We put a Python Node inside our XPresso.

 

How could we through that Python Node, change the Contraint Tag/Clamp/Distance slider Value?

 

But without adding the Clamp into XPresso, as a node. We need this to happen through Python.

 

Thank you!

Share this post


Link to post
Share on other sites

I've had trouble posting python scenes to members with older versions recently, so a description will have to do.

 

In this scene I used GetTags() to get a list of tags from the object, then tags[0] to reference the actual tag by index. For the correct syntax for things like sliders, I find just dragging the field into the Python window works (with a bit of editing). Not sure if this works with your R15.

 

def main():
    global Output1 # for test
    
    length = Input1 # constraint length
    
    cube = doc.SearchObject('Cube') # obj with tag
    
    tags = cube.GetTags() # get all tags on obj
    
    constraint_tag = tags[0] # get 1st tag (or whatever)
    
    # drag field from attrib manager to get syntax
    # may need some editing
    
    constraint_tag[50004,9] = length # set constraint length
    
    Output1 = length # test

clamp.png.17f650d73e8a388dcbef9345b0165719.png

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×