Manuel Bonell

Mitzu_Ta

About Me

I am Manuel, an artist and co-founder of Immerea, a startup in Vienna focusing on VR games and interactive installations. In the past years I worked on different CGI projects where I used Houdini.

Connect

LOCATION
Not Specified

Houdini Skills

Availability

Not Specified

Recent Forum Posts

Saving HDA's to the job July 9, 2023, 12:44 p.m.

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')