Houdini 22.0 Character KineFX

Function mappings

Convenient name mappings for built-in APEX functions.

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

addNode(<name>, <callback>, [<color>])

graph::AddNode

graph.addNode('abc', 'Add<Float>', (1,0,1))

addWire(<srcport>, <dstport>)

graph::ConnectInput

graph.addWire(a.xform_out, b.parent)

addWire(<srcnode>, <srcname>, <dstnode>, <dstname>)

graph::FindAndConnectInput

graph.addWire(a, 'xform', b, 'parent')

connectedPorts(<portid>)

graph::GetConnectedPorts

x = graph.connectedPorts(b.parent)

connectNodes(<srcport>, <dstport>)

graph::ConnectInput

graph.connectNodes(a.xform_out, b.parent)

connectNodes(<srcnode>, <srcname>, <dstnode>, <dstname>)

graph::FindAndConnectInput

graph.connectNodes(a, 'xform', b, 'parent')

debug(<doinvoke>)

graph::Compile

If <doinvoke> is not specified, it defaults to True.

graph.debug()

findOrAddPort(<nodeid>, <portname>)

graph::FindOrAddPort

x = graph.findOrAddPort(a, 'xform[in]')

freeze

Value<ApexGraphHandle>

“Saves” the graph in a Value node.

g1 = graph.freeze()

getInputPorts(<node>)

graph::NodeInputs

x = graph.getInputPorts(a)

getOutputPorts(<node>)

graph::NodeOutputs

x = graph.getOutputPorts(a)

getPort(<nodeid>, <portname>)

graph::FindPort

x = graph.getPort(a, 'xform[in]')

matchNodes(<pattern>)

graph::FindNodes

x = graph.matchNodes('test*')

matchPorts(<pattern>)

graph::FindPorts

x = graph.matchPorts('test*:xform[in]')

ports(<pattern>)

graph::FindPorts

x = graph.ports('*xform*')

promoteInput(<portid>, [<subportname>], [<parmnodeid>], <parmname>)

graph::PromoteInput

graph.promoteInput(a.parent, 'p')

promoteOutput(<portid>, [<outputnodeid>], <outputname>)

graph::PromoteOutput

graph.promoteOutput(b.xform_out, 'x')

setNodeParms(<nodeid>, <parms>)

graph::UpdateNodeParms

graph.setNodeParms(a, d)

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

ancestors()

graphutils::NodeAncestors

# Pack node into a subnet
node_arr: ApexNodeIDArray = [a]
graph.packSubnet('my_test', node_arr)

# Returns 'my_test'
anc = a.ancestors()

callbackName()

graphutils::NodeCallbackName

x = a.callbackName()

data()

graph::NodeData

(name, callback, pos, color, parms, tags, properties, output) = a.data()

inPorts()

graph::NodeInputs

x = a.inPorts()

name()

graph::NodeName

x = a.name()

outPorts()

graph::NodeOutputs

x = a.outPorts()

parent()

graphutils::NodeParent

x = a.parent()

parms()

graphutils::NodeParms

x = a.parms()

path()

graphutils::NodePath

x = a.path()

port(<portname>)

graph::FindPort

x = a.port('xform[in]')

properties()

graphutils::NodeProperties

x = a.properties()

setColor(<color>)

graph::UpdateNode

a.setColor((1,0,0))

setName(<name>)

graph::UpdateNode

a.setName('aaa')

setParms(<parms>)

graph::UpdateNodeParms

a.setParms(d)

setPos(<pos>)

graph::UpdateNode

a.setPos((1,2,3))

setProperties(<properties>)

graph::UpdateNodeProperties

a.setProperties(d)

setTags(<tags>)

graph::UpdateNodeTags

a.setTags(['tag1','tag2'])

tags()

graphutils::NodeTags

x = a.tags()

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_out

Function

Maps to

Example

connect(<dstport>)

graph::ConnectInput

Connect ports on the same nesting level in a graph.

a_out.connect(b_in)

connected()

graph::GetConnectedPorts

x = a_out.connected()

connectPath(<dstport>, [<name>])

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 <name>.

# 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')

data()

graph::PortData

(name, alias, datatype, porttype, isconnected, ispromoted) = a_out.data()

disconnect()

graph::DisconnectPort

b_in.disconnect()

node()

graph::PortNode

x = a_out.node()

promote(<name>)

graph::PromotePort

a_out.promote('aa')

promoted()

graph::GetPromotedPort

x = a_out.promoted()

promoteInput(<parmname>, [<parmnodeid>]) or promoteInput(<subportname>, [<parmnodeid>, <parmname>])

graph::PromoteInput

a_in.promoteInput('tt')

promoteOutput(<outputname>, [<outputnodeid>])

graph::PromoteOutput

b_out.promoteOutput('tt')

subport(<portname>)

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

computeTransform(<mode>)

sop::kinefx::computetransform

geo: Geometry = BindInput()
geo.addJoint('joint_1', Matrix4(2))
geo.addJoint('joint_2', Matrix4(3))

