hou.Node class

The node() function returns a node in the scene by its path. The Node class is the base class for all Houdini nodes.

All Methods Replaces

Subclasses: hou.ObjNode , hou.VopNetNode , hou.CopNode , hou.PopNetNode , hou.DopNetNode , hou.SopNode , hou.DopNode , hou.PopNode , hou.RopNode , hou.ChopNode

You cannot create instances of hou.Node by calling the constructor. You can access Node objects by getting an existing node with hou.node() or by creating a child node inside an existing node (see the hou.Node.createNode method).

n = hou.node("/obj/object1/sphere1")

The hou.node() function returns None if the given node path does not exist.

Note that a Node object internally stores a reference to the corresponding Houdini node, and that their lifetimes are different. If a Python variable referring to a Node object is deleted, the Node object will be destroyed and the Houdini node will be unaffected. Also, if you have a Node object in a Python variable and the Houdini node is deleted, the Python variable will still exist, and Python will not crash. When you call a method on the Python Node object it raises a hou.ObjectWasDeleted exception.

Methods

addNodeGroup(self, name=None)hou.NodeGroup

Adds a node group to the node, and returns the new group.

If a group of the given name already exists then this function simply returns the existing group without adding a new one. If the name of the group is not specified or is an empty string, then a unique default name is automatically chosen.

This function can only be called on nodes that are networks. If it is called on a node that is not a network, then it raises OperationFailed.

addPermissions(self, permissions)

Not implemented yet

addSpareParmFolder(self, folder_name, in_folder=(), parm_name=None, create_missing_folders=False)

Adds a folder to the spare parameters.

Note that all the folders in a set correspond to one parameter. If this is the first folder to go in the set, parm_name will be used as the parameter name. Otherwise, parm_name will be ignored and the parameter name of the first folder in the set is used.

If this is the first folder in the set and parm_name is None, it will default to 'sparefolder0'. If parm_name is already in use, a unique name will be automatically generated.

If create_missing_folders is True, this method will create the folders in in_folder that don’t exist. So, this method can be used to add spare folders and a spare parameter at the same time.

See also the removeSpareParmFolder() and addSpareParmTuple() methods.

addSpareParmTuple(self, parm_template, in_folder=(), create_missing_folders=False)hou.ParmTuple

Not documented yet

See also the removeSpareParmTuple() and addSpareParmFolder() methods.

allowEditingOfContents(self, propagate=False)

Unlocks a digital asset so its contents can be edited.

To use this function, you must have permission to modify the HDA.

allSubChildren(self) → tuple of Nodes

Not implemented yet

allSubChildrenOfType(self, node_type) → tuple of Nodes

Not implemented yet

appendComment(self, comment)

Appends the given text to the comment associated with this node.

asCode(self, brief=False, recurse=False, save_channels_only=False, save_creation_commands=False, save_keys_in_frames=False, save_outgoing_wires=False, save_parm_values_only=False, save_spare_parms=True, function_name=None)str

Prints the Python code necessary to recreate a node.

brief

Do not set values if they are the parameter’s default. Applies to the contents of the node if either recurse or save_box_contents is True.

recurse

Recursively apply to the entire operator hierarchy.

save_box_contents

Script the contents of the node.

save_channels_only

Only output channels. Applies to the contents of the node if either recurse or save_box_contents is True.

save_creation_commands

Generate a creation script for the node. If set to False (the default), the generated script assumes that the network box already exists. When set to True, the script will begin by creating the network box.

save_keys_in_frames

Output channel and key times in samples (frames) instead of seconds. Applies to the contents of the node if either recurse or save_box_contents is True.

save_parm_values_only

Evaluate parameters, saving their values instead of the expressions. Applies to the contents of the node if either recurse or save_box_contents is True.

save_spare_parms

Save spare parameters as well. When save_creation_commands is True, commands for creating spare parameters will also be output. Applies to the contents of the node if either recurse or save_box_contents is True.

function_name

If a function_name is specified, the output will be wrapped in a Python function.

asXML(self, recurse=True, output_non_default_parms=True)

Not implemented yet

changeNodeType(self, new_node_type, keep_name=True, keep_parms=True, keep_network_contents=True)hou.Node

Changes the node to a new type.

Keep_name, keep_parms, and keep_network_contents indicate that the node should keep the same name, parameter values, and contents, respectively, after its type has changed.

children(self)tuple of hou.Node

Returns a list of nodes that are children of this node. To find the number of children nodes, use len(node.children()).

# Prints the node names of the top-level objects
# in the current scene.

