The base class for all nodes in Houdini (objects, SOPs, COPs, etc.) An instance of this class corresponds to exactly one instance of a node in Houdini.
Each node has a unique path that defines its location in the tree of nodes. The node path hierarchy is similar to the hierarchy of folders and files in a file system. Some nodes, called networks, may contain other nodes inside them, much like a file folder would, while other nodes may not. For example, an object node instance and a SOP subnetwork node instance may contain SOP nodes, but a box SOP instance may not.
Tip
Be careful not to confuse nodes with node types. A node is an instance
of a node type. For example suppose /obj/geo1/box1 is a box SOP. It has
its own unique name (box1) and its own copies of parameter values. It is
an instance of the box SOP node type. This node type defines what
parameters are common to all box SOP node instances, as well as the
algorithm that each BOX SOP performs. The class that represents a node
type is hou.NodeType.
You cannot create instances of hou.Node using hou.Node.__init__.
Instead, you look up Node objects corresponding to existing Houdini nodes
with hou.node_. To create a new Houdini node instance inside another
node, use hou.Node.createNode. To delete a Houdini node, use
hou.Node.destroy.
Note that a Node object internally stores a reference to the corresponding Houdini node, and that their lifetimes are different. If a Python node object is deleted because its reference count in Python goes to zero, the Houdini node will be unaffected. On the other hand, 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. Instead, if you later call a method on that Python Node object, Houdini will raise a hou.ObjectWasDeleted exception.
Be careful not to confuse this class with the function hou.node.
Methods
| __eq__ | Implements == between Node objects. |
| __ne__ | Implements != between Node objects. See __eq__(). |
| _getArgumentAutoComplete | This method is used internally by Houdini to perform autocompletion in the interactive Python shell. |
| addEventCallback | Register a Python callback that Houdini will call whenever a particular action, or event, occurs on this node. |
| addNodeGroup | Add a node group to the node and return the new group. |
| addSpareParmFolder | Adds a folder to the spare parameters. |
| addSpareParmTuple | Add a spare parameter tuple to the end of the parameters on the node. If in_folder is not an empty sequence, this method adds the parameters to the end of the parameters in a particular folder. |
| allSubChildren | Recursively return all sub children of this node. For example, hou.node("/").allSubChildren() will return all the nodes in the hip file. |
| allowEditingOfContents | Unlocks a digital asset so its contents can be edited. |
| appendComment | Appends the given text to the comment associated with this node. |
| asCode | Prints the Python code necessary to recreate a node. |
| changeNodeType | Changes the node to a new type (within the same contenxt). new_node_type is the internal string name of the type you want to change to. |
| childTypeCategory | Return the hou.NodeTypeCategory corresponding to the children of this node. For example, if this node is a geometry object, the children are SOPs. If it is an object subnet, the children are objects. |
| children | Return a list of nodes that are children of this node. Using the file system analogy, a node’s children are like the contents of a folder/directory. |
| clearParmAliases | Removes all alias names from parameters on the node. |
| collapseIntoSubnet | Given a sequence of children nodes of this node, collapse them into a subnetwork. In other words, create a subnet inside this node’s network and move the specified children of this network inside that subnet. |
| color | Return the color of this node’s tile in the network editor. |
| comment | Return the node’s comment string. |
| cook | Asks or forces the node to re-cook. |
| copyNetworkBox | Copies a network box and returns the copy. |
| copyStickyNote | Copies a sticky note and returns the copy. |
| createCompiledDigitalAsset | Create a compiled digital asset from this node. You would typically call this method on vop network nodes, such as Material Shader Builder SHOP, Surface Shader Builder SHOP, or VEX Surface SHOP Type VOPNET. This method uses the vop network to generate VFL code and to compile it to VEX, which is then stored in the digital asset section or sections. The digital asset does not have contents section, which means it does not have vop network inside, but instead relies on the saved VEX sections to provide the shader code. |
| createDigitalAsset | Create a digital asset from this node. You would typically call this method on subnet nodes. |
| createInputNode | Create a new node and connect it to one of this node’s inputs. Return the new node. |
| createNetworkBox | Creates a network box inside this network. Raises hou.OperationFailed if this node is not a network. |
| createNode | Create a new node of type node_type_name as a child of this node. |
| createOutputNode | Create a new node and connect its first input to this node’s (first) output. Return the new node. |
| createStickyNote | Creates a sticky note inside this network. Raises hou.OperationFailed if this node is not a network. |
| creator | |
| creatorState | This returns the name of the viewport tool that was used to be created. This name is not set by default and is usually the empty string. |
| deleteScript | Return the script that will run when this node is deleted. |
| destroy | Delete this node. |
| destroyUserData | Remove the user-defined data with this name. |
| digitsInName | Return the value of the last set of digits inside the node’s name, or 0 if there are no digits. |
| errors | Return the text of any errors from the last cook of this node, or the empty string ("") if there were no errors. |
| evalParm | Evaluates the specified parameter and returns the result. |
| evalParmTuple | Evaluates the specified parameter tuple and returns the result. |
| expressionLanguage | Return the node’s default expression language. |
| extractAndDelete | Move the children of this subnet node to become siblings of this node, and then delete this node. The method is the opposite of collapseIntoSubnet(). |
| findNetworkBox | Return a network box with the given name inside this node, or None if no network box with the given name exists. |
| findNetworkBoxes | Return a list of network boxes inside this node whose names match a pattern. |
| findNodesThatProcessedObject | Given a hou.DopObject, return a tuple of DOP nodes that processed that object. This raises an exception if this is not a dopnetwork. |
| findOrCreateMotionEffectsNetwork | Return a CHOP network node suitable for storing Motion Effects. By default, if the node doesn’t exist, it will be created. |
| findStickyNote | Return a sticky note with the given name inside this node, or None if no sticky note with the given name exists. |
| findStickyNotes | Return a list of sticky notes inside this node whose names match a pattern. |
| glob | Return a tuple of children nodes name matches the pattern. |
| hdaModule | This method is a shortcut for `self.type().hdaModule() to reduce the length of expressions in Python parameters and button callbacks. See hou.NodeType.hdaModule for more information. |
| hide | Hide or show a node in the network editor. See hou.Node.isHidden for more information about hidden nodes. |
| hm | This method is a shortcut for self.hdaModule(). |
| indirectInputs | Return the hou.SubnetIndirectInput objects of a subnet. |
| inputAncestors | Return 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. |
| inputConnections | Return a tuple of NodeConnection objects for the connections coming into the top of this node. If nothing is wired into this node, return an empty tuple. |
| inputConnectors | Return a tuple of tuples of hou.NodeConnection objects. The length of the result tuple is equal to the number of input connectors on this node. Each subtuple contains exactly one node connection if something is wired into the connector; otherwise it is the empty tuple. |
| inputs | Return a tuple of the nodes connected to this node’s inputs. |
| insertInput | Insert an input wire. In other words, for each input connector after input_index, shift the contents of that input connector to the next one, and then call hou.Node.setInput. See hou.Node.setInput for the meanings of the parameters. |
| isBuiltExplicitly | Return whether this node was built explicitly (defaults to True). Most nodes are built explicitly, but some are implicitly created by Houdini. For example, if you select geometry from multiple SOPs and then perform an operation, Houdini will put down an implicit merge SOP before performing that operation. When reselecting geometry in SOPs, Houdini will automatically delete any SOPs that were created implicitly. |
| isCurrent | Return a boolean to indicate of the node is the last selected node in its network. |
| isHidden | Return whether the node is hidden in the network editor. Note that Houdini also uses the term “exposed” to refer to nodes that are not hidden. |
| isInsideLockedHDA | Return 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 | If this node is an instance of a digital asset, return whether or not it is locked. Otherwise, return False. |
| isSelected | Return whether this node is selected. |
| isTimeDependent | Return whether the node is time dependent. A time dependent node is re-evaluated every time the frame changes. |
| layoutChildren | Automatically position all or some children of this node in the network editor. |
| loadChildrenFromFile | Load the contents of a file saved with hou.Node.saveChildrenToFile into the contents of this node. |
| matchCurrentDefinition | If this node is an unlocked digital asset, change its contents to match what is stored in the definition and lock it. The parameter values are unchanged. |
| matchesCurrentDefinition | Return whether the contents of the node match its type definition. A locked digital asset instance will always match its definition, but an unlocked one may not. |
| messages | Return the text of any messages from the last cook of this node, or the empty string ("") if there were no messages. |
| motionEffectsNetworkPath | Return a node path representing the location for storing clips. This location may or may not exist. To find or create such a network, use hou.Node.findOrCreateMotionEffectsNetwork. |
| move | Moves this node’s tile in the network editor graph by the increments in the given hou.Vector2. |
| moveToGoodPosition | Moves a node to a well-spaced position near its inputs or outputs and returns the new position of the node. |
| name | Return this node’s name. See also hou.Node.path. |
| networkBoxes | Return a list of the network boxes inside this node. |
| node | Return the node at the given path, or None if no such node exists. If you pass in a relative path (i.e. the path does not start with /), searches are performed relative to this node. |
| nodeGroup | Return a node group contained by the node with the given name, or None if the group does not exist. |
| nodeGroups | Return the list of node groups in this node. |
| outputConnections | Return a tuple of NodeConnection objects for the connections going out of the bottom of this node. If nothing is wired into the output of this node, return an empty tuple. |
| outputConnectors | Return a a tuple of tuples of hou.NodeConnection objects. The length of the result tuple is equal to the number of output connectors on this node. Each subtuple contains all the connections going out of that connector, and is empty if nothing is wired to that connector. |
| outputs | Return a tuple of the nodes connected to this node’s outputs. |
| parent | Return the node that contains this node. |
| parm | Return the parameter at the given path, or None if the parameter doesn’t exist. |
| parmAliases | Return 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. |
| parmTemplateGroup | Return the group of parm templates corresponding to the current parameter layout for this node. |
| parmTuple | Return the parm tuple at the given path, or None if it doesn’t exist. |
| parmTuples | Return a list of all parameter tuples on this node. |
| parmTuplesInFolder | Return 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. |
| parms | Return a list of the parameters on this node. |
| parmsInFolder | Return a list of parameters in a folder on this node. Returns all parameters in the folder and its subfolders (if any). |
| path | Return the full path (i.e. starting with /) of this node in the network. |
| position | Return the position of this node’s tile in the network editor graph as a Vector2. See also move() and setPosition(). |
| recursiveGlob | Like hou.Node.glob, return a tuple of children nodes whose name matches the pattern. However, any matching child will have all its chidren added, recursively. As well, the result may be filtered by node type. |
| relativePathTo | Return a relative path to another node object from this node. |
| removeAllEventCallbacks | Remove all event callbacks for all event types from this node. |
| removeEventCallback | Given a callback that was previously added on this node and a sequence of hou.nodeEventType enumerated values, remove those event types from the set of event types for the callback. If the remaining set of event types is empty, the callback will be removed entirely from this node. |
| removeSpareParmFolder | Removes an empty folder from the spare parameters. |
| removeSpareParmTuple | Removes the specified spare parameter tuple. |
| replaceSpareParmTuple | Replace an existing spare parameter tuple with a new one. The old parameter tuple is removed and the new one is added in its place. |
| runInitScripts | Runs the initialization script associated with this node’s type. |
| saveChildrenToFile | Given sequences of children nodes and network boxes, save a file containing those items. You can load this file using hou.Node.loadChildrenFromFile. |
| saveCompiledCookCodeToFile | Saves compiled VEX code to a disk file (for nodes that support this). See hou.Node.saveCookCodeToFile for a description of the arguments. |
| saveCookCodeToFile | Saves VEX/RSL source code to a disk file (on nodes that support this). |
| selectedChildren | Return a tuple containing the children of this node that are selected. Note that the last selected node has special meaning, and can also be retrieved with hou.Node.isCurrent. |
| sessionId | |
| setBuiltExplicitly | Set whether this node was built explicitly (default value is True). If set to False, this node will not show up in various menus and in the Network View pane’s list mode. This flag is typically used for intermediate utility nodes that one is unlikely to want to change its parameters. |
| setColor | Sets the color of this node’s tile in the network editor to the given hou.Color. |
| setComment | Sets the comment associated with this node. See also appendComment(). |
| setCreatorState | This sets the name of the tool that created this node. If you call this with a name that differs from the node type name, you should also call setBuiltExplicitly(False). |
| setCurrent | Set or unset this node as the last selected one. |
| setDeleteScript | Sets the script that will run when this node is deleted. |
| setExpressionLanguage | Set the node’s default expression language. See expressionLanguage() for more information. |
| setFirstInput | A shortcut for self.setInput(node_to_become_input, 0). See hou.Node.setInput for more information. |
| setInput | If node_to_become_input is not None, connect the output connector of another node to an input connector of this node. Otherwise, disconnect anything connected to the input connector. |
| setName | Set the name of this node. Raises hou.OperationFailed 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 (e.g. /obj), 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 | Connect the output connector from another node into the first unconnected input connector of this node. |
| setParmExpressions | Given a dictionary mapping parm names to expression strings, set each of the corresponding parms on this node to the given expression string in the dictionary. |
| setParmTemplateGroup | Change the spare parameters for this node. |
| setParms | Given a dictionary mapping parm names to values, set each of the corresponding parms on this node to the given value in the dictionary. |
| setPosition | 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 | Select or deselect this node, optionally deselecting all other selected nodes in this network. If show_asset_if_selected is True, then the panes will show the top-level asset of the selected node instead. |
| setUserData | Add/set a named string on this node instance. |
| shiftPosition | Moves the position of this node’s tile in the network editor graph. Raises hou.InvalidInput if the node cannot have the given position. |
| simulation | Return the simulation defined by this DOP network node. This raises an exception if this is not a dop network. |
| size | Return the size of this node’s tile in the network editor graph as a Vector2. |
| spareParms | Return a list of the spare (user-defined) parameters on this node. |
| stampValue | Return a copy stamping floating point or string value. This node must be a downstream stamping operator, such as a Copy SOP, Cache SOP, LSystem SOP, or Copy CHOP. |
| stickyNotes | Return a list of the sticky notes inside this node. |
| type | Return the hou.NodeType object for this node. |
| userData | Return the user-defined data with this name, or None if no data with this name exists. |
| userDataDict | Return a dictionary containing all the user-defined name/string pairs for this node. |
| warnings | Return the text of any warnings from the last cook of this node, or the empty string ("") if there were no warnings. |
name(self)→strReturn this node’s name. See also hou.Node.path.
setName(self, name, unique_name=False)Set the name of this node. Raises hou.OperationFailed 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 (e.g. /obj), 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.
digitsInName(self)→intReturn 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
102for a node namedgeo102, and34for a node namedlight12to34.path(self)→strReturn the full path (i.e. starting with
/) of this node in the network.relativePathTo(self, base_node)→strReturn a relative path to another node object from this node.
>>> box1 = hou.node("/obj/box_object1/box1") >>> sphere1 = hou.node("/obj/sphere_object1/sphere1") >>> box1.relativePathTo(sphere1) '../../sphere_object1/sphere1' >>> hou.node("/obj").relativePathTo(box1) 'box_object1/box1' >>> box1.relativePathTo(box1) '.'
node(self, node_path)→ hou.Node orNoneReturn the node at the given path, or None if no such node exists. If you pass in a relative path (i.e. the path does not start with
/), searches are performed relative to this node.For example, to get the parent node of a node in the the variable
n, usen.node(".."). To get a child node namedgeo5, usen.node("geo5"). To get a sibling node namedlight3, usen.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.ObjNode instance.
If the path is an absolute path (i.e. it starts with
/), this method is a shortcut forhou.node(node_path). Otherwise, it is a shortcut forhou.node(self.path() + "/" + node_path). See also hou.node_.parent(self)→ hou.NodeReturn the node that contains this node.
This method is a shortcut for
self.node(".."). Note that this method returns None if the node is the root (i.e./).>>> hou.node("/obj/box_object1").parent() <hou.Node at /obj> >>> print hou.node("/").parent() None
children(self)→tupleof hou.NodeReturn a list of nodes that are children of this node. Using the file system analogy, a node’s children are like the contents of a folder/directory.
To find the number of children nodes, use
len(node.children()).The order of the children in the result is the same as the user defined ordering in Houdini. To see this order, switch the network view pane into list mode, and ensure that the list order is set to user defined. To reorder nodes, drag and drop them in the list.
def pc(node): '''Print the names of the children of a particular node. This function can be handy when working interactively in the Python shell.''' for child in node.children(): print child.name() def ls(): '''Print the names of the nodes under the current node.''' pc(hou.pwd())
The following expression evaluates to a list of children of a particular node type:
[c for c in node.children() if c.type() == node_type]
allSubChildren(self, top_down=True)→ tuple of hou.NodeRecursively return all sub children of this node. For example,
hou.node("/").allSubChildren()will return all the nodes in the hip file.top_down If True, this function will do a top-down traversal, placing a node in the returned tuple before its children. If False, it will do a bottom-up traversal, placing children before their parents.
Note that a tuple is returned, not a generator. This means that it is safe to delete or create nodes while looping through the return value.
The following function deletes all children of a particular type that appear anywhere inside a given node:
def removeSubChildrenOfType(node, node_type): '''Recursively delete all children of a particular type.''' for child in allSubChildren(node): if child.type() == node_type: child.destroy()
This code, for example, removes all the visibility SOPs anywhere under /obj:
>>> removeSubChildrenOfType(hou.node("/obj"), hou.sopNodeTypeCategory().nodeTypes()['visibility'])
reorderChildrenAfter(self, children_nodes, after_node=None)This feature is not yet implemented
reorderChildrenBefore(self, children_nodes, before_node=None)This feature is not yet implemented
reorderChildrenToBeginning(self, children_nodes)This feature is not yet implemented
reorderChildrenToEnd(self, children_nodes)This feature is not yet implemented
glob(self, pattern)→ tuple of hou.NodeReturn a tuple of children nodes name matches the pattern.
The pattern may contain multiple pieces, separated by spaces. An asterisk (
*) in a pattern piece will match any character. By default, Houdini will add the nodes from each pattern piece to those already matched. However, if the pattern piece begins with a caret (^), Houdini will remove the matches for that piece from the result.This method returns an empty tuple if you pass in an empty pattern.
>>> obj = hou.node("/obj") >>> obj.createNode("geo", "geo1") <hou.ObjNode of type geo at /obj/geo1> >>> obj.createNode("geo", "geo2") <hou.ObjNode of type geo at /obj/geo2> >>> obj.createNode("geo", "grid") <hou.ObjNode of type geo at /obj/grid> >>> obj.createNode("geo", "garbage") <hou.ObjNode of type geo at /obj/garbage> >>> obj.createNode("geo", "box") <hou.ObjNode of type geo at /obj/box> >>> def names(nodes): ... return [node.name() for node in nodes] >>> names(obj.glob("g*")) ['geo1', 'geo2', 'grid', 'garbage'] >>> names(obj.glob("ge* ga*")) ['geo1', 'geo2', 'garbage'] >>> names(obj.glob("g* ^ga*")) ['geo1', 'geo2', 'grid']
See also hou.Node.recursiveGlob.
recursiveGlob(self, pattern, filter=hou.nodeTypeFilter.NoFilter)→ tuple of hou.NodeLike hou.Node.glob, return a tuple of children nodes whose name matches the pattern. However, any matching child will have all its chidren added, recursively. As well, the result may be filtered by node type.
Houdini first matches children nodes against the pattern, then recursively adds the subchildren of matching children, and then applies the filter.
patternChild node names will be matched against this string pattern. See hou.Node.glob and hou.NodeBundle for information about the pattern syntax. Note that if a child node matches the pattern, all of its subchildren will be added to the result (subject to filtering), regardless of the pattern.
filterA hou.nodeTypeFilter enumeration value to limit matched nodes to a particular type (e.g. object nodes, geometry object nodes, surface shader SHOPs, etc.).
The pattern and filter behaviour is very similar to that used by node bundles in Houdini. See hou.NodeBundle for more information.
Raises hou.OperationFailed if the pattern is invalid.
createNode(self, node_type_name, node_name=None, run_init_scripts=True, load_contents=True)→ hou.NodeCreate a new node of type
node_type_nameas a child of this node.node_nameThe name of the new node. If not specified, Houdini appends a number to the node type name, incrementing that number until a unique node name is found. If you specify a name and a node already exists with that name, Houdini will append a number to create a unique name.
run_init_scriptsIf True, the initialization script associated with the node type will be run on the new node.
load_contentsIf True, any subnet contents will be loaded for custom subnet operators.
Raises hou.OperationFailed if this node cannot contain children. Raises hou.PermissionError if this node is inside a locked asset.
>>> obj = hou.node("/obj") # Let Houdini choose a name based on the node type name. >>> obj.createNode("geo") <hou.ObjNode of type geo at /obj/geo1> # Let Houdini choose a unique name. >>> obj.createNode("geo") <hou.ObjNode of type geo at /obj/geo2> # Give the node a specific name. >>> obj.createNode("geo", "foo") <hou.ObjNode of type geo at /obj/foo> # Let Houdini create a unique name from our suggested name. Also, don't # run the geometry object init scripts so the contents are empty. >>> obj.createNode("geo", "geo1", run_init_scripts=False) <hou.ObjNode of type geo at /obj/geo3> >>> obj.node("geo1").children() (<hou.SopNode of type file at /obj/geo1/file1>,) >>> obj.node("geo3").children() ()
destroy(self)Delete this node.
If you call methods on a Node instance after it has been destroyed, Houdini will raise hou.ObjectWasDeleted.
Raises hou.OperationFailed if you try to delete a node inside a locked asset.
isCurrent(self)→boolReturn a boolean to indicate of the node is the last selected node in its network.
Each network (i.e. node containing children) stores its own list of selected nodes, and the last selected node has special meaning. For example, it is the node displayed in unpinned parameter panes.
See also hou.selectedNodes to get a tuple of all the selected nodes in all networks in Houdini. The last node in this list also has special meaning in Houdini, and corresponds to the global current node.
setCurrent(self, on, clear_all_selected=False)Set or unset this node as the last selected one.
Each network (i.e. node containing children) stores its own list of selected nodes, and the last selected node has special meaning. For example, it is the node displayed in unpinned parameter panes.
If
onis True, this node will become the last selected node. If it is False and this node was the last selected one, it will be unselected and the second-last selected node will become the last selected node.If
clear_all_selectedis true, Houdini will unselect every node in this network before performing the operation.See also hou.Node.setSelected and hou.selectedNodes.
isSelected(self)→boolReturn whether this node is selected.
See also hou.selectedNodes.
setSelected(self, on, clear_all_selected=False, show_asset_if_selected=False)Select or deselect this node, optionally deselecting all other selected nodes in this network. If
show_asset_if_selectedis True, then the panes will show the top-level asset of the selected node instead.selectedChildren(self, include_hidden=False)→tupleof hou.NodeReturn a tuple containing the children of this node that are selected. Note that the last selected node has special meaning, and can also be retrieved with hou.Node.isCurrent.
include_hiddenIf False, hidden nodes are not included in the result, 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 selected children nodes, use
len(node.selectedChildren()).type(self)→ hou.NodeTypeReturn the hou.NodeType object for this node.
For example, all camera node instances share the same node type.
changeNodeType(self, new_node_type, keep_name=True, keep_parms=True, keep_network_contents=True)→ hou.NodeChanges the node to a new type (within the same contenxt).
new_node_typeis the internal string name of the type you want to change to.Keep_name,keep_parms, andkeep_network_contentsindicate that the node should keep the same name, parameter values, and contents, respectively, after its type has changed.childTypeCategory(self)→ hou.NodeTypeCategoryReturn the hou.NodeTypeCategory corresponding to the children of this node. For example, if this node is a geometry object, the children are SOPs. If it is an object subnet, the children are objects.
parm(self, parm_path)→ hou.Parm orNoneReturn the parameter at the given path, or
Noneif the parameter doesn’t exist.evalParm(self, parm_path)→int,float, orstrEvaluates the specified parameter and returns the result.
parms(self)→tupleof hou.ParmReturn a list of the parameters on this node.
findParms(self, pattern)→ tuple of ParmsThis feature is not yet implemented
setParms(self, parm_dict)Given a dictionary mapping parm names to values, set each of the corresponding parms on this node to the given value in the dictionary.
The following example sets the
txandsyparameters at once:>>> node = hou.node("/obj").createNode("geo") >>> node.setParms({"tx": 1, "sy": 3})
Raises hou.OperationFailed if any of the parameter names are not valid.
See also the setParmExpressions method.
setParmExpressions(self, parm_dict, language=None, replace_expressions=True)Given a dictionary mapping parm names to expression strings, set each of the corresponding parms on this node to the given expression string in the dictionary.
See hou.Parm.setExpression for a description of the
languageandreplace_expressionsparms.The following example expressions set the
txandsyparameters at once:>>> node = hou.node("/obj").createNode("geo") >>> node.setParmExpressions({"tx": 'ch("ty")', "sy": "sin($F)"})
Raises hou.OperationFailed if any of the parameter names are not valid.
See also the setParms method.
__getitem__(self, parm_name)This feature is not yet implemented
__setitem__(self, parm_name, value)This feature is not yet implemented
parmTuple(self, parm_path)→ hou.ParmTuple orNoneReturn the parm tuple at the given path, or
Noneif it doesn’t exist.This method is similar to
parm(), except it returns a hou.ParmTuple instead of a hou.Parm.evalParmTuple(self, parm_path)→tupleofint,float, orstrEvaluates the specified parameter tuple and returns the result.
parmTuples(self)→tupleof hou.ParmTupleReturn 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.parmsInFolder(self, folder_names, folder_style)→tupleof hou.ParmReturn 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_namesdoes not exist.See also hou.Parm.containingFolders and hou.Parm.containingFolderSetParmTuples
parmTuplesInFolder(self, folder_names)→ tuple of hou.ParmTupleReturn 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. SeeparmsInFolder()above for information about the arguments.See also hou.Parm.containingFolders and hou.Parm.containingFolderSetParmTuples
parmToNodeReferences(self, max_hierarchy_depth=None)→dictof hou.Parm to hou.NodeThis feature is not yet implemented
expressionLanguage(self)→ hou.exprLanguage enum valueReturn 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).setExpressionLanguage(self, language)Set the node’s default expression language. See
expressionLanguage()for more information.parmAliases(self, recurse=False)→ dict of hou.Parm tostrReturn 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.
clearParmAliases(self)Removes all alias names from parameters on the node.
spareParms(self)→ tuple of hou.ParmReturn a list of the spare (user-defined) parameters on this node.
parmTemplateGroup(self)→ hou.ParmTemplateGroupReturn the group of parm templates corresponding to the current parameter layout for this node.
You can edit the parameter layout for this node (add or remove spare parameters, reorder or hide built-in parameters, etc.) by getting the current parameter group, modifying it, and calling hou.Node.setParmTemplateGroup with it.
The following example creates a geometry object, adds a
My Parmsfolder to it, and adds aMy Parmfloat parameter to it in that folder. The parameters are added only to the geometry object created; other geometry objects are unaffected.>>> node = hou.node("/obj").createNode("geo") >>> group = node.parmTemplateGroup() >>> folder = hou.FolderParmTemplate("folder", "My Parms") >>> folder.addParmTemplate(hou.FloatParmTemplate("myparm", "My Parm", 1)) >>> group.append(folder) >>> node.setParmTemplateGroup(group)
See hou.ParmTemplateGroup and the setParmTemplateGroup method for more information and examples.
setParmTemplateGroup(self, parm_template_group, rename_conflicting_parms=False)Change the spare parameters for this node.
parm_template_groupA hou.ParmTemplateGroup object containing the new parameter layout.
rename_conflicting_parmsIf
True, parameters in the group with the same parm tuple names will be automatically renamed. IfFalseand there are parms with the same name, this method raises hou.OperationFailed.Note that each node type has a set of parameters which must exist and must be of certain types. If your parm template group does not contain the required parameters for the node type the will be added at the bottom and will be made invisible. Similarly, if your parm template group attempts to modify the type, range, label, or other property of a required parameter, all changes to that parameter other than visibility settings will be ignored.
This method is preferred over the other parameter-related methods in this class (addSpareParmTuple, removeSpareParmTuple, replaceSpareParmTuple, addSpareParmFolder, removeSpareParmFolder) because it lets you more easily make manipulate parameters.
See hou.HDADefinition.setParmTemplateGroup to change the parameter interface of a digital asset.
addSpareParmTuple(self, parm_template, in_folder=(), create_missing_folders=False)→ hou.ParmTupleAdd a spare parameter tuple to the end of the parameters on the node. If
in_folderis not an empty sequence, this method adds the parameters to the end of the parameters in a particular folder.parm_template A hou.ParmTemplate subclass instance that specifies the type of parameter tuple, the default value, range, etc.
in_folder A sequence of folder names specifying which folder will hold the parameter. If this parameter is an empty sequence (e.g.
()), Houdini will not put the parameter inside a folder. If it is, for example,("Misc", "Controls"), Houdini puts it inside the “Controls” folder that’s inside the “Misc” folder. If it is, for example,("Misc",), Houdini puts it inside the “Misc” folder.create_missing_folders If True, and the folder location specified by
in_folderdoes not exist, this method creates the missing containing folders.Note that this method can add a single folder by passing a hou.FolderParmTemplate for
parm_template.See also the
removeSpareParmTuple()andaddSpareParmFolder()methods.This method is deprecated in favor of
setParmTemplateGroup.removeSpareParmTuple(self, parm_tuple)Removes the specified spare parameter tuple.
See also
addSpareParmTuple().This method is deprecated in favor of
setParmTemplateGroup.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_foldersis 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.Note that you can add folders by passing a hou.FolderParmTemplate to the
addSpareParmTuplemethod, so this method is deprecated. Note also thataddSpareParmTupleis deprecated in favor ofsetParmTemplateGroup.See also the
removeSpareParmFolderandaddSpareParmTuplemethods.This method is deprecated in favor of
setParmTemplateGroup.removeSpareParmFolder(self, folder)Removes an empty folder from the spare parameters.
folderis a sequence of folder names. So, to remove the Output folder, use("Output",)instead of"Output".See also
addSpareParmFolder(), hou.ParmTemplateGroup.remove, and hou.ParmTemplateGroup.findFolder.replaceSpareParmTuple(self, parm_tuple_name, parm_template)Replace an existing spare parameter tuple with a new one. The old parameter tuple is removed and the new one is added in its place.
parm_tuple_name The name of the spare parameter tuple to replace. Raises hou.OperationFailed if no parameter tuple exists with this name, or if it is the name of a non-spare parameter.
parm_template A hou.ParmTemplate describing the new parameter tuple.
The new parameter tuple may or may not have the same name as the old one. By providing a parameter tuple with the same name, you can modify an existing spare parameter tuple.
Note that you cannot replace non-spare parameter tuples. However, you can change the visibility of non-spare parameters using hou.ParmTuple.hide.
To change a parameter for all instances of digital asset, use hou.HDADefinition.replaceParmTuple.
This method is deprecated in favor of
setParmTemplateGroup.inputs(self)→tupleof hou.NodeReturn a tuple of the nodes connected to this node’s inputs.
This method is a shortcut for
[connection.outputNode() for connection in self.inputConnections()].outputs(self)→tupleof hou.NodeReturn a tuple of the nodes connected to this node’s outputs.
This method is a shortcut for
[connection.inputNode() for connection in self.outputConnections()].inputConnections(self)→tupleof hou.NodeConnectionReturn a tuple of NodeConnection objects for the connections coming into the top of this node. If nothing is wired into this node, return an empty tuple.
To get a list of the connected nodes themselves, use hou.Node.inputs.
Note that this method is a shortcut for
[connectors[0] for connectors in self.inputConnectors() if len(connectors) != 0].>>> cookie = hou.node("/obj").createNode("geo").createNode("cookie") >>> cookie.setInput(1, cookie.parent().createNode("box")) >>> cookie.inputConnections() (<hou.NodeConnection from grid1 output 0 to cookie input 1>,) >>> cookie.inputConnectors() ((), (<hou.NodeConnection from grid1 output 0 to cookie input 1>,))
See also hou.Node.inputConnectors.
outputConnections(self)→tupleof hou.NodeConnectionReturn a tuple of NodeConnection objects for the connections going out of the bottom of this node. If nothing is wired into the output of this node, return an empty tuple.
To get a list of the connected nodes themselves, use hou.Node.outputs.
Note that this method is a shortcut for:
reduce(lambda a, b: a+b, self.outputConnectors(), ()). Since most nodes have only one output connector, though, this method is usually equivalent toself.outputConnectors()[0].>>> box = hou.node("/obj").createNode("geo").createNode("box") >>> box.parent().createNode("xform").setFirstInput(box) >>> box.parent().createNode("subdivide").setFirstInput(box) >>> box.outputConnections() (<hou.NodeConnection from box1 output 0 to xform1 output 0>, <hou.NodeConnection from box1 output 0 to subdivide1 input 0>)
See also hou.node.outputConnectors.
inputConnectors(self, include_indirect_inputs=False)→tupleoftupleof hou.NodeConnectionReturn a tuple of tuples of hou.NodeConnection objects. The length of the result tuple is equal to the number of input connectors on this node. Each subtuple contains exactly one node connection if something is wired into the connector; otherwise it is the empty tuple.
By default, connections for subnet indirect inputs are not returned. To obtain a list of the connections with subnet indirect inputs, call with
inputConnectors(True). See hou.SubnetIndirectInput for information on subnet indirect inputs.See also hou.NodeConnector and hou.Node.inputConnections.
outputConnectors(self)→tupleoftupleof hou.NodeConnectionReturn a a tuple of tuples of hou.NodeConnection objects. The length of the result tuple is equal to the number of output connectors on this node. Each subtuple contains all the connections going out of that connector, and is empty if nothing is wired to that connector.
>>> split = hou.node("/obj").createNode("dopnet").createNode("split") >>> split.parent().createNode("rbdsolver").setFirstInput(split) >>> split.parent().createNode("gravity").setFirstInput(split, 1) >>> split.parent().createNode("merge").setFirstInput(split, 1) >>> split.outputConnectors() ((<hou.NodeConnection from split1 output 0 to rbdsolver1 input 0>,), (<hou.NodeConnection from split1 output 1 to gravity2 input 0>, <hou.NodeConnection from split1 output 1 to merge1 input 0>), (), ())
See also hou.NodeConnection and hou.Node.outputConnections.
indirectInputs(self)→tupleof hou.SubnetIndirectInputReturn the hou.SubnetIndirectInput objects of a subnet.
Raises hou.InvalidNodeType if this node is not a subnetwork.
inputAncestors(self)→tupleof hou.NodeReturn 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.extraInputs(self)→tupleof hou.NodeThis feature is not yet implemented
extraOutputs(self)→tupleof hou.NodeThis feature is not yet implemented
Return this node’s extra output nodes.
When a parameter in node A has a channel reference to a parameter in node B, node A becomes an extra output of node B. Note, though, that node B is not an extra input of node A.
>>> a = hou.node("/obj").createNode("geo") >>> b = hou.node("/obj").createNode("geo") >>> a.parm("tx").set(b.parm("tx")) >>> b.extraOutputs() (<hou.ObjNode of type geo at /obj/geo2>,)
setInput(self, input_index, node_to_become_input, output_index=0)If
node_to_become_inputis not None, connect the output connector of another node to an input connector of this node. Otherwise, disconnect anything connected to the input connector.input_index The index of this node’s input connector.
node_to_become_input If
Nonethis method disconnects everything from the input connector. If a hou.Node or a hou.SubnetIndirectInput, this method connects its output to this node’s input connector.output_index The index of the other node’s output connector.
Raises hou.InvalidInput if
output_indexis invalid. Raises hou.OperationFailed ifnode_to_become_inputis not in the same network as this node. Raises hou.PermissionError if the node is inside a locked asset.setFirstInput(self, node_to_become_input, output_index=0)A shortcut for
self.setInput(node_to_become_input, 0). See hou.Node.setInput for more information.setNextInput(self, node_to_become_input, output_index=0)Connect the output connector from another node into the first unconnected input connector of this node.
This method is roughly equivalent to:
for input_index, conectors in enumerate(self.inputConnectors()): if len(connectors) == 0: self.setInput(input_index, node_to_become_input, output_index) raise hou.InvalidInput("All inputs are connected")
Raises hou.InvalidInput if all inputs are connected. See hou.Node.setInput for more information.
insertInput(self, input_index, node_to_become_input, output_index=0)Insert an input wire. In other words, for each input connector after input_index, shift the contents of that input connector to the next one, and then call hou.Node.setInput. See hou.Node.setInput for the meanings of the parameters.
createInputNode(self, input_index, node_type_name, node_name=None, run_init_scripts=True, load_contents=True)Create a new node and connect it to one of this node’s inputs. Return the new node.
input_index The index of this node’s input connector.
node_type_name The name of the type of node to create. See the createNode method for more information.
node_name See the createNode method for more information.
run_init_scripts See the createNode method for more information.
load_contents See the createNode method for more information.
See also the createOutputNode method.
createOutputNode(self, node_type_name, node_name=None, run_init_scripts=True, load_contents=True)Create a new node and connect its first input to this node’s (first) output. Return the new node.
See the createNode method for more information on the parameters.
See also the createInputNode method.
collapseIntoSubnet(self, child_nodes, subnet_name=None)→ hou.NodeGiven a sequence of children nodes of this node, collapse them into a subnetwork. In other words, create a subnet inside this node’s network and move the specified children of this network inside that subnet.
child_nodes The children nodes of this node that will go in the new subnet.
subnet_name The name for the new subnet node, or None if you want Houdini to automatically choose a name.
Raises hou.OperationFailed if a node inside
child_nodesis not a child of this network, or ifchild_nodesis an empty sequence.This example function takes a single node and replaces it with a subnet, moving the node into the subnet..
def collapseSingleNodeIntoSubnet(node, subnet_name=None): node.parent().collapseIntoSubnet((node,), subnet_name=None)
extractAndDelete(self)Move the children of this subnet node to become siblings of this node, and then delete this node. The method is the opposite of
collapseIntoSubnet().Raises hou.InvalidNodeType if this node is not a subnetwork.
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)→NodeCreate a digital asset from this node. You would typically call this method on subnet nodes.
name The name of the node type that the new digital asset will define.
hda_file_name The name of the otl file where Houdini will save the digital asset. If
NoneHoudini will use$HOME/houdiniX.Y/otls/OPcustom.otl.description The name that will appear in the tab menu. If None, Houdini will use the name for the description.
min_num_inputs The minimum number of inputs that need to be wired into instances of the digital asset. See hou.HDADefinition.minNumInputs for more information.
max_num_inputs The number of input connectors available on instances of the digital asset for input connections. See hou.HDADefinition.minNumInputs for more information.
compress_contents Whether or not the contents of this digital asset are compressed inside the otl file. See hou.HDAOptions.compressContents for more information.
comment A user-defined comment string. See hou.HDADefinition.comment for more information.
version A user-defined version string. See hou.HDADefinition.version for more information.
save_as_embedded Whether or not the digital asset’s definition will be saved with the hip file instead of an otl file. When this parameter is True, Houdini ignores the
hda_file_nameparameter. Setting this parameter to True is equivalent to setting this parameter to False and setting thehda_file_nameparameter to “Embedded”.ignore_external_references If True, Houdini will not generate warnings if the contents of this digital asset reference nodes outside the asset.
createCompiledDigitalAsset(self, name=None, hda_file_name=None, description=None)Create a compiled digital asset from this node. You would typically call this method on vop network nodes, such as Material Shader Builder SHOP, Surface Shader Builder SHOP, or VEX Surface SHOP Type VOPNET. This method uses the vop network to generate VFL code and to compile it to VEX, which is then stored in the digital asset section or sections. The digital asset does not have contents section, which means it does not have vop network inside, but instead relies on the saved VEX sections to provide the shader code.
name The name of the node type that the new digital asset will define.
hda_file_name The name of the otl file where Houdini will save the digital asset. If
NoneHoudini will use$HOME/houdiniX.Y/otls/OPcustom.otl.description The name that will appear in the tab menu. If None, Houdini will use the name for the description.
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.
matchCurrentDefinition(self)If this node is an unlocked digital asset, change its contents to match what is stored in the definition and lock it. The parameter values are unchanged.
If this node is locked or is not a digital asset, this method has no effect.
See also hou.Node.matchesCurrentDefinition and hou.Node.isLocked.
matchesCurrentDefinition(self)→boolReturn whether the contents of the node match its type definition. A locked digital asset instance will always match its definition, but an unlocked one may not.
isLocked(self)→boolIf this node is an instance of a digital asset, return whether or not it is locked. Otherwise, return False.
To differentiate between unlocked digital assets and nodes that are not instances of digital assets, check if the node’s type has a definition:
def isUnlockedAsset(node): return not node.isLocked() and node.type().definition() is not None
See hou.HDADefinition.updateFromNode for an example of how to save and lock all unlocked digital asset instances.
isInsideLockedHDA(self)→boolReturn 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.
hdaModule(self)→ hou.HDAModuleThis method is a shortcut for `self.type().hdaModule() to reduce the length of expressions in Python parameters and button callbacks. See hou.NodeType.hdaModule for more information.
See also the
hmmethod and hou.phm.hm(self)→ hou.HDAModuleThis method is a shortcut for
self.hdaModule().See also hou.phm.
comment(self)→strReturn the node’s comment string.
setComment(self, comment)Sets the comment associated with this node. See also
appendComment().appendComment(self, comment)Appends the given text to the comment associated with this node.
color(self)→ hou.ColorReturn the color of this node’s tile in the network editor.
setColor(self, color)Sets the color of this node’s tile in the network editor to the given hou.Color.
position(self)→ hou.Vector2Return the position of this node’s tile in the network editor graph as a
Vector2. See alsomove()andsetPosition().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.
shiftPosition(self, delta)Moves the position of this node’s tile in the network editor graph. Raises hou.InvalidInput if the node cannot have the given position.
delta A tuple of two floats indicating how much the node should move. The first float indicates horizontal movement and the second indicates vertical movement.
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.Vector2Moves a node to a well-spaced position near its inputs or outputs and returns the new position of the node.
layoutChildren(self, child_nodes=(), horizontal_spacing=-1.0, vertical_spacing=-1.0)Automatically position all or some children of this node in the network editor.
child_nodes A sequence of child nodes to position. If this sequence is empty, this method will reposition all children of this node.
horizontal_spacing A fraction of the width and height of a tile that affects the space between nodes with common inputs. If this parameter is -1, Houdini uses the default spacing.
vertical_spacing A fraction of the width and height of a tile that affects the space between a node and its output nodes. If this parameter is -1, Houdini uses the default spacing.
size(self)→ hou.Vector2Return the size of this node’s tile in the network editor graph as a
Vector2.isHidden(self)Return whether the node is hidden in the network editor. Note that Houdini also uses the term “exposed” to refer to nodes that are not hidden.
If a visible node is connected to a hidden node, the network editor will display dashed lines for the wire going from the visible node to the hidden node.
See also hou.Node.hide.
hide(self, on)Hide or show a node in the network editor. See hou.Node.isHidden for more information about hidden nodes.
cook(self, force=False, frame_range=())Asks or forces the node 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 is1.errors(self)→strReturn the text of any errors from the last cook of this node, or the empty string (
"") if there were no errors.warnings(self)→strReturn the text of any warnings from the last cook of this node, or the empty string (
"") if there were no warnings.messages(self)→strReturn the text of any messages from the last cook of this node, or the empty string (
"") if there were no messages.networkBoxes(self)→ tuple of hou.NetworkBoxReturn a list of the network boxes inside this node.
findNetworkBox(self, name)→ hou.NetworkBoxReturn a network box with the given name inside this node, or
Noneif no network box with the given name exists.findNetworkBoxes(self, pattern)→tupleof hou.NetworkBoxReturn a list of network boxes inside this node whose names match a pattern.
createNetworkBox(self, name=None)→ hou.NetworkBoxCreates 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.copyNetworkBox(self, network_box_to_copy, new_name=None, channel_reference_original=False)→ hou.NetworkBoxCopies a network box and returns the copy.
If
new_nameis given, the network box will be copied to a new network box named new_name (a different name will be generated if there is already a network box with that name).If
channel_reference_originalisTrue, 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.
stickyNotes(self)→ tuple of hou.StickyNoteReturn a list of the sticky notes inside this node.
findStickyNote(self, name)→ hou.StickyNoteReturn a sticky note with the given name inside this node, or
Noneif no sticky note with the given name exists.findStickyNotes(self, pattern)→tupleof hou.StickyNoteReturn a list of sticky notes inside this node whose names match a pattern.
createStickyNote(self, name=None)→ hou.StickyNoteCreates a sticky note inside this network. Raises hou.OperationFailed if this node is not a network.
If you don’t specify a
name, Houdini gives the note a default name.copyStickyNote(self, network_box_to_copy, new_name=None)→ hou.StickyNoteCopies a sticky note and returns the copy.
If
new_nameis given, the sticky note will be copied to a new sticky note named new_name (a different name will be generated if there is already a sticky note with that name).Raises hou.OperationFailed if this node is not a network or if the node child type does not match the sticky note’s node type.
addNodeGroup(self, name=None)→ hou.NodeGroupAdd a node group to the node and return 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 None or 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 hou.OperationFailed.
To remove a node group, use hou.NodeGroup.destroy.
nodeGroup(self, name)→ hou.NodeGroupReturn a node group contained by the node with the given name, or
Noneif the group does not exist.nodeGroups(self)→ tuple of hou.NodeGroupReturn the list of node groups in this node.
runInitScripts(self)Runs the initialization script associated with this node’s type.
deleteScript(self)→strReturn the script that will run when this node is deleted.
setDeleteScript(self, script_text, language=hou.scriptLanguage.Python)Sets the script that will run when this node is deleted.
fileReferencePatterns(self, recurse=False, ignore_unused_subnet_branches=False)→ tuple of Parm and file_name tuplesThis feature is not yet implemented
fileReferences(self, recurse=False, ignore_unused_subnet_branches=False)→ tuple of Parm and file_name tuplesThis feature is not yet implemented
referencedNodes(self, max_hierarchy_depth=None)→ tuple of NodesThis feature is not yet implemented
info(self, verbose=False)→strThis feature is not yet implemented
loadPresets(self, presets)This feature is not yet implemented
saveToGallery(self, presets_name, dir_name=None)→ hou.GalleryEntryThis feature is not yet implemented
saveOldStylePresetsFile(self, presets_file_name)This feature is not yet implemented
loadOldStylePresetsFile(self, presets_file_name)This feature is not yet implemented
saveCompiledCookCodeToFile(self, file_name, context_name=None)Saves compiled VEX code to a disk file (for nodes that support this). See hou.Node.saveCookCodeToFile for a description of the arguments.
saveCookCodeToFile(self, file_name, skip_header=False, context_name=None)Saves VEX/RSL source code to a disk file (on nodes that support this).
file_nameThe file path in which to save the generated code.
skip_headerIf
True, the method does not write a header comment at the beginning of the file containing the file name and node path from which the code was generated and a time stamp.context_nameA string containing name of the shader context for the code. This option applies to nodes such as the Material Shader Builder which can generate code for multiple context types.
For example, a Material network might contain both surface and displacement shaders, so you must specify which type of shader code to generate:
node("/shop/vopmaterial1").saveCookCodeToFile("myfile.vfl", context_name="surface")
On single-context nodes this argument is ignored.
For VEX materials, possible values are
surface,displacement,light,shadow,fog,image3d,photon, orcvex.For RSL materials, possible values are
surface,displacement,light,volume, orimager.sessionId(self)This feature is not yet documented
Replaces opid
creationTime(self)→ datetime.datetimeThis feature is not yet implemented
modificationTime(self)→ datetime.datetimeThis feature is not yet implemented
creator(self)→ NodeThis feature is not yet documented
Replaces opstat
creatorState(self)→strThis returns the name of the viewport tool that was used to be created. This name is not set by default and is usually the empty string.
setCreatorState(self, state)This sets the name of the tool that created this node. If you call this with a name that differs from the node type name, you should also call
setBuiltExplicitly(False).isBuiltExplicitly(self)→boolReturn whether this node was built explicitly (defaults to True). Most nodes are built explicitly, but some are implicitly created by Houdini. For example, if you select geometry from multiple SOPs and then perform an operation, Houdini will put down an implicit merge SOP before performing that operation. When reselecting geometry in SOPs, Houdini will automatically delete any SOPs that were created implicitly.
setBuiltExplicitly(self, built_explicitly)Set whether this node was built explicitly (default value is True). If set to False, this node will not show up in various menus and in the Network View pane’s list mode. This flag is typically used for intermediate utility nodes that one is unlikely to want to change its parameters.
isTimeDependent(self)→boolReturn whether the node is time dependent. A time dependent node is re-evaluated every time the frame changes.
motionEffectsNetworkPath(self)→strReturn a node path representing the location for storing clips. This location may or may not exist. To find or create such a network, use hou.Node.findOrCreateMotionEffectsNetwork.
findOrCreateMotionEffectsNetwork(self, create=True)→ hou.ChopNetNodeReturn a CHOP network node suitable for storing Motion Effects. By default, if the node doesn’t exist, it will be created.
See also hou.Parm.storeAsClip and hou.Node.motionEffectsNetworkPath.
stampValue(self, parm_name, default_value)Return a copy stamping floating point or string value. This node must be a downstream stamping operator, such as a Copy SOP, Cache SOP, LSystem SOP, or Copy CHOP.
parm_nameThe name of the stamping variable.
default_valueThe value that this function returns if Houdini is not currently performing stamping, or if
parm_nameis not a valid variable name. This value may be a float or a string.You might put the following expression in a Python parameter:
node("../copy1").stampValue("sides", 5)
saveChildrenToFile(self, nodes, network_boxes, file_name)Given sequences of children nodes and network boxes, save a file containing those items. You can load this file using hou.Node.loadChildrenFromFile.
nodes A sequence of hou.Nodes that are children of this node.
network_boxes A sequence of hou.NetworkBoxes that are contained in this node. Note that the contents of the network boxes are not automatically saved, so it is up to you to put them in the list of nodes.
file_name The name of the file to write the contents to. You can use any extension for this file name.
Raises hou.OperationFailed if any of the nodes or network boxes are node children of this node, or if the file could not be written to. Raises hou.PermissionError if you do not have permission to read the contents of this node.
loadChildrenFromFile(self, file_name)Load the contents of a file saved with hou.Node.saveChildrenToFile into the contents of this node.
Raises hou.OperationFailed if the file does not exist or it is not the correct type of file. Raises hou.PermissionError if this node is a locked instance of a digital asset. Raises hou.LoadWarning if the load succeeds but with warnings.
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)→strPrints 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)This feature is not yet implemented
permissions(self)→intThis feature is not yet implemented
setPermissions(self, permissions)This feature is not yet implemented
addPermissions(self, permissions)This feature is not yet implemented
removePermissions(self, permissions)This feature is not yet implemented
_getArgumentAutoComplete(self, method_name, arguments)→ tuple ofstrThis method is used internally by Houdini to perform autocompletion in the interactive Python shell.
__eq__(self, node)→boolImplements
==betweenNodeobjects.For example, hou.root() == hou.node(“/”) will return
True.There can be multiple Python
Nodeobjects for the same Houdini node. Two identical calls tohou.node()will return different PythonNodeobjects, with each representing the same Houdini node. Comparing these nodes using==(which calls__eq__) will returnTrue, while comparing them usingis(the object identity test) will returnFalse.__ne__(self, node)→boolImplements
!=betweenNodeobjects. See__eq__().addEventCallback(self, event_types, callback)Register a Python callback that Houdini will call whenever a particular action, or event, occurs on this node.
event_typesA sequence of hou.nodeEventType enumeration values describing the event types that will cause the callback to be invoked. See below for the meanings of the different event types.
callbackA callable Python object, such as a function or bound method, that Houdini will invoke whenever one of the desired event types occurs on this node.
The callback will be invoked with different keyword arguments depending on the event type, so the callback should always use a **kwargs parameter (see the example below). Keyword arguments named
event_typeandnodeare always passed to the callback, and contain the hou.nodeEventType enumerated value corresponding to the event type and the hou.Node object, respectively.The following table describes the meaning of the hou.nodeEventType enumeration values:
BeingDeletedThis node is about to be deleted. The deletion cannot be cancelled.
NameChangedThis node was renamed. You can get the new name with
kwargs["node"].name()FlagChangedOne of the node’s flags, such as the display flag, was changed.
AppearanceChangedThe appearance of this node changed in some way. For example, any of the following can generate an appearance change event: the node’s color changed, an error flag changed, the node was selected, the node was locked, the node was deleted, etc.
PositionChangedThe node’s position in the network editor pane changed. You can find the new position with
kwargs["node"].position().InputRewiredOne of the node’s inputs was wired in or unwired. You can find the input connector index with
kwargs["input_index"].ParmTupleChangedA parameter in the node changed.
kwargs["parm_tuple"]contains the hou.ParmTuple corresponding to the changed parameter.Note that there are cases where Houdini will send out notifications that all parms have changed. In these circumstances,
kwargs["parm_tuple"]will beNone.ChildSelectionChangedThe set of selected nodes for this network changed. You can get the selected nodes with
kwargs["node"].selectedChildren().ChildCreatedA node was created inside this network.
kwargs["child_node"]contains the hou.Node that was created.ChildDeletedA node inside this network is about to be deleted.
kwargs["child_node"]contains the hou.Node that will be deleted.ChildSwitchedThe current node, display node, or render node inside this network was changed.
kwargs["child_node"]contains the newly selected child hou.Node.Note
If the callback has already been added for this node, this method simply updates the set of event types for the callback. For example, suppose you had added a callback for NameChanged and FlagChanged events and you add the same callback for NameChanged and ParmTupleChanged events. If a NameChanged event occurs, Houdini will run the callback once, not twice. Internally, Houdini updates the set of event types for your callback to NameChanged, FlagChanged, and ParmTupleChanged events.
The following example shows how you can monitor all objects in Houdini for parameter changes:
event_types = ( hou.nodeEventType.ParmTupleChanged, hou.nodeEventType.ChildCreated) def setUpCallback(node): node.addEventCallback(event_types, onNodeChange) def onNodeChange(**kwargs): if kwargs["event_type"] == hou.nodeEventType.ParmTupleChanged: # If all parameters effectively changed, kwargs["parm_tuple"] will # be None. We're only interested when individual parameters # change. if kwargs["parm_tuple"] is not None: onParmTupleChange(kwargs["parm_tuple"]) elif kwargs["event_type"] == hou.nodeEventType.ChildCreated: setUpCallback(kwargs["child_node"]) def onParmTupleChange(parm_tuple): # Add your code here to respond to a parameter change. print "Parameter changed:", parm_tuple def allSubChildren(node): yield node for child_node in node.children(): for n in allSubChildren(child_node): yield n # Set up node callbacks for all existing nodes so we're notified when any # of their children get created. for node in allSubChildren(hou.node("/")): setUpCallback(node)
If many parameters are changing, you may want to defer processing the updates until they're all finished. The following code provides a new version of onParmTupleChange that queues parameter changes:
import hdefereval _changed_parm_tuples = [] def onParmTupleChange(parm_tuple): _changed_parm_tuples.append(parm_tuple) if len(_changed_parm_tuples) == 1: hdefereval.executeDeferred(onProcessParmTupleChanges) def onProcessParmTupleChanges(): # Add your code here to respond to deferred parameter changes. for parm_tuple in _changed_parm_tuples: print "Parameter changed:", parm_tuple _changed_parm_tuples[:] = []
See also hou.Node.removeEventCallback and hou.Node.removeAllEventCallbacks.
removeEventCallback(self, event_types, callback)Given a callback that was previously added on this node and a sequence of hou.nodeEventType enumerated values, remove those event types from the set of event types for the callback. If the remaining set of event types is empty, the callback will be removed entirely from this node.
Raises hou.OperationFailed if the callback had not been previously added.
See hou.Node.addEventCallback for more information.
removeAllEventCallbacks(self)Remove all event callbacks for all event types from this node.
See hou.Node.addEventCallback for more information.
setUserData(self, name, value)Add/set a named string on this node instance.
nameA unique name (key) for the user-defined data. By using different names, you can attach multiple pieces of user-defined data to a node.
valueThe string to store.
This name/value pair is stored with the hip file and is included in the output from opscript and hou.Node.asCode.
The following example illustrates how to set, access, and delete user-defined data:
>>> n = hou.node("/obj").createNode("geo") >>> n.setUserData("my data", "my data value") >>> n.userData("my data") 'my data value' >>> n.userDataDict() {'my data': 'my data value'} >>> n.destroyUserData("my data") >>> n.userDataDict() {} >>> print n.userData("my data") None
See per-node user-defined data for more information and examples.
userDataDict(self, name)→dictofstrtostrReturn a dictionary containing all the user-defined name/string pairs for this node.
See hou.Node.setUserData for more information.
userData(self, name)→strorNoneReturn the user-defined data with this name, or
Noneif no data with this name exists.See hou.Node.setUserData for more information.
This method can be implemented as follows:
def userData(self, name): return self.userDataDict().get(name)
destroyUserData(self, name)Remove the user-defined data with this name.
See hou.Node.setUserData for more information.
Raises hou.OperationFailed if no user data with this name exists.
simulation(self)→ hou.DopSimulationReturn the simulation defined by this DOP network node. This raises an exception if this is not a dop network.
findNodesThatProcessedObject(self, dop_object)→tupleof hou.DopNodeGiven a hou.DopObject, return a tuple of DOP nodes that processed that object. This raises an exception if this is not a dopnetwork.