Functions ¶
defaultFilePath()
→ str
newShelf(file_path=None, name=None, label=None)
→ hou.Shelf
Returns a new hou.Shelf object using the provided options.
You must use this function to create new shelf tabs, you can’t
instantiate the Shelf
class directly.
newShelfSet(file_path=None, name=None, label=None)
→ hou.ShelfSet
Returns a new hou.ShelfSet object using the provided options.
You must use this function to create new shelf sets, you can’t
instantiate the ShelfSet
class directly.
newTool(file_path=None, name=None, label=None, script=None, language=hou.scriptLanguage.Python, icon=None, help=None, help_url=None, network_categories=(), viewer_categories=(), cop_viewer_categories=(), network_op_type=None, viewer_op_type=None, locations=(), hda_definition=None)
→ hou.Tool
Returns a new hou.Tool object using the provided options.
You must use this function to create new shelf tabs, you can’t
instantiate the Tool
class directly.
loadFile(file_path)
Reads a shelf file and adds any shelves and tools defined in that file to Houdini.
reloadShelfFiles()
Reloading the shelf files found in the search path and update the shelf UI with any changed information.
shelfSets()
→ dict
of str
to hou.ShelfSet
Returns a dictionary mapping the internal name of every known shelf tab to a corresponding hou.Shelf object.
shelves()
→ dict
of str
to hou.Shelf
Returns a dictionary mapping the internal name of every known shelf tab to a corresponding hou.Shelf object.
tools()
→ dict
of str
to hou.Tool
Returns a dictionary mapping the internal name of every known tool to a corresponding hou.Tool object.
Note
If you only want to get a single tool by its internal name,
use the tool function. Using shelves.tool(name)
is
much faster that constructing this dictionary and then
pulling a single tool out of it.
tool(tool_name)
→ hou.Tool or None
Gets a reference to a hou.Tool by its internal name.
>>> hou.shelves.tool("geometry_sphere") <hou.Tool 'geometry_sphere'>
beginChangeBlock()
Prevents Houdini from automatically rewriting shelf information files until endChangeBlock is called.
Normally, many shelf editing functions and methods cause Houdini to rewrite the shelf definition files with the new information. If you're changing a lot of shelves/tools at once, it could be quite slow as each individual change is written separately.
To speed up “batch” changes, call beginChangeBlock()
first, then perform
the edits, then call endChangeBlock()
. This delays rewriting the shelf
files until the end when all changes are written at once.
Warning
Always use Python exception handling to ensure the change block is closed. Otherwise, subsequent edits in the entire Houdini session will not be saved to file, if an exception is thrown in the middle of the change block.
# Change the icon of every tool to MISC_angry_fruit_salad. # DON'T ACTUALLY DO THIS! # First, turn off writing changes hou.shelves.beginChangeBlock() try: for shelf in hou.shelves.shelves().values(): for tool in shelf.tools(): tool.setIcon("MISC/angry_fruit_salad") finally: # Finish the change block and write all the changes to disk hou.shelves.endChangeBlock()
Each call to beginChangeBlock
must have a matching call to endChangeBlock
or Houdini will never actually write your changes to disk.