| On this page |
APEX Script provides convenient name mappings for some of the built-in APEX functions.
Graph functions ¶
The examples in this section use the following definitions:
graph = ApexGraphHandle()
# Add two TransformObject nodes to the graph
a = graph.addNode('test_a', 'TransformObject')
b = graph.addNode('test_b', 'TransformObject')
# Dictionary
d = {'xord': 3}Function |
Maps to |
Example |
|---|---|---|
|
graph::AddNode |
|
|
graph::ConnectInput |
|
|
graph::FindAndConnectInput |
|
|
graph::GetConnectedPorts |
|
|
graph::ConnectInput |
|
|
graph::FindAndConnectInput |
|
|
graph::Compile |
If
|
|
graph::FindOrAddPort |
|
|
Value<ApexGraphHandle> |
“Saves” the graph in a Value node.
|
|
graph::NodeInputs |
|
|
graph::NodeOutputs |
|
|
graph::FindPort |
|
|
graph::FindNodes |
|
|
graph::FindPorts |
|
|
graph::FindPorts |
|
|
graph::PromoteInput |
|
|
graph::PromoteOutput |
|
|
graph::UpdateNodeParms |
|
Node functions ¶
The examples in this section use the following definitions:
graph = ApexGraphHandle()
# TransformObject node 'test_a'
a = graph.addNode('test_a', 'TransformObject')
# Dictionaries
d = {'abc': 3} Function |
Maps to |
Example |
|---|---|---|
|
graphutils::NodeAncestors |
# Pack node into a subnet
node_arr: ApexNodeIDArray = [a]
graph.packSubnet('my_test', node_arr)
# Returns 'my_test'
anc = a.ancestors()
|
|
graphutils::NodeCallbackName |
|
|
graph::NodeData |
|
|
graph::NodeInputs |
|
|
graph::NodeName |
|
|
graph::NodeOutputs |
|
|
graphutils::NodeParent |
|
|
graphutils::NodeParms |
|
|
graphutils::NodePath |
|
|
graph::FindPort |
|
|
graphutils::NodeProperties |
|
|
graph::UpdateNode |
|
|
graph::UpdateNode |
|
|
graph::UpdateNodeParms |
|
|
graph::UpdateNode |
|
|
graph::UpdateNodeProperties |
|
|
graph::UpdateNodeTags |
|
|
graphutils::NodeTags |
|
Port functions ¶
The examples in this section use the following definitions:
graph = ApexGraphHandle()
# Add two TransformObject nodes to graph
a = graph.addNode('test_a', 'TransformObject')
b = graph.addNode('test_b', 'TransformObject')
# Ports on node 'test_a'
a_in = a.t_in
a_out = a.xform_out
# Ports on node 'test_b'
b_in = b.parent_in
b_out = b.t_outFunction |
Maps to |
Example |
|---|---|---|
|
graph::ConnectInput |
Connect ports on the same nesting level in a graph.
|
|
graph::GetConnectedPorts |
|
|
graph::AddWirePath |
Connects ports on different nesting levels in a graph, for example, connecting to a node in a subnet. The name of the connection port that is created on the subnet node is set to # Add a node to the graph
c = graph.addNode('test_x', 'TransformObject')
# Pack the node into a subnet
node_arr: ApexNodeIDArray = [c]
graph.packSubnet('test_subnet', node_arr)
# Connect to node in subnet
a_out.connectPath(c.xform_in, 'abc')
|
|
graph::PortData |
|
|
graph::DisconnectPort |
|
|
graph::PortNode |
|
|
graph::PromotePort |
|
|
graph::GetPromotedPort |
|
|
graph::PromoteInput |
|
|
graph::PromoteOutput |
|
|
graph::GetSubPort |
If you use subport() to create a subport on a node, you won’t see the new subport in the graph until you connect something to it. # Add nodes to graph
c = graph.addNode('test_c', 'Add<Float>')
d = graph.addNode('test_d', 'Add<Float>')
# Create subport 'dd'
d_in = d.b_in.subport('dd')
# Connect to subport 'dd'
c.result.connect(d_in)
|
Data functions ¶
The examples in this section use the following definitions:
# Dictionaries
d = {'abc': 3}
# Vectors
v1 = (1,2,3)
v2 = (2,4,5)
# Matrix
m = Matrix4(2)Function |
Maps to |
Example |
|---|---|---|
|
sop::kinefx::computetransform |
geo: Geometry = BindInput()
geo.addJoint('joint_1', Matrix4(2))
geo.addJoint('joint_2', Matrix4(3))
x = geo.computetransform(mode=2)
|
|
CrossProduct |
|
|
Distance |
|
|
Distance |
|
|
DotProduct |
|
|
Value<Dict>, Value<Geometry> |
“Saves” the dictionary or geometry in a Value node.
|
|
Invert<Matrix4> |
This function is performed in-place - the input matrix is updated, so there is no need to assign to an output variable.
|
|
transform::Dihedral<Matrix4> |
|
|
Normalize |
This function is performed in-place - the input vector is updated:
If normalize() is assigned to a variable, the variable is set to the length of the vector:
|
|
Normalize |
|
|
transform::SmoothRotation |
|