for n in hou.node("/obj").children():
    print n.name()
childrenOfType(self, node_type) → tuple of Nodes

Not implemented yet

childTypeCategory(self) → NodeTypeCategory

Not documented yet

clearParmAliases(self)

Removes all alias names from parameters on the node.

collapseIntoSubnet(self, child_nodes, subnet_name=None)hou.Node

Collapses the node and any specified child nodes into a subnetwork.

Any nodes in the tuple child_nodes become part of the subnetwork. However, hou.OperationFailed is raised if child_nodes contains a node that is not a child of the node on which this function is called. If subnet_name is given, the new subnet will be given that name, wherever possible.

color(self)hou.Color

Returns the color of this node’s tile in the network editor.

colorRampKeys(self) → tuple of position and color tuples

Not implemented yet

comment(self)str

Returns the node’s comment string.

cook(self, force=False, frame_range=())

Asks or forces an object to re-cook.

frame_range

The frames at which to cook the object. This should be a tuple of 2 or 3 ints giving the start frame, end frame, and optionally a frame increment, in that order. If you supply a two-tuple (start, end), the increment is 1.

copyNetworkBox(self, network_box_to_copy, new_name=None, channel_reference_original=False)hou.NetworkBox

Copies a network box and returns the copy.

If new_name is given, the network box will be copied to a new network box named new_name (a different name will be generated if there’s already a network box with that name).

If channel_reference_original is True, all operators created by the copy will have their animatable parameters set to reference the original operators.

Raises hou.OperationFailed if this node is not a network or if the node child type does not match the network box’s node type.

createDigitalAsset(self, name=None, hda_file_name=None, description=None, min_num_inputs=None, max_num_inputs=None, compress_contents=False, comment=None, version=None, save_as_embedded=False, ignore_external_references=False)Node

Not documented yet

If file_name is None, it will use $HOME/houdiniX.Y/otls/OPcustom.otl.

createNetworkBox(self, name=None)hou.NetworkBox

Creates a network box inside this network. Raises hou.OperationFailed if this node is not a network.

If you don’t specify a name, Houdini gives the box a default name.

createNode(self, node_type_name, node_name=None, run_init_scripts=True, load_contents=True)hou.Node

Creates a new node of type node_type_name as a child of this network node. Raises hou.OperationFailed if this node is not a network.

node_name

The name of the new node. If not specified, Houdini gives the new node a default name.

run_init

If True, the initialization script associated with the node type will be run on the new node.

load_contents

If True, any subnet contents will be loaded for custom subnet operators.

Raises hou.PermissionError if this node is inside a locked asset.

creationTime(self) → datetime.datetime

Not implemented yet

creator(self) → Node

Not documented yet

creatorState(self)str

Not documented yet

curChild(self)

Not implemented yet

deleteChild(self, child_name)

Not implemented yet

deleteScript(self)str

Returns the script that will run when this node is deleted.

destroy(self)

Deletes this node.

Any attempt to call methods on a hou.Node instance after it has been destroy()-ed will raise hou.ObjectWasDeleted.

digitsInName(self)int

Return the value of the last set of digits inside the node’s name, or 0 if there are no digits.

For example, the result is 102 for a node named geo102, and 34 for a node named light12to34.

errors(self)str

Returns the text of any errors from the last cook of this node, or the empty string ("") if there were no errors.

evalParm(self, parm_path)int, float, or str

Evaluates the specified parameter and returns the result.

evalParmTuple(self, parm_path)tuple of int, float, or str

Evaluates the specified parameter tuple and returns the result.

expressionLanguage(self)hou.exprLanguage enum value

Return the node’s default expression language.

When you enter an expression in a parameter that does not already contain an expression, the node’s expression language is used to determine how that expression should be evaluated. You can change a node’s expression language in the parameter dialog in the GUI.

Changing the node’s expression language will not change the language in parameters already containing expressions (i.e. parameters with keyframes).

Note that if a parameter already contains an expression and you change that expression in the GUI, the expression language will not change, regardless of the value of the node’s expression language. To change the language of an existing expression in a parameter from Python, use hou.Parm.setExpression, as in parm.setExpression(parm.expression(), language).

extractAndDelete(self)

Extracts the contents of a subnetwork and delete the subnetwork. The opposite of collapseIntoSubnet().

Raises hou.InvalidNodeType if this node is not a subnetwork.

extraInputs(self) → tuple of Nodes

Not implemented yet

extraOutputs(self) → tuple of Nodes

Not implemented yet

