See Crowd Animation Clips for more information.
Methods
__init__(name, filename, rig, keep_external_ref = True)
Creates a new agent clip by loading it from the specified .bclip
or .clip
file.
The channels within the clip should be of the form transform_name:channel_name
, where transform_name
is a string matching the values returned by hou.AgentRig.transformName() and channel_name
is one of tx
, ty
, tz
, rx
, ry
, rz
, sx
, sy
, or sz
.
The channels starting with t
denote translation, r
denote rotation, and s
denote scale.
The resulting transforms will be treated as local transforms and can be read via hou.AgentClip.sampleLocal() (i.e. they are relative to the corresponding parent transform in the agent’s skeleton).
Any other channels can be read via hou.AgentClip.sample().
Raises hou.OperationFailed if the file does not exist or otherwise cannot be loaded.
name
A name for the new clip, such as walk
.
filename
A path to a clip file.
rig
The hou.AgentRig that the clip will be associated with. The rig is used, for example, when converting transforms from local space to world space.
keep_external_ref
A bool
indicating whether the external reference should be maintained when the agent is saved to a geometry file.
If the reference is maintained, then the clip file needs to be available when the saved geometry is used (only the path to the clip is saved in the geometry file).
Otherwise, a copy of the clip will be inlined when saving out the geometry so that the original clip is no longer needed.
__init__(name, chop, rig, frame = hou.frame())
Creates a new agent clip from a CHOP in the scene.
name
A name for the new clip, such as walk
.
chop
A hou.ChopNode to load the clip from.
rig
The hou.AgentRig that the clip will be associated with. The rig is used, for example, when converting transforms from local space to world space.
frame
Specifies the frame to cook the CHOP node at.
__init__(clip, rig, name = "")
Creates a copy of an existing agent clip. The source clip may reference a different rig - in this case, identity transforms will be filled in for any new joints in the rig.
clip
A hou.AgentClip to copy the clip from.
rig
The hou.AgentRig that the clip will be associated with. The rig is used, for example, when converting transforms from local space to world space.
name
A name for the new clip, such as walk
. If this parameter is not specified, the source clip’s name will be used.
channelNames()
→ tuple
of str
Returns the names of the channels in the clip.
data(binary, worldspace = False)
→ str
Returns the clip data in ASCII or binary.
binary
Specifies whether the clip data should be saved in ASCII (.clip
) or binary (.bclip
) format.
worldspace
Specifies whether the transform channels should be saved in local or world space.
length()
→ float
Returns the length (in seconds) of the clip.
name()
→ str
Returns the name of the clip.
sample(time, channel_name)
→ float
time
The time (in seconds) to evaluate the clip at.
channel_name
Name of a channel in the clip. See hou.AgentClip.channelNames().
Evaluates the clip at the given time and returns the value of the specified channel. For sampling the clip’s transforms, use hou.AgentClip.sampleLocal() or hou.AgentClip.sampleWorld().
sampleLocal(time, transform)
→ hou.Matrix4
time
The time (in seconds) to evaluate the clip at.
transform
Index of a transform in the agent’s rig.
Evaluates the clip at the given time and returns the local transform.
sampleRate()
→ float
Returns the sample rate of the clip.
sampleWorld(time, transform)
→ hou.Matrix4
time
The time (in seconds) to evaluate the clip at.
transform
Index of a transform in the agent’s rig.
Evaluates the clip at the given time and returns the world transform.