Saving HDA's to the job

   2992   5   2
User Avatar
Member
518 posts
Joined: 12月 2013
Offline
Hi all!
I'm trying to save HDA's that are specific to a project, within the $JOB file structure. But I've run into some trouble where they don't seem to be loading.
In the docs it says that it should work, but it seems that Houdini isn't loading the HDA's from the Job/HDA folder

Docs… [sidefx.com]
You can put assets specific to a project in $JOB/hda. See project management for how to set up $JOB

Any ideas what I'm doing wrong there?
Thanks,
Pete
Edited by peteski - 2017年2月4日 23:17:53
User Avatar
Member
2627 posts
Joined: 6月 2008
Offline
Have you set the $JOB variable in the HIP that is supposed to load them?

File\Set Project… then save.
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
518 posts
Joined: 12月 2013
Offline
Hmm, just tried that and it seems it still doesn't add the HDA's from the Job path.
P.
User Avatar
Member
21 posts
Joined: 10月 2018
Offline
It sort of works, but you have to name the folder $JOB/otls Then you have to set the project, save your file and reopen it. It's probably easier to create a simple package now...
User Avatar
Member
1 posts
Joined: 7月 2023
Offline
I was looking for a solution for this now for a while.


There is a Python script by Chris Gardner which will allow you to load the otls from your $JOB directory.

https://gist.github.com/chris-gardner/c9daf34a668c5dddda94b9f6276d8cb8 [gist.github.com]
Stumbled upon here: https://www.tokeru.com/cgwiki/HoudiniHDA [www.tokeru.com]

The Script needs to be copy paste in: Windows -> Python Source Editor

The original script will create a error (at least for me).

Here the adaptation of it which worked for me:
NOTE: depending on the license version of your files you need to adapt the filetypes. Also in the $JOB directory there needs to be a "otls" folder containing your assets (no subfolders)



import hou
import os.path


def loadHdaLibrary(libPath):
    """
    Loads all the HDA files in a folder
    
    @param libPath: HDA library file path
    """
    
    if not os.path.isdir(libPath):
        print(libPath)
        return
    
    loaded_files = hou.hda.loadedFiles()
    
    # Get all the .otl files in the directory.
    filetypes = ['.otllc','.otl','.hdalc','.hda']
    otl_files = [f for f in os.listdir(libPath) if os.path.splitext(f)[1] in filetypes]
    
    for otl_path in otl_files:
        # backslashes are the devils work
        full_path = os.path.join(libPath, otl_path).replace('\\', '/')
        # If the file isn't already loaded, install it.
        if full_path not in loaded_files:
            #print 'installing', full_path
            hou.hda.installFile(full_path)
            
            
loadHdaLibrary(hou.getenv('JOB')+'/otls')
User Avatar
Member
518 posts
Joined: 12月 2013
Offline
Awesome, thanks for this. I'll have to have another look!
  • Quick Links