fileReferencePatterns(self, recurse=False, ignore_unused_subnet_branches=False) → tuple of Parm and file_name tuples

Not implemented yet

fileReferences(self, recurse=False, ignore_unused_subnet_branches=False) → tuple of Parm and file_name tuples

Not implemented yet

findNetworkBox(self, name)hou.NetworkBox

Return a network box with the given name inside this node, or None if no network box with the given name exists.

findNetworkBoxes(self, pattern)tuple of hou.NetworkBox

Return a list of network boxes inside this node whose names match a pattern.

findNodes(self, pattern) → tuple of Nodes

Not implemented yet

findParms(self, pattern) → tuple of Parms

Not implemented yet

glob(self, pattern) → tuple of Nodes

Not implemented yet

hdaModule(self)hou.HDAModule

Returns the HDAModule object for this node’s type. If the node is not an instance of a digital asset, the module is empty. Otherwise, the module contents will be the user-defined “Python Module” section in the digital asset.

hide(self, on)

Not implemented yet

indirectInputs(self)tuple of hou.SubnetIndirectInput

Returns the hou.SubnetIndirectInput objects of a subnet.

Raises hou.InvalidNodeType if this node is not a subnetwork.

info(self, verbose=False)str

Not implemented yet

inputAncestors(self)tuple of hou.Node

Returns a tuple of all input ancestors of this node. If include_ref_inputs is False, then reference inputs are not traversed. If follow_subnets is True, then instead of treating subnetwork nodes as a single node, we also traverse its children starting with its display node.

See also the inputs() method.

inputConnections(self) → tuple of hou.NodeConnection

Returns a list of NodeConnection objects for the nodes connected this node’s inputs.

To get a list of the connected nodes themselves, use the inputs() method.

inputConnectors(self) → tuple of tuple of NodeConnections

Not documented yet

inputs(self)tuple of hou.Node

Returns a list of the nodes connected to this node’s inputs.

insertInput(self, input_index, node_to_become_input, output_index=0) OR insertInput(self, input_index, indirect_to_become_input)

Not documented yet

isCurrent(self)bool

Returns True if the node is the “current” node.

isHidden(self)

Not implemented yet

isInsideLockedHDA(self)bool

Returns whether this node is inside a locked digital asset. If this node is not inside a locked HDA, the node may deviate from the OTL definition.

isLocked(self)bool

Returns whether or not this HDA instance is locked. If this node is unlocked, it may deviate from the OTL definition.

isNetwork(self)

Not implemented yet

isSelected(self)bool

Returns whether this node is selected.

layoutChildren(self, child_nodes=[], horizontal_spacing=-1, vertical_spacing=-1)

Not documented yet

loadOldStylePresetsFile(self, presets_file_name)

Not implemented yet

loadPresets(self, presets)

Not implemented yet

matchCurrentDefinition(self)

Syncs the contents of this node with its type definition.

For subnet types that were saved with their contents locked, you can use this command to replace the contents of node with the contents of the operator type. The parameters of the node are not modified, only the contents.

matchesCurrentDefinition(self)bool

Returns whether the contents of the node match its type definition.

matchesDefinition(self)

Not implemented yet

modificationTime(self) → datetime.datetime

Not implemented yet

move(self, vector2)

Moves this node’s tile in the network editor graph by the increments in the given hou.Vector2. To position a node absolutely, use setPosition(). To get the node’s current graph position, use position().

Raises hou.InvalidInput if the node cannot move to the position specified.

moveToGoodPosition(self, relative_to_inputs=True, move_inputs=True, move_outputs=True, move_unconnected=True)hou.Vector2

Moves a node to a well-spaced position near its inputs or outputs and returns the new position of the node.

name(self)str

Returns this node’s name.

networkBoxes(self) → tuple of hou.NetworkBox

Return a list of the network boxes inside this node.

node(self, node_path)hou.Node or None

Returns the node at the given path, where a relative path is resolved relative to this node.

For example, to get the parent node of a node in the the variable “n”, use n.node(".."). To get a child node named "geo5", use n.node("geo5"). To get a sibling node named "light3", use n.node("../light3").

Note that the return value may be an instance of a subclass of Node. For example, if the node being found is an object node, the return value will be a hou.ObjectNode.

nodeGroup(self, name)hou.NodeGroup

Returns a node group contained by the node with the given name, or None if the group does not exist.

nodeGroups(self) → tuple of hou.NodeGroup

Returns the list of node groups in this node.

outputConnections(self) → tuple of hou.NodeConnection

Returns NodeConnection objects for the nodes connected to this node’s outputs. To get a list of the nodes themselves, use outputs().

