Inheritence |
|
Network dots are allowed to have a single input, but may have many outputs. They can be moved around to force a wire connecting two nodes to follow a specific path. They can also be used as "scaffolding" for a set of nodes that you want to be able to quickly add or remove in a larger network.
New dots are created by calling hou.Node.createNetworkDot() on the node that will contain the dot. A list of all existing dots in a network can be generated by calling hou.Node.networkDots().
Methods
setPinned(pinned)
Sets the boolean pinned state of this dot. Pinned dots are not functionally different from unpinned dots, but are treated differently by the network editor. A pinned dot remains even if its input and output connections are removed. An unpinned dot will be deleted automatically by the network editor if its input or last output is cut.
The following code is a greatly simplified version of the code for automatically deleting unconnected dots, which will delete any dots that are not pinned and that don’t have an input connection:
>>> net = hou.node('/obj') >>> net.createNetworkDot().setPinned(False) >>> net.createNetworkDot().setPinned(True) >>> net.networkDots() (<hou.NetworkDot dot1 in /obj>, <hou.NetworkDot dot2 in /obj>) >>> for dot in net.networkDots(): ... if not dot.isPinned(): ... if dot.inputItem() is None: ... dot.destroy() ... >>> net.networkDots() (<hou.NetworkDot dot2 in /obj>,)
isPinned()
→ bool
Returns the pinned state of this dot. See hou.NetworkDot.setPinned() for a more detailed discussion of the meaning of a pinned dot.
setInput(item_to_become_input, output_index=0)
Connects a network item to the input of this dot. This effectively rewires any nodes that are connected to the output of this dot.
Raises hou.InvalidInput if output_index
is invalid. Raises
hou.OperationFailed if item_to_become_input
is not in the same
network as this dot. Raises hou.PermissionError if the dot is
inside a locked asset.
setInput(input_index, item_to_become_input, output_index=0)
Connects a network item to the input of this dot, exactly like the two parameter form of this function. But this second signature matches the signature of hou.Node.setInput(), which allows code to run on either a network dot or a node. The value of the input_index is ignored.
insertInput(input_index, item_to_become_input, output_index=0)
Connects a network item to the input of this dot, exactly like the two
parameter form of setInput
. But this method name and signature matches
the signature of hou.Node.insertInput(), which allows code to run on
either a network dot or a node. The value of the input_index is ignored.
inputConnections()
→ tuple of hou.NodeConnection
Returns a tuple of hou.NodeConnection objects for the connection coming into this dot. The tuple will have a length of one if anything is connected to the input of this dot. Returns an empty tuple if nothing is connected.
destroy()
Delete this dot. Connections in and out of the dot are automatically re-established such that the behavior of the network will be unchanged by the removal of this dot.
Methods from hou.NetworkItem
networkItemType()
→ hou.networkItemType
Return an enum value indicating what type of network item is represented
by this object. This value is equivalent to using the isinstance
built in
Python function with the matching class
(for example hou.networkItemType.Connection is equivalent to
hou.NodeConnection).
Methods from hou.NetworkMovableItem
name()
→ str
Return this node’s name. See also hou.NetworkMovableItem.path().
setName(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()
→ 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
.
path()
→ str
Return the full path (i.e. starting with /
) of this node in the network.
relativePathTo(base_node)
→ str
Return 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) '.'
parent()
→ hou.Node
Return the node that contains this item.
Note that this method returns None if the item is the root node (i.e. /
).
>>> hou.node("/obj/box_object1").parent() <hou.Node at /obj> >>> print hou.node("/").parent() None
parentNetworkBox()
→ hou.NetworkBox or None
Returns the parent network box which contains this item, or None if it is not inside a network box.
isSelected()
→ bool
Return whether this item is selected.
See also hou.selectedNodes().
isPicked()
→ bool
Equivalent to calling hou.NetworkMovableItem.isSelected().
setSelected(on, clear_all_selected=False, show_asset_if_selected=False)
Select or deselect this item, optionally deselecting all other selected
items in this network. If show_asset_if_selected
is True, and this item
is a Node
, then the panes will show the top-level asset of the selected
item instead.
setPicked(on)
Equivalent to calling hou.NetworkMovableItem.setSelected() with default values for all optional parameters.
color()
→ hou.Color
Return the color of this item’s tile in the network editor.
setColor(color)
Sets the color of this item’s tile in the network editor to the given hou.Color.
sessionId()
Returns an integer value that uniquely identifies this item
in a given Houdini session. This id is only guaranteed to be unique
in a single Houdini process. It is useful as a quick and easy way to
save a restore a reference to an item. It is also only unique for
a specific item subclass. So there may be a Node
with the same
session id as a NetworkBox
.
See hou.nodeBySessionId() to turn a session id back into a node, or hou.networkBoxBySessionId() to turn a session id back into a network box, or more generally, hou.itemBySessionId() to turn a session id combined with an enum value indicating the item subclass into an item of that type.
position()
→ hou.Vector2
Return the position of this item’s tile in the network editor graph as
a Vector2
. See also move()
and setPosition()
.
setPosition(vector2)
Sets the position of this item’s tile in the network editor graph. Raises hou.InvalidInput if the item cannot have the given position.
move(vector2)
Moves this item’s tile in the network editor graph by the increments in the given hou.Vector2.
To position a item absolutely, use setPosition()
.
To get the item’s current graph position, use position()
.
Raises hou.InvalidInput if the item cannot move to the position specified.
shiftPosition(vector2)
Equivalent to calling hou.NetworkMovableItem.move().
size()
→ hou.Vector2
Return the size of this item’s tile in the network editor graph as a
Vector2
.
Methods from hou.IndirectInput
outputs()
→ tuple
of hou.Node
Return the nodes that have one of their inputs connected to the output of this object.
outputConnections()
→ tuple
of hou.NodeConnection
Return a tuple of objects representing each connection to a node from the output of this object. The objects returned by this method allow you to discover not just which nodes are connected to this object, but which inputs it feeds into.
input()
→ hou.Node
Return the node on the input side of this indirect input. If this
input comes through another indirect input, this function will recurse
through that indirect input until it finds a node. If no node is
connected, even indirectly, None
will be returned. Note that the
returned node may not be inside the same parent network as this object
if the method traverses up through a hou.SubnetIndirectInput.
inputOutputIndex()
→ int
Returns the index of the output connection on the node that the input
side of this object connects to. As with the input
function, indirect
inputs are traversed until a node is found. If no node is connected, even
indirectly, 0
will be returned.
inputItem()
→ hou.NetworkMovableItem
Returns the item connected directly to the input side of this indirect
input. This may be a node, indirect input, or None
if nothing is
connected. Note that the returned item may not be inside the same parent
network as this object if it is a hou.SubnetIndirectInput.
inputItemOutputIndex()
→ int
Returns the index of the output connection on the network item connected
directly to the input side of this object. Returns 0
if nothing is
connected. This value will only be non-zero if a hou.Node is
connected to this object since all other network items only has a single
output connector.
setColorDefault()
Sets the color of this object to be the default for indirect inputs. By
explicitly setting to the default color, any future changes to the default
indirect input color will cause this object to use the new color. This
method clears the symbolicColorName
setting and the
useColorFromOutput
setting.
setSymbolicColorName(name)
Sets the color of this object to use a symbolic color name defined in the
current Houdini color scheme (see hou.ui.colorByName). The symbolic
color name will be saved with the hip file so that changes to the color
scheme will result in a new color being used for this object. This
method clears the useColorFromDefault
setting, and causes the
color
value to be ignored.
setUseColorFromOutput(use_output_color)
Set this indirect input to display itself with the same color as the
first input connector connected as an output to this object. If set to
False
, this object is displayed with its color returned by the
hou.NetworkMovableItem.setColor() method. This method clears the
symbolicColorName
setting, and causes the color
value to be ignored.
symbolicColorName()
→ str
Return the symbolic color name used to display this object, set with the
setSymbolicColorName
method. Returns an empty string if the color of
this object was set using the setUseColorFromOutput
or
hou.NetworkMovableItem.setColor() methods. The symbolic color name
can be converted to a hou.Color using hou.ui.colorFromName.
useColorFromOutput()
→ bool
Return True
if this object will be displayed based on the color of the
first input to which it is connected. Return False
if will be displayed
using the color return by the :hou.NetworkMovableItem.color method.