Jump to content

Python - Binding and Refreshing Handles


DeeLan

Recommended Posts

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...