Cleaning up HDA callbacks

   422   2   1
User Avatar
Member
542 posts
Joined: 12月 2013
オフライン
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
9482 posts
Joined: 7月 2007
オフライン
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 - 2026年3月3日 20:24:10
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
542 posts
Joined: 12月 2013
オフライン
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