HDK
|
#include <GU_AgentClip.h>
Public Types | |
typedef fpreal32 | FloatType |
typedef UT_Array< FloatType > | FloatArray |
typedef UT_SharedPtr< FloatArray > | FloatArrayPtr |
typedef GU_AgentXformT< FloatType > | Xform |
typedef UT_Array< Xform > | XformArray |
typedef UT_Matrix4T< FloatType > | Matrix4 |
typedef UT_Array< Matrix4 > | Matrix4Array |
typedef UT_SharedPtr < Matrix4Array > | Matrix4ArrayPtr |
typedef UT_SharedPtr< const Matrix4Array > | Matrix4ArrayConstPtr |
Public Member Functions | |
~GU_AgentClip () | |
int64 | getMemoryUsage (bool inclusive) const |
void | init (exint num_samples) |
void | load (const CL_Clip &clip) |
Load from clip. More... | |
void | load (const GU_AgentClip &clip) |
int | numTransformTracks () const |
void | save (CL_Clip &clip, bool worldspace=false) const |
Save to clip. More... | |
bool | isFile () const |
Returns whether the clip references a file on disk. More... | |
const UT_StringHolder & | fileName () const |
Returns the name of the file referenced by the clip. More... | |
void | clearIsFile () |
bool | isLoaded () const |
Returns whether the clip's contents have been loaded from disk. More... | |
bool | hasLoadErrors () const |
Returns whether there were errors when loading the clip from disk. More... | |
bool | loadFromFile (UT_StringArray *errors=nullptr) const |
Explicitly loads the clip from disk. More... | |
const GU_AgentRig & | rig () const |
exint | transformsPerSample () const |
Number of transforms in each sample. More... | |
exint | sampleCount () const |
Number of samples in this clip. More... | |
fpreal | length () const |
Length of the clip, in seconds. More... | |
void | setLocalTransforms (const UT_Array< XformArray > &samples) |
void | setLocalTransforms (exint sample_i, const XformArray &xforms) |
Edit the transforms for a specific sample in the clip. More... | |
const XformArray & | localTransforms (exint sample_i) const |
Matrix4ArrayConstPtr | worldTransforms (exint sample_i) const |
const FloatArray & | channelValues (exint sample_i) const |
void | sampleTransform (exint i, fpreal seconds, bool worldspace, Matrix4 &xform_sample) const |
Samples a transform in the clip at a specific time. More... | |
void | addChannel (const UT_StringHolder &name, const FloatType *samples) |
exint | findChannel (const UT_StringRef &name) const |
Finds a channel by name. Returns -1 if the channel does not exist. More... | |
FloatType | sampleChannel (exint channel_index, fpreal seconds) const |
exint | channelCount () const |
const UT_StringHolder & | channelName (exint i) const |
Returns the name of the specified channel. More... | |
UT_StringArray | channelNames () const |
void | addScaledLocalTransforms (XformArray &dst, fpreal scale, fpreal seconds) const |
void | addScaledLocalTransforms (XformArray &dst, const UT_BitArray &joints, fpreal scale, const UT_Array< fpreal > &inv_total_weights, fpreal seconds) const |
void | concatLocalTransforms (XformArray &dst, const GU_AgentTransformGroup &xform_grp, fpreal percent, fpreal seconds) const |
Perform an additive blend with the specified percentage. More... | |
void | addScaledLocalTransform (Xform &xform, exint i, fpreal scale, fpreal seconds) const |
void | addScaledChannelValues (FloatArray &dst, const UT_BitArray &channels, fpreal scale, const UT_Array< fpreal > &inv_total_weights, fpreal seconds) const |
fpreal | sampleFromSeconds (fpreal seconds) const |
fpreal | secondsFromSample (fpreal sample) const |
exint | nearestSampleFromSeconds (fpreal seconds) const |
fpreal | wrappedSampleFromSeconds (fpreal seconds) const |
const UT_StringHolder & | name () const |
void | setName (const UT_StringHolder &name) |
fpreal | start () const |
void | setStart (fpreal t) |
fpreal | sampleRate () const |
void | setSampleRate (fpreal sample_rate) |
Public Member Functions inherited from UT_IntrusiveRefCounter< GU_AgentClip > | |
SYS_FORCE_INLINE | UT_IntrusiveRefCounter () noexcept |
Default constructor: Sets counter to 0. More... | |
SYS_FORCE_INLINE | UT_IntrusiveRefCounter (const UT_IntrusiveRefCounter &) noexcept |
Copy constructor: Sets counter to 0. More... | |
UT_IntrusiveRefCounter & | operator= (const UT_IntrusiveRefCounter &) noexcept |
Assignment operator: Does not modify counter. More... | |
SYS_FORCE_INLINE uint32 | use_count () const noexcept |
Return current counter. More... | |
SYS_FORCE_INLINE bool | conditionalAddRef () noexcept |
Additional Inherited Members | |
Protected Member Functions inherited from UT_IntrusiveRefCounter< GU_AgentClip > | |
SYS_FORCE_INLINE | ~UT_IntrusiveRefCounter () |
Destructor: Only derived classes can destruct this. More... | |
An agent motion clip
It is represented as array of samples, where each sample has transformsPerSample() number of transforms. These transforms can be "local" (corresponding to the transform hierarchy of rig()), or "world" where they are multiplied all the way up to a root node in the rig.
Definition at line 51 of file GU_AgentClip.h.
typedef UT_Array<FloatType> GU_AgentClip::FloatArray |
Definition at line 56 of file GU_AgentClip.h.
Definition at line 57 of file GU_AgentClip.h.
typedef fpreal32 GU_AgentClip::FloatType |
Definition at line 55 of file GU_AgentClip.h.
typedef UT_Matrix4T<FloatType> GU_AgentClip::Matrix4 |
Definition at line 60 of file GU_AgentClip.h.
typedef UT_Array<Matrix4> GU_AgentClip::Matrix4Array |
Definition at line 61 of file GU_AgentClip.h.
typedef UT_SharedPtr<const Matrix4Array> GU_AgentClip::Matrix4ArrayConstPtr |
Definition at line 63 of file GU_AgentClip.h.
Definition at line 62 of file GU_AgentClip.h.
typedef GU_AgentXformT<FloatType> GU_AgentClip::Xform |
Definition at line 58 of file GU_AgentClip.h.
typedef UT_Array<Xform> GU_AgentClip::XformArray |
Definition at line 59 of file GU_AgentClip.h.
GU_AgentClip::~GU_AgentClip | ( | ) |
void GU_AgentClip::addChannel | ( | const UT_StringHolder & | name, |
const FloatType * | samples | ||
) |
Add an extra channel into the clip (as an alternative to GU_AgentClip::load()). If a channel with the same name already exists, its data is replaced with the new samples.
name | Unique name of the channel. |
samples | Float array with length sampleCount(). |
|
static |
Create an empty clip.
|
static |
Create a clone of a clip, referencing the specified rig. 'copy_external_ref' should be disabled if the new clip will be further modified.
|
static |
Create a clip by loading a clip file from disk.
void GU_AgentClip::addScaledChannelValues | ( | FloatArray & | dst, |
const UT_BitArray & | channels, | ||
fpreal | scale, | ||
const UT_Array< fpreal > & | inv_total_weights, | ||
fpreal | seconds | ||
) | const |
Adds a scaled version of the channel values given a clip time. Only the channels defined on GU_AgentRig are included.
void GU_AgentClip::addScaledLocalTransform | ( | Xform & | xform, |
exint | i, | ||
fpreal | scale, | ||
fpreal | seconds | ||
) | const |
void GU_AgentClip::addScaledLocalTransforms | ( | XformArray & | dst, |
fpreal | scale, | ||
fpreal | seconds | ||
) | const |
Add a scaled version of our local transforms using the given clip time. If the time in seconds exceeds the length of our clip, then it is wrapped around.
void GU_AgentClip::addScaledLocalTransforms | ( | XformArray & | dst, |
const UT_BitArray & | joints, | ||
fpreal | scale, | ||
const UT_Array< fpreal > & | inv_total_weights, | ||
fpreal | seconds | ||
) | const |
Variant of addScaledLocalTransforms that only affects a subset of the joints.
inv_total_weight | Inverse of the total blend weight at each joint. |
|
inline |
Returns the number of non-transform channels in the clip. This value will be >= GU_AgentRig::channelCount().
Definition at line 453 of file GU_AgentClip.h.
|
inline |
Returns the name of the specified channel.
Definition at line 441 of file GU_AgentClip.h.
UT_StringArray GU_AgentClip::channelNames | ( | ) | const |
Builds a list of all channel names in the clip (channels defined by GU_AgentRig, plus any spare channels).
|
inline |
Definition at line 265 of file GU_AgentClip.h.
void GU_AgentClip::clearIsFile | ( | ) |
Clears the external file reference. The clip's contents will also be loaded from disk if necessary.
|
static |
Compute the local transforms 'matrices' from the local 'xforms' corresponding to the transforms in 'rig'.
|
static |
Given the world transforms 'xforms' corresponding to 'rig', convert them to local transforms in-place. The optional 'in_world_space' array can be used to specify if only some transforms in 'xforms' are currently in world space.
|
static |
Compute the world transforms 'matrices' from the local 'xforms' corresponding to the transforms in 'rig'.
|
static |
Given the local transforms 'xforms' corresponding to 'rig', convert them to world transforms in-place. The optional 'in_world_space' array can be used to specify if some transforms in 'xforms' are already in world space.
void GU_AgentClip::concatLocalTransforms | ( | XformArray & | dst, |
const GU_AgentTransformGroup & | xform_grp, | ||
fpreal | percent, | ||
fpreal | seconds | ||
) | const |
Perform an additive blend with the specified percentage.
|
inline |
Returns the name of the file referenced by the clip.
Definition at line 179 of file GU_AgentClip.h.
|
inline |
Finds a channel by name. Returns -1 if the channel does not exist.
Definition at line 426 of file GU_AgentClip.h.
|
inlinestatic |
Replaces whitespace, special characters, etc with underscores.
Definition at line 460 of file GU_AgentClip.h.
int64 GU_AgentClip::getMemoryUsage | ( | bool | inclusive | ) | const |
|
inline |
Returns whether there were errors when loading the clip from disk.
Definition at line 189 of file GU_AgentClip.h.
Set this clip to have the specified number of samples, filled with the rest transforms.
|
inline |
Returns whether the clip references a file on disk.
Definition at line 176 of file GU_AgentClip.h.
|
inline |
Returns whether the clip's contents have been loaded from disk.
Definition at line 186 of file GU_AgentClip.h.
Length of the clip, in seconds.
Definition at line 223 of file GU_AgentClip.h.
void GU_AgentClip::load | ( | const GU_AgentClip & | clip | ) |
Copy from another agent clip, and inherit the external reference if there is one. If the rigs are different, the rig's rest transforms will be used for the additional joints.
bool GU_AgentClip::loadFromFile | ( | UT_StringArray * | errors = nullptr | ) | const |
Explicitly loads the clip from disk.
|
inline |
Definition at line 255 of file GU_AgentClip.h.
|
inline |
Name of the clip.
Definition at line 169 of file GU_AgentClip.h.
Definition at line 351 of file GU_AgentClip.h.
|
inline |
Return the number of transform tracks of the clip that was loaded into this clip.
Definition at line 160 of file GU_AgentClip.h.
|
inline |
Definition at line 195 of file GU_AgentClip.h.
Samples a channel in the clip at a specific time. The channel indices from GU_AgentRig are valid indices for the clip's channels. For transforms, use GU_AgentClip::sampleTransform().
|
inline |
Number of samples in this clip.
Definition at line 208 of file GU_AgentClip.h.
Definition at line 341 of file GU_AgentClip.h.
|
inline |
Sample rate of this clip
Definition at line 230 of file GU_AgentClip.h.
void GU_AgentClip::sampleTransform | ( | exint | i, |
fpreal | seconds, | ||
bool | worldspace, | ||
Matrix4 & | xform_sample | ||
) | const |
Samples a transform in the clip at a specific time.
Definition at line 346 of file GU_AgentClip.h.
void GU_AgentClip::setLocalTransforms | ( | const UT_Array< XformArray > & | samples | ) |
Directly set the local transforms for this clip (as an alternative to using GU_AgentClip::load()).
samples | An array of local transform samples |
void GU_AgentClip::setLocalTransforms | ( | exint | sample_i, |
const XformArray & | xforms | ||
) |
Edit the transforms for a specific sample in the clip.
|
inline |
Name of the clip.
Definition at line 171 of file GU_AgentClip.h.
Sample rate of this clip
Definition at line 232 of file GU_AgentClip.h.
Start time of this clip in seconds
Definition at line 218 of file GU_AgentClip.h.
|
inline |
Start time of this clip in seconds
Definition at line 216 of file GU_AgentClip.h.
|
inline |
Number of transforms in each sample.
Definition at line 199 of file GU_AgentClip.h.
|
inline |
Definition at line 260 of file GU_AgentClip.h.
Definition at line 356 of file GU_AgentClip.h.