Houdini 11 Houdini Object Model hou

Module containing functions related to Houdini Digital Assets.

Functions

definitionsInFile(file_path)tuple of hou.HDADefinition

Return all the digital asset definitions inside an otl file. See hou.HDADefinition for more information.

Raises hou.OperationFailed if file_path does not refer to a valid otl file.

# Print the node types defined by digital assets in $HOME/houdiniX.Y/otls/OPcustom.otl:
>>> import os
>>> my_otl_file = "%s/otls/OPcustom.otl" % hou.homeHoudiniDirectory()
>>> for definition in hou.hda.definitionsInFile(my_otl_file):
...     print definition.nodeTypeCategory().name() + "/" + definition.nodeTypeName()
Sop/gcoggeo
Sop/gCogFlatGeo
Sop/gDivideAtCentroid
Object/gAxle
Object/gCog
installFile(file_path, oplibraries_file=None, change_oplibraries_file=True, force_use_assets=False)

Install all the node types defined in an otl file into the current Houdini session. This function is equivalent to File > Install Digital Asset Library... in Houdini.

file_path

The otl file to load.

oplibraries_file

The path to an OPlibraries file or None. OPlibraries files are text files containing lists of otl files to load on startup. When Houdini starts up it reads all the OPlibraries files it finds in the Houdini path and loads all the otl files listed in them. By creating OPlibraries files in $HOME/houdiniX.Y, $HSITE/houdiniX.Y, $JOB, etc. you can create libraries that are specific to a particular user, studio, job, etc.

This parameter is only meaningful when change_oplibraries_file is True.

Note that OPlibraries are only used when the Use OPlibraries files to find OTLS checkbox in the Configuration tab of the Operator Type Manager is checked.

change_oplibraries_file

When oplibraries_file is not None and this parameter is True, Houdini will modify the OPlibraries file, adding the otl file to it.

force_use_assets

When True, ensure that the definitions inside the otl file are current. If they would not otherwise provide the current definition, they are marked as preferred to ensure they are current. See hou.HDADefinition.isPreferred for more information.

Note that, if you do not store the path to the otl file in an OPlibraries file, Houdini will store it in the current Houdini session. So, when you load a hip file, it will try to load the otl files that it references.

uninstallFile(file_path, oplibraries_file=None, change_oplibraries_file=True)

Uninstall an otl file and all the node type definitions it provides from the current Houdini session. The otl file and its contents on disk are unchanged.

You can set file_path to the special name "Embedded" to refer to the digital assets embedded in the current hip file. The following example removes any embedded digital asset definitions from the current Houdini session:

hou.hda.uninstallFile("Embedded")

If oplibraries_file is not None and change_oplibraries_file is True, Houdini will remove the path to the otl from the specified OPlibraries file. See hou.hda.installFile for more information about these parameters.

If all the definitions of a node type are uninstalled, any instances of that node type will warn that they are using an incomplete asset definition. They will, however, retain their parameter values as spare parameters. Installing an otl file with the missing node type will restore those node instances and remove the warnings.

See also hou.HDADefinition.destroy.

reloadFile(file_path)

Reload the contents of an otl file, loading any updated digital asset definitions inside it.

You only need to call this function if an otl file was modified from outside the current Houdini session.

loadedFiles()tuple of str

Return a tuple of paths to the otl files that are loaded into the current Houdini session.

This method is can be approximately implemented as follows:

def loadedFiles():
    '''Return a list of otl files loaded into this Houdini session.'''
    # Look through all the node types, and for those that have digital
    # asset definitions, remember the otl file containing the definition.
    result = []
    for category in hou.nodeTypeCategories().values():
        for node_type in category.nodeTypes().values():
            definition = node_type.definition()
            if definition is None:
                continue
            if definition.libraryFilePath() not in result:
                result.append(definition.libraryFilePath())
    return result

See hou.HDADefinition.isCurrent for an example.

expandToDirectory(file_path, directory_path)

Expand the contents of the otl file in file_path into the directory directory_path. If the directory does not already exist it is created.

When expanding an otl file, Houdini puts each digital asset definition in the file into its own directory. As well, it puts each section inside a definition into its own file. Each directory inside the expanded file tree contains a Sections.List file that maps the actual file or directory names into the section names, since section names may contain characters that cannot occur in directory or file names. See hou.HDASection for more information about sections.

This function provides an easy way to inspect and modify the contents of an otl file. See also hou.hda.collapseFromDirectory.

collapseFromDirectory(file_path, directory_path)

Given a directory that contains a previously expanded otl file, collapse it into the otl file specified by file_path.

This function provides the inverse of hou.hda.expandToDirectory.

renameSource(oplibraries_file, source_name=None)

Give a name to an OPlibraries file. This name appears in the Operator Type Manager’s list of OPlibraries file. If source_name is None, the name is removed from the OPlibraries file.

If the oplibraries_file does not already exist, it is created.

See hou.hda.installFile for more information about OPlibraries files.

encryptAsset(node, file_path, email, password, company, license_names, compile_basic=True, compile_vopnets=True, compile_channels=True, compile_nodenames=True)

This feature is not yet documented

createEntitlement(email, password, company, license_name, server_code, entitled_email, license_type=hou.hdaLicenseType.Execute, expiry=0.0)

This feature is not yet documented

availableEntitlements(email, password)tuple of str

This feature is not yet documented

redeemEntitlements(email, password, license_file=None, entitlements=())

This feature is not yet documented