Jump to content
DeeLan

Python - Binding and Refreshing Handles

Recommended Posts

Posted (edited)

Hey guys,

I'll keep my original question below just for clarity of where this is all coming from. I've got 95% of the work done (and all in Python, save for an embedded hscript command or two). All I face now is two issues.
Firstly, I'm using the "ombind" and "omubind" to handle the binding of my handles. Unfortunately, these functions operate on every single instance of my asset in the scene. I want them to work only on the instance that owns the parameter that was changed. Anyway to get this to work?
Secondly, whenever I bind or unbind anything, the change does not take effect immediately. I have to hide then show the manipulator handle before the changes show up. Is there a way in Python (or even hscript) to refresh/ hide and show the handle automatically?

-- Original Question --

I really need some help. On my asset I have a checkbox parameter and a transform handle. What I need to do is, whenever the checkbox is toggled, get the state of the checkbox and if the checkbox is checked, then bind the "tx" field on the handle to my posx parameter, and if it is unchecked, unbind "tx". So my pseudo code is looking like...

whenever checkbox changes state
    cbState = state of checkbox
    if(cbState){
        bind mainHandle:tx to posx parameter
    }else{
        unbind mainHandle:tx
    }

From what I've found so far the only way to achieve this is to write script in HScript (because apparently Python can't bind handles yet) in the "scripts" section of operator type properties. I'm quite comfortable with VEX but I have no experience with HScript and so far everything I've tried to do in HScript has failed miserably (I can't even get a simple echo command to work). Is anyone able to provide me with some example code or a tutorial or something that would show me how to achieve this? I've been digging through the documentation trying to learn but I just keep hitting walls.

Edited by DeeLan
Update

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

×