x = geo.computetransform(mode=2)

cross(<b>)

CrossProduct

v = v1.cross(v2)

distance(<b>)

Distance

v = v1.distance(v2)

distanceTo(<b>)

Distance

v = v1.distanceTo(v2)

dot(<b>)

DotProduct

v = v1.dot(v2)

freeze()

Value<Dict>, Value<Geometry>

“Saves” the dictionary or geometry in a Value node.

d2 = d.freeze()

invert()

Invert<Matrix4>

This function is performed in-place - the input matrix is updated, so there is no need to assign to an output variable.

m.invert()

matrixToRotateTo(<b>)

transform::Dihedral<Matrix4>

v = v1.matrixToRotateTo(v2)

normalize()

Normalize

This function is performed in-place - the input vector is updated:

v1.normalize()

If normalize() is assigned to a variable, the variable is set to the length of the vector:

length:Float = v1.normalize()

normalized()

Normalize

v = v1.normalize()

smoothRotation(<b>, <rord>)

transform::SmoothRotation

v = v1.smoothRotation(v2, 1)

KineFX

Overview

Preparing character elements

Rigging with APEX graphs

  • APEX graph basics

    Introduction to the APEX graph evaluation framework.

  • APEX graph debugger

    Inspect the values of an APEX graph’s ports within the APEX network view.

  • APEX Script basics for graph building

    An overview of APEX Script, a code interface for building APEX graphs.

  • Graphs for numerical operations

    Example graphs of numerical operations like adding two values, fetching multiple results, and retrieving information from geometry.

  • Graphs for viewport animation

    Example graphs of animate state functionality like creating controls and constraints, and defining joint hierarchies.

  • Graphs for deforming geometry

    Example of a SOP network and APEX graph for deforming a 3-joint tube geometry.

  • Graph metadata

    Information added to graph nodes and ports.

  • APEX path pattern

    A set of rules that allow you to filter and select elements within graphs, skeletons, geometry, and the character folder structure.

  • APEX graph nodes

    APEX nodes provide operations for building up the functionality of APEX graphs, which are used in KineFX to create character rigs and perform other geometry manipulation.

  • APEX updates for H22

    New and updated APEX graph nodes for Houdini 22.

Building rig graphs with APEX Script

Rigging with rig components

Animating in the viewport

  • Animation workflow

    Example networks of adding characters, props, characters, and animation to a scene.

  • Animating in LOPs

    Rig and animate characters and props in the context of a USD stage.

  • Working in the animate state

    Select and manipulate controls, define transform limits for controls, and add skin controls to a character.

  • Animate state menus and HUDs

    Menus, HUDs, toolbars, and options in the animate state.

  • Animate state hotkeys

    Hotkeys available in the animate state.

  • Posing

    Pose characters in the animation scene by using locators, copying and pasting controls, and mirroring poses.

  • Motion paths

    Visualize the motion of controls as curves in 3D space.

  • Constraints

    Create relationships between controls in the animate state.

  • Dynamic motion

    Add physically-accurate projectile motion to your animation in the animate state.

  • Ragdoll

    Add a ragdoll simulation to your animation in the animate state.

  • Full body IK

    Apply full body inverse kinematics to pose the character using high-level targets rather than manipulating individual joints.

  • Secondary motion

    Add physically-accurate effects like lag/overshoot, jiggle, and spring to your animation in the animate state.

  • Control selection sets

    A tree view of controls, selections, and selection sets for the animate state. Allows management of control selection and visibility.

  • Motion mixer

    Combine and edit the animation clips of multiple characters in a timeline-based view.

  • Character picker

    Create a 2D layout with simple buttons for selecting character controls in an animation scene.

  • Animation catalog

    Save, manage, and apply animations and single-frame poses to an animation scene.

  • Animation layers

    Create multiple layers of animation without affecting the original animation.

  • Animation toolbar

    A customizable toolbar consisting of simple slider tools that quickly apply modifications to animation controls and curves.

  • Animation bookmarks

    Frame markers that help organize and identify the different parts of your animation.

Customizing the animate state

SOP-based animation

  • Physics-based motion

    Add physically-accurate motion to your animation using the Projectile Motion and Pendulum Motion SOPs.

  • Ragdoll simulations

    Add a ragdoll simulation to your animation using the Ragdoll Solver SOP.

Deformation

  • Blend shapes

    Create blend shapes using blend shape SOP nodes.

Animation retargeting

Pre-H20

Panes

  • Motion mixer

    A timeline-based view of the animation clips and motion effects of multiple characters.

  • Character picker

    Create a 2D layout with simple buttons to select character controls in an animation scene.

  • Rig tree view

    A hierarchical view of character components, including packed character folders, KineFX rigs, and Object node rigs.

  • Animation editor

    View and edit animated parameters and their transitions between keyframes.

  • Geometry spreadsheet

    Displays details about the geometry selected in the network editor.

Appendix