outputConnectors(self) → tuple of tuple of NodeConnections

Not documented yet

outputs(self) → tuple of Nodes

Not documented yet

parent(self)hou.Node

Returns the network node that contains this node.

parm(self, parm_path)hou.Parm or None

Returns the parameter at the given path, or None if the parameter doesn’t exist.

parmAliases(self, recurse=False) → dict of hou.Parm to str

Returns a dictionary of parameter aliases on the node’s parameters. The keys in the dictionary are the parameters that have aliases and the values are the alias names.

recurse

Return the parameter aliases for this node and its children.

parms(self)tuple of hou.Parm

Returns a list of the parameters on this node.

parmsInFolder(self, folder_names, folder_style)tuple of hou.Parm

Returns a list of parameters in a folder on this node. Returns all parameters in the folder and its subfolders (if any).

folder_names

A sequence of folder name strings. For example, to get a list of the parameters in the Shading folder of the Render folder, use ("Render", "Shading").

If this sequence is empty, the method returns all parameters on the node, the same as if you called parms().

folder_style

A member of hou.folderType describing how the folder is rendered.

Raises hou.OperationFailed if the folder specified by folder_names does not exist.

See also hou.Parm.containingFolders and hou.Parm.containingFolderSetParmTuples

parmToNodeReferences(self, max_hierarchy_depth=None)dict of hou.Parm to hou.Node

Not implemented yet

parmTuple(self, parm_path)hou.ParmTuple or None

Returns the parm tuple at the given path, or None if it doesn’t exist.

This method is similar to parm(), except it returns a hou.ParmTuple instead of a hou.Parm.

parmTuples(self)tuple of hou.ParmTuple

Returns a list of all parameter tuples on this node.

This method is similar to parms(), except it returns a list of hou.ParmTuple instead of hou.Parm.

parmTuplesInFolder(self, folder_names) → tuple of hou.ParmTuple

Returns a list of the parameter tuples in a folder on this node. This method is similar to parmsInFolder(), except it returns a list of hou.ParmTuple instead of hou.Parm. See parmsInFolder() above for information about the arguments.

See also hou.Parm.containingFolders and hou.Parm.containingFolderSetParmTuples

path(self)str

Returns the path of this node in the network.

permissions(self)int

Not implemented yet

pickedChildren(self) → tuple of Nodes

Not implemented yet

pickedChildrenRecursively(self, keep_same_node_type_category=True)tuple of hou.Node

Not implemented yet

position(self)hou.Vector2

Returns the position of this node’s tile in the network editor graph as a Vector2. See also move() and setPosition().

referencedNodes(self, max_hierarchy_depth=None) → tuple of Nodes

Not implemented yet

relativePathTo(self, base_node)str

Returns a relative path to base_node from this node.

removeColorRampKey(self, position)

Not implemented yet

removePermissions(self, permissions)

Not implemented yet

removeSpareParmFolder(self, folder)

Removes an empty folder from the spare parameters.

folder is a sequence of folder names. So, to remove the Output folder, use ("Output",) instead of "Output".

See also addSpareParmFolder().

removeSpareParmTuple(self, parm_tuple)

Removes the specified spare parameter tuple.

See also addSpareParmTuple().

reorderChildrenAfter(self, children_nodes, after_node=None)

Not implemented yet

reorderChildrenBefore(self, children_nodes, before_node=None)

Not implemented yet

reorderChildrenToBeginning(self, children_nodes)

Not implemented yet

reorderChildrenToEnd(self, children_nodes)

Not implemented yet

runInitScripts(self)

Runs the initialization script associated with this node’s type.

saveCompiledCookCodeToFile(self, file_name)

Saves compiled VEX code to a disk file (on nodes that support this).

saveCookCodeToFile(self, file_name, skip_header=False)

Saves VEX/RSL source code to a disk file (on nodes that support this).

saveDefinition(self, ignore_external_references=False)

Not implemented yet

saveOldStylePresetsFile(self, presets_file_name)

Not implemented yet

savePresets(self, presets_name, dir_name=None) → NodeParmPresets

Not implemented yet

selectedChildren(self, include_hidden = False)tuple of hou.Node

Return a list of selected nodes that are children of this node. The current node is always the last selected node.

The include_hidden parameter controls whether or not hidden nodes can be returned, even if they are selected.

The following example will print the names of all selected objects in /obj:

for n in hou.node("/obj").selectedChildren():
    print n.name()

To find the total number of children nodes, use len(node.selectedChildren()).

