HDK - persist data to hip file?

   2492   6   2
User Avatar
Member
11 posts
Joined:
Offline
I am writing a system which keeps track of asset metadata within the runtime. It relies on the FS_Helper classes to look up asset locations based on a uri scheme. I would like write data to the hip file on save and fetch it out of the hip file on load. Is this possible via the api?
Edited by jGrBr - March 18, 2017 12:31:31
User Avatar
Member
7743 posts
Joined: July 2005
Offline
Traditionally, asset management systems install things like menu hooks and/or expose web interfaces within Houdini's web browser. This allows one to run scripts to create nodes and persist data in the scene file via the created nodes (eg. userdata [sidefx.com]).

Having said that, there are various ways to hack it. One of which is to store scene level “global” variables. eg. OPgetDirector()->getCommandManager()->setVariable(). OPgetDirector() gives pointer for the root “/” scene node. So you could also store userdata there as well (you can call into the Python HOM API from C++).
User Avatar
Member
11 posts
Joined:
Offline
Thanks for the suggestions. One more thing; is there a way to register on-save and on open callbacks in c++?
User Avatar
Member
7743 posts
Joined: July 2005
Offline
No, which is also why having custom nodes in the scene might be a good idea.
User Avatar
Member
11 posts
Joined:
Offline
That is too bad. I noticed

OP_Director
….
void setSaveCallback (SaveCallback cb, void *cb_data)
void removeSaveCallback (SaveCallback cb, void *cb_data)

and was hopeful that this capability existed via the HDK. What is the SaveCallback used for?
User Avatar
Member
7743 posts
Joined: July 2005
Offline
Ah, sorry. There's setSaveCallback() but there's no callback for open.
User Avatar
Member
7743 posts
Joined: July 2005
Offline
Oops, spoke too soon. Try OP_Director::addEventCallback().
  • Quick Links