Python: Checking if an hda library is installed

   3314   2   2
User Avatar
Member
11 posts
Joined: March 2014
Offline
Hi there!

I've created a digital asset that is defined in an hda library, and I'm creating a shelf tool that (among other things) creates a node of this HDA type. What is the best way to check if the hda library is installed? I want to do something like check if library is installed (manually via File -> Install Digital Asset Library or by nature of being in the houdinipath) and if not look for it in $HIP/otls and install it from there, and if it's not there either display a custom error message.

I found hou.HDADefinition.isInstalled(), but it looks like for that I would need to have the actual library file to know what the definition is. I was thinking maybe there was some way to try to create a node and if it fails (implying that the library isn't installed) then do something else. However when createNode() fails it doesn't return false it throws an error, so I'm not sure of the best way to approach this.

I hope this makes sense! Thanks in advance for your help!
User Avatar
Member
23 posts
Joined: Sept. 2015
Offline
Hi,

Have you checked this:

http://www.sidefx.com/docs/houdini15.0/hom/hou/hda [sidefx.com]

you have hou.hda.loadedFiles() tu get what .hda or .otl files are loaded in the current session

and hou.hda.definitionsInFile(file_path) to get what definition is saved in the given asset path.

With these 2 little fonctions you should be able to do what you want


G.
http://cgtoolbox.com/ [cgtoolbox.com] Houdini tools and scripts for free ! :)
User Avatar
Member
11 posts
Joined: March 2014
Offline
Thank you for pointing me in this direction! hou.hda.loadedFiles() and a try/ except worked perfectly.
  • Quick Links