sessionId(self)

Not implemented yet

setColor(self, color)

Sets the color of this node’s tile in the network editor to the given hou.Color.

setColorRampKey(self, position, color)

Not implemented yet

setComment(self, comment)

Sets the comment associated with this node. See also appendComment().

setCreatorState(self, state)

Not documented yet

setCurrent(self, on, clear_all_selected=False)

Sets or unsets this node as the “current” node, optionally deselecting all other selected nodes.

setDeleteScript(self, script_text, language=hou.scriptLanguage.Python)

Sets the script that will run when this node is deleted.

setExpressionLanguage(self, language)

Set the node’s default expression language. See expressionLanguage() for more information.

setFirstInput(self, node_to_become_input, output_index=0) OR setFirstInput(self, indirect_to_become_input)

Not documented yet

setInput(self, input_index, node_to_become_input, output_index=0) OR setInput(self, input_index, indirect_to_become_input)

Not documented yet

setName(self, name, unique_name = False)

Sets the name of this node. Raises hou.InvalidNodeName if the new name contains characters other than letters, numbers, periods, dashes, or underscores. Raises hou.OperationFailed if the node could not be renamed (for example, another node already exists with the name, the node is the root node or top-level manager, or the node is inside a locked asset). If the unique_name parameter is set to True, the supplied name may be changed to ensure that it doesn’t match the name of any existing node.

setNextInput(self, node_to_become_input, output_index=0) OR setNextInput(self, indirect_to_become_input)

Not documented yet

setPermissions(self, permissions)

Not implemented yet

setPosition(self, vector2)

Sets the position of this node’s tile in the network editor graph. Raises hou.InvalidInput if the node cannot have the given position.

setSelected(self, on, clear_all_selected=False)

Selects or deselects this node, optionally deselecting all other selected nodes.

showFloatingDetailsViewWindow(self)

Not implemented yet

showFloatingParmWindow(self)

Not implemented yet

size(self)hou.Vector2

Returns the size of this node’s tile in the network editor graph as a Vector2.

spareParms(self) → tuple of hou.Parm

Returns a list of the spare (user-defined) parameters on this node.

stampValue(self, parm_name, default_value)

Not implemented yet

subpathUpToNonSubnet(self)

Not implemented yet

type(self)hou.NodeType

Returns the NodeType object for this node. For example, all camera nodes share the same node type.

unsetInput(self, input_index)

Not implemented yet

warnings(self)str

Returns the text of any warnings from the last cook of this node, or the empty string ("") if there were no warnings.

_getArgumentAutoComplete(self, method_name, arguments) → tuple of str

Not documented yet

__eq__(self, node)bool

Implements == between Node objects.

For example, hou.root() == hou.node(“/”) will return True.

There can be multiple Python Node objects for the same Houdini node. Two identical calls to hou.node() will return different Python Node objects, with each representing the same Houdini node. Comparing these nodes using == (which calls __eq__) will return True, while comparing them using is (the object identity test) will return false.

You can compare a node to None. This behavior is useful because hou.node() returns None if the node doesn’t exist. Comparing an node to anything other than another node or None raises TypeError.

__getitem__(self, parm_name)

Not implemented yet

__ne__(self, node)bool

Implements != between Node objects. See __eq__().

Replaces

chalias command , chaneditor command , nbadd command , nbcp command , nbglob command , nbls command , opadd command , opautoplace command , opchangetype command , opchmod command , opcollapse command , opcolor command , opcomment command , opcook command , opdelscript command , opdepend command , opextern command , opextract command , opfind command , opgadd command , opget command , opgetinput command , opglob command , opgls command , opinfo command , oplayout command , oplocate command , opls command , opname command , oporder command , oppane command , opparm command , oppresetload command , oppresetloadfile command , oppresetsave command , oppresetsavefile command , opramp command , oprm command , oprmtype command , opscript command , opset command , opspare command , opstat command , optype command , opunwire command , opwire command , otedit command , otsync command , ch expression function , chexist expression function , chs expression function , chsop expression function , icl expression function , icn expression function , icr expression function , ics expression function , opdigits expression function , opexist expression function , opflag expression function , opfullpath expression function , opfullpathfrom expression function , opid expression function , opinput expression function , opinputpath expression function , opname expression function , opnchildren expression function , opninputs expression function , opnoutputs expression function , opoutput expression function , opoutputpath expression function , oprelativepath expression function , opselect expression function , opselectrecurse expression function , opsubpath expression function , optype expression function , optypeinfo expression function , stamp expression function , stamps expression function