Module reaction
This module provides convenient functions to modify nodes inside a
Reaction node. It attempts to some degree to reproduce the behaviour of
the user interface.
Note that this module is a pure Python module and you may inspect its
source code.
Basic Concepts
A reaction graph is a group node that contains boundary nodes on the
input side, which are shown as "sources" on the outside and
that can be connected to nodes on the inside, typically geometry and
material nodes. The geometry and material nodes are connected to
layers. Layers can also be connected to other layers to form object
hierarchies. Finally, all layers are connected to a "render"
node that produces a 2D image output from the 3D layers that are fed
into it.
The order in which the layers are sorted is determined by an array
of values on the render node. However, these can be more easily set by
specifying a subset of layers in the desired order to one of the
functions below.
You can use either the generic node connection interface to create
layers and customize reaction graphs, or the following convenience
functions.
ToolNode
|
getRenderNode(reacNode)
Returns:
The unique render node of the reaction node. |
|
|
[ToolNode ]
|
getCameras(reacNode)
Returns:
A list of the camera nodes in the given reaction node. |
|
|
[Input ]
|
getSources(reacNode)
Returns:
A list of the source input sockets of the specified
Reaction node. |
|
|
Input
|
addSource(reacNode,
name,
outputtolink=None)
Create a new source on the given reaction node. |
|
|
[Node ]
|
getLayers(reacNode)
Returns:
A list of the layer nodes (graph.Node ) in the order that they're sorted. |
|
|
|
setLayerPriorities(reacNode,
layers)
Change the priorities in the order of the list of layers. |
|
|
|
setPriorities(reacNode,
layers)
Change the priorities in the order of the list of layers. |
|
|
|
setCameraPriorities(reacNode,
cameras)
Change the priorities in the order of the list of cameras. |
|
|
tuple
|
addLayer(reacNode,
name=None,
source=None,
geomType='Bilinear')
Creates a new layer, with a new material and geometry of the
specified type. |
|
|
- Parameters:
- Returns:
ToolNode
- The unique render node of the reaction node.
|
- Parameters:
- Returns:
[ToolNode ]
- A
list of the camera nodes in the given reaction
node.
|
- Parameters:
- Returns:
[Input ]
- A
list of the source input sockets of the specified
Reaction node.
|
addSource(reacNode,
name,
outputtolink=None)
|
|
Create a new source on the given reaction node. You can optionally
specify an output to link the newly created source to.
- Parameters:
reacNode (GroupNode )
name (str ) - Source name.
outputtolink (graph.Output )
- Returns:
Input
- The corresponding input socket (
graph.Input ).
|
- Returns:
[Node ]
- A
list of the layer nodes (graph.Node ) in the order that they're sorted.
|
setLayerPriorities(reacNode,
layers)
|
|
Change the priorities in the order of the list of layers. If the
number of specified layers is not the total number of layers, change the
order of only the specified layers so that they are in the order
specified, even if there are other layers in between. Note that the
specified layers must be a subset of the entire set of layers.
- Parameters:
reacNode (GroupNode )
layers (list of GroupNode )
|
setPriorities(reacNode,
layers)
|
|
Change the priorities in the order of the list of layers. If the
number of specified layers is not the total number of layers, change the
order of only the specified layers so that they are in the order
specified, even if there are other layers in between. Note that the
specified layers must be a subset of the entire set of layers.
- Parameters:
reacNode (GroupNode )
layers (list of GroupNode )
|
setCameraPriorities(reacNode,
cameras)
|
|
Change the priorities in the order of the list of cameras. If the
number of given cameras is not the total number of cameras, change the
order of only the specified cameras so that they are in the order
specified, even if there are other cameras in between. Note that the
given cameras must be a subset of the entire set of cameras.
|
addLayer(reacNode,
name=None,
source=None,
geomType='Bilinear')
|
|
Creates a new layer, with a new material and geometry of the specified
type.
- Parameters:
reacNode (GroupNode )
name (str )
source (Socket )
geomType (str )
- Returns:
tuple
- A triplet (layer, material, geometry).
|