Functions
addBlendshapeInputs(base_shape_geo, shapes, channel_names)
Adds blendshape inputs to a shape’s geometry.
This sets up the required detail attributes (blendshape_shapenames
and blendshape_channels
) on the base shape’s geometry.
For an existing agent shape, blendshape inputs can also be added using hou.AgentShape.addBlendshapeInputs().
base_shape_geo
A modifiable hou.Geometry for the base shape.
shapes
A hou.AgentShape sequence to add as blendshape inputs. hou.AgentShapeLibrary.addShape() should be called separately to add these shapes to the shape library.
channel_names
A str
sequence specifying the channel name to use for each shape.
Raises hou.InvalidSize if the length does not match the shapes
list.
addInBetweenShapes(primary_shape_geo, shapes, weights)
Adds in-between shapes to a blendshape input.
This sets up the required detail attributes (blendshape_shapenames
and blendshape_inbetweenweights
) on the primary shape’s geometry.
For an existing agent shape, in-between shapes can also be added using hou.AgentShape.addInBetweenShapes().
primary_shape_geo
A modifiable hou.Geometry for the primary shape.
shapes
A hou.AgentShape sequence to add as in-between shapes. hou.AgentShapeLibrary.addShape() should be called separately to add these shapes to the shape library.
weights
A float
sequence specifying the weight that each in-between shape is applied at.
Raises hou.InvalidSize if the length does not match the shapes
list.
computeLocalTransforms(rig, xforms)
→ tuple
of hou.Matrix4
Converts transforms from world space to local space using the provided rig.
rig
A hou.AgentRig, which specifies the transform hierarchy.
xforms
A sequence of hou.Matrix4, with a world space transform for each joint in the rig. Raises hou.InvalidSize if the length does not match hou.AgentRig.transformCount().
computeWorldTransforms(rig, xforms)
→ tuple
of hou.Matrix4
Converts transforms from local space to world space using the provided rig.
rig
A hou.AgentRig, which specifies the transform hierarchy.
xforms
A sequence of hou.Matrix4, with a local space transform for each joint in the rig. Raises hou.InvalidSize if the length does not match hou.AgentRig.transformCount().
computeRotationLimits(rig, clips, transform, parent_transform)
→ dict
of str
to values
Computes rotation limits for the specified joint based on the range of motion in the provided clips.
The return value is a dictionary with the following keys:
-
anchor_pos
: A hou.Vector3 containing the cone’s anchor position. -
rotation
: A hou.Vector3 containing the cone’s orientation. -
child_rotation
: A hou.Vector3 containing the child’s orientation. -
twist_limits
: A hou.Vector2 containing the rotation limits for the twist axis. -
up_limits
: A hou.Vector2 containing the rotation limits for the up axis. -
out_limits
: A hou.Vector2 containing the rotation limits for the out axis.
rig
A hou.AgentRig.
clips
A list of hou.AgentClip.
transform
Index of a transform in the agent’s rig.
parent_transform
Index of the parent transform in the agent’s rig.
findAgentDefinitions(geometry, group = "")
→ tuple
of hou.AgentDefinition
Returns a list of the unique agent definitions in the geometry.
This is equivalent to the following code, but is significantly faster.
definitions = set() for prim in geometry.globPrims(group): if prim.type() == hou.primType.Agent: definitions.add(prim.definition()) return definitions
geometry
A hou.Geometry.
group
An optional group string to filter which primitives are inspected. The pattern format is the same as the format used for group parameters on SOP nodes.
findShapeDeformer(name)
→ hou.AgentShapeDeformer
Finds the shape deformer with the specified name, or None if no such deformer exists.
replaceAgentDefinitions(geometry, new_definition_map, group = "")
Replaces agent definitions in the geometry with new versions. This is a useful convenience function when modifying each agent definition in the geometry, particularly when also using hou.crowds.findAgentDefinitions().
For example:
defns = hou.crowds.findAgentDefinitions(geo, group) new_defn_map = {} for defn in defns: new_defn = defn.freeze() new_defn_map[defn] = new_defn # Add a clip to the new agent definition. new_defn.addClip(...) # Switch all agents in the group to their respective new agent definition. hou.crowds.replaceAgentDefinitions(geo, new_defn_map, group)
geometry
A modifiable hou.Geometry.
new_definition_map
A dictionary mapping each hou.AgentDefinition to a hou.AgentDefinition that it should be replaced by.
group
An optional group string to filter which primitives are modified. The pattern format is the same as the format used for group parameters on SOP nodes.
setBlendshapeDeformerParms(base_shape_geo, attribs="P", point_id_attrib="id", prim_id_attrib="")
Adds attributes to the geometry to specify parameters for the blendshapes deformer.
This creates the following detail attributes: blendshape_attribs
, blendshape_ptidattr
, and blendshape_primidattr
.
For an existing agent shape, the deformer parameters can be set using hou.AgentShape.setBlendshapeDeformerParms().
attribs
Specifies a list or pattern of attributes to be blended by the deformer.
point_id_attrib
Specifies the name of a point attribute used to match up points between the different blendshape inputs.
prim_id_attrib
Specifies the name of a primitive attribute used to match up points between the different blendshape inputs.
shapeDeformers()
→ tuple
of hou.AgentShapeDeformer
Returns a list of the available shape deformers.