Python makes it easy to explore and search the HOM API. If you type
into Houdini’s Python shell, it will pop up a list of possible attribute
completions (e.g. functions, classes, constants, etc.). Popup completion
will work for any Python variable. For example, if
n is a variable
referring to a hou.Node object, typing
n.ch will pop up a list of
method completions (e.g. changeNodeType, children, childTypeCategory).
Press tab in Houdini’s Python shell to automatically complete what you're typing. Press Ctrl+tab in a Python source editor for completion.
The Python popup help will also display the reference documentation for
a function or method after you type an opening parenthesis (
() after a
function or method name. For example, typing
hou.node will list attributes
of the hou module starting with “node”, but typing
hou.node( will display the
help for the hou.node function.
Popup help and tab completion will not work on results of functions. For example, you will get popup help for...
>>> n = hou.node('/obj'); >>> n.parm(
...but you won’t get it for...
The reason is that
the latter needs to evaluate hou.node('/obj') to determine what type
of object it is, and that evaluation could have unintended side effects.
For example, automatically evaluating
file('~/.bashrc', 'w'). to list
possible completions for the file object could have unintended effects.
Depending on the method or function, Houdini’s Python shell may also list
possible argument completions. For example, if you type
you’ll get a list of the objects inside /obj.
The standard Python
help() functions can also be very helpful to
explore the hou module, and will work in a shell without popup completion.
dir(hou.ObjNode), for example, to list all the attributes of the
hou.ObjNode class. Or, type
list the attributes of the hou.NodeType class. To learn more about a
particular attribute, use the help() function. For example,
help(hou.ObjNode.worldTransform) will print the
hou.ObjNode.worldTransform method’s help in the shell.
You can also explore the hou module’s reference documentation with the help browser.
The HOM reference documentation also lists functions, methods, classes, and submodules that are not implemented in this version of Houdini but can be expected in future versions of Houdini.
The hou module uses these naming conventions:
hou functions and class methods use lowerCamelCase.
Classes start use UpperCamelCase.
hou submodules use lowerCamelCase. There are two types of hou submodules.
Submodules that contain enumeration values.
Submodules that contain a collection of related functions.
Parameter names use
Methods and functions used internally by Houdini start with a single underscore.