Search - User list
Full Version: Cleaning up HDA callbacks
Root » Houdini Indie and Apprentice » Cleaning up HDA callbacks
peteski
Hi all,

I'm using hou.hipFile.addEventCallback in a HDA to update some things when the scene is saved. I have an OnDelete function that cleans up the callbacks with hou.hipFile.clearEventCallbacks().

Will that remove all callbacks including ones from other HDAs?

It's super handy to be able to update my HDA on scene save but I'm just a little worried that cleanup will break other things using callbacks...

Thanks,
Pete
tamte
peteski
I'm using hou.hipFile.addEventCallback
Then to remove just specific callbacks you should use
hou.hipFile.removeEventCallback(callback)

You can also query all registered callback using
hou.hipFile.eventCallbacks()
peteski
Thanks!

I went with this -

def CleanUp(kwargs):
    callbacks = hou.hipFile.eventCallbacks()
    for x in range(len(callbacks)):
        if(callbacks[x] == addSceneEventCallback):
            hou.hipFile.removeEventCallback(callbacks[x])
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB