hou.hipFile module
Functions
clear(suppress_save_prompt=False)-
This function replaces the current session with an empty session.
If suppress_save_prompt is set to False, the method acts as “File → New” in an interactive session. It prompts you to save the current file before clearing. Otherwise, the session is cleared non-interactively: no prompts appear and any changes are discarded.
If the UI is not available (for example, if you run the method from hython), the suppress_save_prompt parameter is ignored and non- interactive clear is always performed.
collisionNodesIfMerged(file_name, node_pattern="*")→ tuple of hou.Node-
Returns the Nodes that would collide if a merge was performed with the specified node_pattern.
The result is a tuple of all Nodes in the merge file satisfying the node_pattern and having the same name as any of the existing nodes.
Raises hou.OperationFailed if the file to be used in the collision check does not exist, cannot be opened, or is not a valid hip file. The same exception will also be thrown if the method is called during shutting down or loading/saving a hip file. In each case, the exception instance message will reflect the failure reason.
hasUnsavedChanges()→bool-
Returns whether the current Houdini session has been modified since it was last saved.
isLoadingHipFile()→bool-
Return whether the main application is loading a hip file.
isShuttingDown()→bool-
Return whether the main application is shutting down.
load(file_name, suppress_save_prompt=False)-
Loads a hip file.
If suppress_save_prompt is
False, the function acts as if the file was loaded via “File → Open…”. It prompts you to save the current file before loading the new file and displays any load errors in a popup window. It also changes the name of the current file at the top of the main window and adds the file name to the list of most recently used files.If the UI is not available (for example, if you run the function from hython), the suppress_save_prompt parameter is ignored and non- interactive load is always performed.
Raises hou.OperationFailed if the file to be loaded does not exist or cannot be opened. The same exception will also be raised if the method is called during shutting down or loading/saving a hip file. In each case, the exception instance message will reflect the failure reason.
Raises hou.LoadWarning if warnings are generated during load. The instance message will contain the warning text.
merge(file_name, node_pattern="*", overwrite_on_conflict=False)-
Merges the given file into the current hip file. The nodes to merge in are indicated by the node_pattern parameter.
If
overwrite_on_conflictisTrue, the method will overwrite nodes with the same name as nodes in the merge file.This method will raise a hou.OperationFailed exception if the file to be merged into the current one does not exist or cannot be opened. The same exception will also be raised if the method is called during shutting down or loading/saving a hip file. In each case, the exception instance message will reflect the failure reason.
This method will raise a hou.LoadWarning exception if warnings are generated during merge. The instance message will contain the warning text.
name()→str-
Returns the name of the current hip file.
save(file_name=None)-
Saves the current session to a hip file.
If you do not provide a file name, the session will be saved under the current name. If you attempt to save a file to a directory that does not exist, the directory will be created.
Raises hou.OperationFailed if the target file or directory cannot be created or if other errors occur during save. The same exception will also be raised if the method is called during shutting down or loading/saving a hip file. In each case, the exception instance message will reflect the failure reason.
saveAndIncrementFileName()-
Saves the current session to a hip file, automatically incrementing the file name.
Raises hou.OperationFailed if the target file or directory cannot be created or if other errors occur during save. The same exception will also be raised if the method is called during shutting down or loading/saving a hip file. In each case, the exception instance message will reflect the failure reason.
saveAsBackup()-
Creates a numbered backup from the current session.
If a file with the same name as the current backup already exists, then the backup is renamed to contain the next number in the sequence before saving. The backup files are saved in the directory set in the environment variable HOUDINI_BACKUP_DIR. If HOUDINI_BACKUP_DIR is not set, then a default relative directory called “backup” is used.
Raises hou.OperationFailed if the target file or directory cannot be created or if other errors occur during save. The same exception will also be raised if the method is called during shutting down or loading/saving a hip file. In each case, the exception instance message will reflect the failure reason.
setOnSaveCallback(callback)