Class Node
object --+
|
Boost.Python.instance --+
|
Node
- Known Subclasses:
-
Represents a node within a graph.
Bracket-operator Input/Output Fetch Syntax
You can use the [] operator on a node to get an input or
output directly. For example, if a is a node instance:
a['foo']
returns the input (or output) with name 'foo'. You can fetch an
input/output pair by using two parameters. For example:
a['input-name', 'output-name'] # return a (input, output) tuple
This is useful in conjunction with the right-shift connection syntax
described below.
Right-Shift Connection Syntax
You can use the following connection syntax to easily connect inputs
and outputs. You can use the right-shift operator (>>) to
build connections such as:
<node-input-or-output> >> <node-input-or-output>[>> <node-input-or-output> ...]
For example, assuming a, b and c are created
node instances, all of the following are valid constructs:
# connect named output on a to named input on b
a['output-name'] >> b['input-name']
# to chain more than one connection, the most explicit way is to use a tuple
a['output-name'] >> (b['input-name'], b['output-name']) >> c['input-name']
# or more simply...
a['output-name'] >> b['input-name', 'output-name'] >> c['input-name']
Resolving Ambiguities
If you specify an input socket on the left side of a connection, it
is replaced by the corresponding node of that input. If you specify a
node on the left side of a connection, the connection algorithm
attempts to find an output on the node matching the type of the input
on the right side of the >> operator. Conversely, if you
specify an output socket on the right side, it is replaced by the
corresponding node of that output. If you specify a node on the right
side, the connection algorithm attempts to find an input on the node
matching the type of the output on the left side of the >>
operator. However, if you specify only nodes on both sides, an
algorithm looks successively at each output of the node on the left,
and attempts to find an input of matching type on the node on the
right. It continues until a match is found. An ambiguous syntax should
be used only in cases where there is no ambiguity (i.e. the node on the
left has a single output, and/or the node on the right has a single
input of the specified type). As this is often the case, this is a
convenient way to connect nodes with minimal syntax.
For example:
# connect one of a's outputs to one of b's default inputs
a >> b
# you can chain with nodes only as well
a >> b >> c['input-name']
# in this case b's input is fetched automatically
a >> b['output-name'] >> c
Using these techniques you could create all your node instances and
then make all the connections very simply in a few lines.
Note that if there is an input and an output with the same name, you
must disambiguate by calling getInput() or getOutput() instead of using the bracket notation to
get an input/output.
|
|
|
|
|
|
|
|
__init__(...)
Raises an exception This class cannot be instantiated from Python |
|
|
|
|
|
|
|
|
|
|
|
|
Value
|
addValue(...)
Creates new dynamic value, adds it to this node and returns it. |
|
|
|
|
|
[tuple]
|
getAnchors(...)
Returns:
The list of anchors on this node. |
|
|
|
Graph
|
getGraph(...)
Returns:
The version (composition graph) that owns this node. |
|
|
|
GroupNode
|
getGroup(...)
Returns:
The group node to which this node belongs. |
|
|
int
|
getId(...)
Returns:
Unique identifier of the node within its graph. |
|
|
|
Input
|
getInput(...)
Returns:
A node input socket by name. |
|
|
[Input]
|
getInputs(...)
Returns:
The list of input sockets on this node. |
|
|
str
|
getName(...)
Returns:
The node name. |
|
|
|
Output
|
getOutput(...)
Returns:
A node output socket by name. |
|
|
[Output]
|
getOutputs(...)
Returns:
The list of output sockets on this node. |
|
|
|
Input
|
|
|
Output
|
|
|
Input
|
getPrimaryInput(...)
Returns:
The node's primary/first input of the given type. |
|
|
|
Input
|
getPrimaryOutput(...)
Returns:
The node's primary/first output of the given type. |
|
|
str
|
|
tuple
|
getSchematicPosition(...)
Returns:
The position of the node in the schematic as an (x, y)
float tuple. |
|
|
|
Value
|
getValue(...)
Returns:
A node value by name. |
|
|
[Value]
|
getValues(...)
Returns:
The list of values on this node. |
|
|
bool
|
hasAnchor(...)
Returns:
True if the node has the specified anchor. |
|
|
bool
|
|
|
|
removeAnchor(...)
Removes the specified anchor from this node. |
|
|
|
|
|
|
|
setAnchors(...)
Sets a list of anchors on this node. |
|
|
|
|
setName(...)
Sets the name of the node. |
|
|
|
|
|
|
Inherited from Boost.Python.instance:
__new__
Inherited from object:
__delattr__,
__format__,
__getattribute__,
__hash__,
__reduce_ex__,
__repr__,
__setattr__,
__sizeof__,
__str__,
__subclasshook__
|
|
Inherited from object:
__class__
|
__init__(...)
(Constructor)
|
|
Raises an exception This class cannot be instantiated from Python
- Overrides:
object.__init__
|
|
helper for pickle
- Overrides:
object.__reduce__
- (inherited documentation)
|
|
Adds an anchor to this node.
- Parameters:
anchor (tuple) - A tuple of anchor type and anchor name which are
both unicode strings.
|
|
Creates new dynamic value, adds it to this node and returns it.
- Parameters:
- Returns: Value
- The new dynamic value.
|
enableSchematicThumbnail(...)
|
|
Enables/disables the thumbnail on this node in the schematic.
- Parameters:
enabled (bool) - Whether to enable or disable the thumbnail.
|
- Parameters:
type (str) - Optional argument that specifies which type of anchors to get.
Defaults to "".
- Returns:
[tuple]
- The
list of anchors on this node. An anchor is a
tuple of anchor type and anchor name which are both
unicode strings.
|
- Returns: Graph
- The version (composition graph) that owns this node.
|
- Returns: GroupNode
- The group node to which this node belongs.
|
- Returns:
int
- Unique identifier of the node within its graph.
|
- Parameters:
- Returns: Input
- A node input socket by name.
|
- Returns:
[Input]
- The
list of input sockets on this node. Some input
sockets (StructuredInput) are recursive: they may contain
other inputs, but the function only returns "root"
inputs.
|
- Returns:
str
- The node name.
|
- Parameters:
- Returns: Output
- A node output socket by name.
|
- Returns:
[Output]
- The
list of output sockets on this node.
|
- Parameters:
- Returns: Input
- The node's primary/first input of the given type.
When the type is set to DataTypeType.UNKNOWN (default), the primary
input of the node is returned or None if there is no
primary input.
When an actual socket type is specified and the node does not
have a primary input of the given type, the first input of that
type is returned. If the node doesn't have any input of the given
type, None is returned.
|
- Parameters:
- Returns: Input
- The node's primary/first output of the given type.
When the type is set to DataTypeType.UNKNOWN (default), the primary
output of the node is returned or None if there is
no primary output.
When an actual socket type is specified and the node does not
have a primary output of the given type, the first output of that
type is returned. If the node doesn't have any output of the
given type, None is returned.
|
- Returns:
str
- The fully qualified name of the node. It is of the form:
"outerGroup.enclosingGroup.nodeName".
|
getSchematicPosition(...)
|
|
- Returns:
tuple
- The position of the node in the schematic as an (x,
y) float
tuple.
|
- Parameters:
- Returns: Value
- A node value by name.
|
- Returns:
[Value]
- The
list of values on this node.
|
- Parameters:
anchor (tuple) - A tuple of anchor type and anchor name which are
both unicode strings.
- Returns:
bool
True if the node has the specified anchor.
|
isSchematicThumbnailEnabled(...)
|
|
- Returns:
bool
- Whether the schematic thumbnail is enabled on this node.
|
|
Removes the specified anchor from this node. Attempting to remove an
anchor that doesn't exist is a no-op.
- Parameters:
anchor (tuple) - A tuple of anchor type and anchor name which are
both unicode strings.
|
|
Removes an existing dynamic value Value from
this node.
- Parameters:
value (Value or str) - Value or name of the value.
|
|
Sets a list of anchors on this node. Previous anchors, if
any, are discarded. An anchor is a tuple of anchor type and
anchor name which are both unicode strings.
- Parameters:
anchorList (list of tuple) - List of (type, name) anchors.
|
|
Sets the name of the node.
- Parameters:
|
setSchematicPosition(...)
|
|
Sets the (x, y) position of the node in the
schematic.
- Parameters:
x (float) - Node horizontal position.
y (float) - Node vertical position.
|