[Sidefx-houdini-list] Handle callbacks with HDAs?

Graham Thompson captainhammy at gmail.com
Wed Mar 23 22:25:19 EDT 2011


An option is to try a more general ParmTupleChanged node event
callback.  This callback triggers based on handles and you can easily
have your callback function filter for your desired parameter.  The
downside of this type is that your callback is not saved with the
scene so you'll have to apply this callback from inside the OnLoaded
handler of your digital asset so it's always around.

The following checks for a specific parameter and prints that it was changed.

OnLoaded section:

# The instance of the asset being loaded.
node = kwargs["node"]

# The types of events we want to watch for.  In this case
# we just care about changing parameters.
event_types = (hou.nodeEventType.ParmTupleChanged,)

def callback(**kwargs):
    # Get the parm tuple that is changing.
    parm_tuple = kwargs["parm_tuple"]
    # Check the parm tuple is valid.  Sometime we will get None.
    if parm_tuple is not None:
        # Filter for our specific parm.
        if parm_tuple.name() == "parm":
            # Do something.
            print "%s changed!!!" % parm_tuple

# Add the callback to this node.
node.addEventCallback(event_types, callback


On Wed, Mar 23, 2011 at 6:45 PM, Sebastian H. Schmidt
<sebastian.h.schmidt at googlemail.com> wrote:
> Hi Alvin,
>
> afaik only changes directly done by the user are triggering callbacks, u
> could use 'opparm' to force the triggering of the callback.
>
> cheers!
> Seb
>
> On Thu, Mar 24, 2011 at 2:31 PM, Alvin Yap <alvinyapvfx at gmail.com> wrote:
>
>> Hi everyone!
>> I have a digital asset with a parameter promoted that has a handle assigned
>> to it. This parameter also has a python callback script attached to it.
>> Changing the parameter using the slider or directly entering values engages
>> the callback script fine.
>> However, if I use the handle assigned to this parameter, the values of the
>> parameter changes, but the callback script is not called.
>>
>> Would this be the expected behaviour?
>>
>> Thanks!
>>
>> Regards,
>> Alvin
>> _______________________________________________
>> Sidefx-houdini-list mailing list
>> Sidefx-houdini-list at sidefx.com
>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>>
> _______________________________________________
> Sidefx-houdini-list mailing list
> Sidefx-houdini-list at sidefx.com
> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>



More information about the Sidefx-houdini-list mailing list