Inheritence |
|
Methods
selectors(selector_indices=())
→ tuple
of hou.Selector
Return all the selectors for this node type. See hou.SopNodeType.addSelector() and hou.Selector for more information.
def sopSelectorTypes(): '''Return a list of all the SOP selector type names.''' selector_types = [] for node_type in hou.sopNodeTypeCategory().nodeTypes().values(): # Skip manager nodes, like shopnets, ropnets, etc. if not isinstance(node_type, hou.SopNodeType): continue for selector in node_type.selectors(): selector_type = selector.selectorType() if selector_type not in selector_types: selector_types.append(selector_type) selector_types.sort() return selector_types
def sopTypeNamesUsingSelector(selector_type): '''Given the name of a selector type, return a list of all the SOP node types using that selector.''' node_types = [] for node_type in hou.sopNodeTypeCategory().nodeTypes().values(): # Skip manager nodes, like shopnets, ropnets, etc. if not isinstance(node_type, hou.SopNodeType): continue for selector in node_type.selectors(): if selector.selectorType() == selector_type: node_types.append(node_type) result = [node_type.name() for node_type in node_types] result.sort() return result
addSelector(name, selector_type, prompt='Select components', primitive_types=(), group_parm_name=None, group_type_parm_name=None, input_index=0, input_required=True, allow_dragging=False, empty_string_selects_all=True)
→ hou.Selector
Add a selector to this SOP node type. When the user creates a new instance of this SOP in the viewer, Houdini will invoke all the selectors, wait for the user to select geometry, and then connect input SOPs and fill in group parameters to match what was selected.
name
A name to give this selector. The name must be unique within this node type.
selector_type
The name of the type of selector to use. Different selectors have different behaviors. For example "prims" will select only primitives and is used, for example, by the cookie SOP. "points" will select only points, and is used by SOPs like the point SOP. "everything" will select any geometry, and is used for SOPs like "xform" and "blast".
prompt
A string to display at the bottom of the viewer to instruct the user what to select.
primitive_types
A sequence of hou.primType enumeration values to specify what primitive types are allowed. This parameter has no effect if the selector does not select primitives. If this sequence is empty, all primitive types will be allowed.
group_parm_name
The name of the SOP node parameter containing the group field. The selector will set this parameter to the string representing the points, primitives, edges, etc. chosen by the user in the viewer. If None, the selector will look for a parameter named "group".
group_type_parm_name
The name of the SOP node parameter containing the menu of geometry types. If the selector can select multiple geometry types (e.g. points or primitives), it will set this parameter to match the type of geometry the user chose. The transform SOP, for example, has a Group Type parameter that tells it how to interpret the string in the Group parameter. If None, the selector will look for a parameter named "grouptype".
input_index
The index of the input connector on the SOP node where the selector should wire input SOPs. A cookie SOP, for example, has two input connectors. It has two selectors, one for each input connector.
input_required
Whether or not this input is required or optional. If the user does not select any geometry and the input is not required, the selector will not wire anything to its input connector.
allow_dragging
Whether the user is allowed to select the geometry and begin manipulating the handles with a single mouse drag. A transform SOP, for example, lets you select the geometry and drag it right away to transform it. Dragging the geometry forces the selector to finish immediately, the selector connects the input and sets the group parameter, and subsequent mouse movements are passed to the handle which translates the geometry by changing parameter values.
empty_string_selects_all
Whether or not to use an empty string in the group parameter if the
user selects all the geometry. If False, Houdini will place an
asterisk (*
) in the group parameter when the user selects all the
geometry. Most SOPs use an empty string.
You would typically call this method from the shelf tool script of a digital asset. For example, you might put the following in the Tools script section of a Python sop that transforms points (having a parameter named group):
hou.sopNodeTypeCategory().nodeTypes()['$HDA_NAME'].addSelector( "Points to Transform", "points", prompt="Select the points to transform and press Enter to complete", group_parm_name="group")
See also hou.Geometry.globPoints() and hou.Geometry.globPrims() for information on how to parse the strings the selector puts in the group field.
See also hou.Selector.
Methods from hou.NodeType
name()
→ str
Return the name of this node type. For example, for the geometry object type, the name is "geo". The name and the node type category together uniquely identify a node type.
nameComponents()
→ tuple
of str
Returns a tuple of node type name components that constitute the full node type name. The components in the tuple appear in the following order: scope network type, node type namespace, node type core name, and version.
# parse the full name into components >>> node_type = hou.nodeType(hou.dopNodeTypeCategory(), 'pyrosolver::2.0') >>> node_type.nameComponents() ('', '', 'pyrosolver', '2.0')
nameWithCategory()
→ str
Return the name of the node type, prefixed with the name of the node
type category. For example, for the geometry object, this function
returns "Object/geo"
. The category name and type name together
uniquely identify a node type.
>>> hou.nodeType(hou.objNodeTypeCategory(), "geo").nameWithCategory() 'Object/geo'
namespaceOrder()
→ tuple
of str
Returns a node type name list sorted in the descending namespace precedence order. The node types in the list have the same base type as this node type. They have different namespace and/or version.
Houdini uses this list when resolving an unqualified type name in
hou.Node.createNode()
; it will use the first entry in that list that
matches the name specified in the function.
# parse the full name into components >>> node_type = hou.nodeType(hou.dopNodeTypeCategory(), 'pyrosolver') >>> node_type.namespaceOrder() ('pyrosolver::2.0', 'pyrosolver')
description()
→ str
Return the description of this node type that appears in the tab menu.
For example, for the geometry object, the description is "Geometry"
.
This description is also called the operator label in Houdini.
instances()
→ tuple
of hou.Node
Return a tuple of all the nodes of this type in the current scene.
category()
→ hou.NodeTypeCategory
Return the node type category for this node type. For example, for the geometry object, the result is the object returned by hou.objNodeTypeCategory().
parmTemplateGroup()
→ hou.ParmTemplateGroup
Return the group of parm templates corresponding to this node type’s parameter interface.
See hou.ParmTemplateGroup for more information on parm template groups. To change the parameter interface for a node type defined by a digital asset, see hou.HDADefinition.setParmTemplateGroup().
parmTemplates()
→ tuple
of hou.ParmTemplate
Return a tuple of parm templates for the parameters on this node type. Note that spare parameters on individual node instances are not included in this tuple, since they are independent from the node type.
definition()
→ hou.HDADefinition
If this node type corresponds to a digital asset, return the hou.HDADefinition. Otherwise, return None.
allInstalledDefinitions()
→ tuple
of hou.HDADefinition
Search all installed operator type libraries and return a tuple of available hou.HDADefinition objects providing definitions for this node type.
Houdini allows multiple otl files to be loaded at the same time that each contain definitions for the same node type. The definition in use is called the current definition. See also hou.HDADefinition.isCurrent().
hdaModule()
→ hou.HDAModule
Return the HDAModule object for this node type. If the type is not for a digital asset, the module is empty. Otherwise, the module contains the functions, constants, classes, etc. in the user-defined "PythonModule" section of the digital asset.
You can use hou.Node.hdaModule() as a shortcut to access the HDAModule from a node instance.
See hou.HDAModule for more information.
aliases()
→ tuple
of str
Return all current aliases for this node type. See hou.NodeType.addAlias() for an example.
addAlias(alias)
Add an alias for this node type. You can use this alias when creating new nodes.
>>> geo_type = hou.nodeType(hou.objNodeTypeCategory(), "geo") >>> geo_type.addAlias("transformable") >>> geo_type.aliases() ('transformable',) >>> hou.node("/obj").createNode("transformable") <hou.ObjNode of type geo at /obj/geo1>
removeAlias(alias)
Remove an alias for this node type.
setHidden(hidden)
Set whether or not this node type appears in the tab menu. See also hou.NodeType.hidden().
deprecated()
→ bool
Return whether or not this node type has been marked deprecated. See also hou.NodeType.deprecationInfo().
deprecationInfo()
→ dict
of str
to str
or hou.NodeType
If the node type has been marked deprecated, this call will return the deprecation information as a dictionary.
The currently supported keys are:
'version'
The version of Houdini where this operator got deprecated. The form is either major.minor, or major.minor.build (e.g. 14.0 or 14.5.122). This item is always present.
'new_type'
The new node type this node was replaced with. This can be used to create a system of automatic node replacement.
'reason'
This lists the reason given for the deprecation, in case there is no new node to replace with.
minNumInputs()
→ int
Return the minimum number of inputs that nodes of this type can have. If these inputs are not connected, the node will generate an error.
maxNumInputs()
→ int
Return the maximum number of inputs that nodes of this type can have. Return 9999 if this node type can accept an unlimited number of inputs (e.g. the merge SOP).
maxNumOutputs()
→ int
Return the maximum number of outputs that nodes of this type can have. Most node types have only one output, but some, like the split dop, can have multiple.
hasPermanentUserDefaults()
→ bool
Returns whether a user has set permanent defaults for this node type.
See also hou.Parm.hasTemporaryDefaults()
hasUnorderedInputs()
→ bool
Return whether it is impossible for this node type to have gaps in its connected inputs. For example, the cookie SOP has two inputs, and it’s possible for only the second input to be connected, so this method would return False. However, the merge SOP cannot have any gaps in its inputs, so this method would return True.
See also hou.Node.inputs(), hou.Node.inputConnections(), and hou.Node.inputConnectors().
isGenerator()
→ bool
Return if this node type has been flagged as a generator. For example, a grid SOP generates new geometry, while a subdivide SOP does not, and instead processes the geometry passed into it. See also hou.NodeType.minNumInputs().
isManager(include_management_types=True)
→ bool
Return whether this NodeType is a manager. The manager node instances are
/obj
, /out
, /part
, /ch
, /shop
, /img
, and /vex
.
If include_management_types
is set to True then this method will
additionally return True if this node type is a management node type such
as a SHOP network, or VOP network, etc.
icon()
→ str
Return the name or path of the icon for this node type. Note that node types that ship with Houdini use a name instead of a full path, and Houdini uses its search path to locate the icon with that name.
source()
→ hou.nodeTypeSource enum value
Return a hou.nodeTypeSource enumerated value to indicate if this node type is implemented in VEX, RSL, or the HDK (in C++), or if it is a built-in node type that ships with Houdini.
>>> obj_cat = hou.objNodeTypeCategory() >>> sop_cat = hou.sopNodeTypeCategory() >>> hou.nodeType(obj_cat, "biped_auto_rig").source() nodeTypeSource.Subnet >>> hou.nodeType(sop_cat, "mountain").source() nodeTypeSource.VexCode
sourcePath()
→ str
Return the path to the source for this node type, or "Internal"
if it
is a built-in node type. If the node was created using the HDK, return
the path to the shared object/dll for the node type.
>>> obj_cat = hou.objNodeTypeCategory() >>> hou.nodeType(obj_cat, "biped_auto_rig").sourcePath() 'oplib:/Object/biped_auto_rig?Object/biped_auto_rig' >>> hou.nodeType(obj_cat, "geo").sourcePath() 'Internal'
sourceNetwork()
→ hou.Node or None
If this node type is a digital asset, return the Node instance whose contents define the digital asset. Otherwise, return None.
uninstallFromPath()
Remove this node and any references to it from a particular filesystem installation path. For example, this method will remove vex files, icons, dialog scripts, help cards, etc. for custom installed old-style non-otl node types.
If you call this method on built-in node types, it will have no effect.
node_type.uninstallFromPath(hou.homeHoudiniDirectory())
See also hou.hda.uninstallFile() and hou.HDADefinition.destroy().
isReadable()
→ bool
Return True if this node type is readable and False otherwise. A readable node type is one that you can create node instances from.
isWritable()
→ bool
Return True if this node type is writable and False otherwise. A writable node type is one that you can make changes to.
areContentsViewable()
→ bool
Return True if the node network contained in the node type is viewable and False otherwise.
containedNodeTypes()
→ tuple
of str
Return a tuple of all NodeType names of the contents of an HDA.
childTypeCategory()
→ hou.NodeTypeCategory or None
Return the NodeTypeCategory for this NodeType’s children, or None
if
this NodeType doesn’t allow children.
embeddedHelp()
→ str
Return the help text embedded in this node type. Return an empty string if no embedded help exists.
The embedded help is searched for in two different places in the following order:
-
If an HDK node, the text given by its
OP_Operator::getHDKHelp()
override -
If an HDA node, the corresponding result of hou.HDADefinition.embeddedHelp()
helpUrl()
→ str
Return the URL where the node type stores the documentation, e.g., a file name or an HDA section path. May return an empty string if node type does not know where the documentation is.
defaultHelpUrl()
→ str
Return a generic URL that the help system will try to resolve to the actual location that stores the node type documentation. The generic URL is in the form "operator:table/optypename" and may include additional information such as a namespace or a version.
defaultColor()
→ hou.Color
Return the color used to display a node of this type in the network view if the node’s hou.nodeFlag.ColorDefault flag is set.
setDefaultColor(color)
Set the color used to display a node of this type in the
network view if the node’s hou.nodeFlag.ColorDefault flag is set.
Pass None as the color
parameter to remove the type-specific default.
defaultShape()
→ str
Return the name of the shape used to display a node of this type in the network view if no shape is explcictly assigned to the node.
setDefaultShape(shape)
Set the name of the shape used to display a node of this type in the
network view if no shape is explcictly assigned to the node.
Pass None as the shape
parameter to remove the type-specific default.