Cleaning up HDA callbacks

   199   2   1
User Avatar
Member
542 posts
Joined: Dec. 2013
Offline
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
User Avatar
Member
9454 posts
Joined: July 2007
Offline
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()
Edited by tamte - March 3, 2026 20:24:10
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
542 posts
Joined: Dec. 2013
Offline
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])
  • Quick Links