HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_AgentClip Class Reference

#include <GU_AgentClip.h>

+ Inheritance diagram for GU_AgentClip:

Public Types

typedef fpreal32 FloatType
 
typedef GU_AgentXformT< FloatTypeXform
 
typedef UT_Array< XformXformArray
 
typedef UT_Matrix4T< FloatTypeMatrix4
 
typedef UT_Array< Matrix4Matrix4Array
 
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_transform_samples, exint num_transforms_per_sample)
 
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...
 
const UT_StringHoldername () const
 
bool isFile () const
 
void clearIsFile ()
 
const UT_StringHolderfileName () const
 
const GU_AgentRigrig () 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)
 
const XformArraylocalTransforms (exint sample_i) const
 
Matrix4ArrayConstPtr worldTransforms (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
 
const UT_StringArraychannelNames () const
 Returns the names of all additional channels in the clip. More...
 
exint channelCount () 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
 
fpreal sampleFromSeconds (fpreal seconds) const
 
fpreal secondsFromSample (fpreal sample) const
 
exint nearestSampleFromSeconds (fpreal seconds) const
 
fpreal wrappedSampleFromSeconds (fpreal seconds) const
 
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 ()
 Default constructor: Sets counter to 0. More...
 
SYS_FORCE_INLINE UT_IntrusiveRefCounter (const UT_IntrusiveRefCounter &)
 Copy constructor: Sets counter to 0. More...
 
UT_IntrusiveRefCounteroperator= (const UT_IntrusiveRefCounter &)
 Assignment operator: Does not modify counter. More...
 
SYS_FORCE_INLINE uint32 use_count () const
 Return current counter. More...
 

Static Public Member Functions

static GU_AgentClipPtr addClip (const char *name, const GU_AgentRigConstPtr &rig)
 Create an empty clip. More...
 
static GU_AgentClipPtr addClipFromFile (const char *name, const char *filename, const GU_AgentRigConstPtr &rig, UT_StringArray &errors)
 Create a clip given a CHOP clip file. More...
 
static void computeWorldTransforms (const GU_AgentRig &rig, const XformArray &xforms, Matrix4Array &matrices)
 
static void computeLocalTransforms (const GU_AgentRig &rig, const XformArray &xforms, Matrix4Array &matrices)
 
static void computeWorldTransforms (const GU_AgentRig &rig, const UT_BitArray *in_world_space, Matrix4Array &xforms)
 
static void computeLocalTransforms (const GU_AgentRig &rig, const UT_BitArray *in_world_space, Matrix4Array &xforms)
 
static void forceValidName (UT_String &clipname)
 Replaces whitespace, special characters, etc with underscores. More...
 

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

Detailed Description

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 202 of file GU_AgentClip.h.

Member Typedef Documentation

Definition at line 206 of file GU_AgentClip.h.

Definition at line 209 of file GU_AgentClip.h.

Definition at line 210 of file GU_AgentClip.h.

Definition at line 207 of file GU_AgentClip.h.

Definition at line 208 of file GU_AgentClip.h.

Constructor & Destructor Documentation

GU_AgentClip::~GU_AgentClip ( )

Member Function Documentation

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()).

Parameters
nameUnique name of the channel.
samplesFloat array with length sampleCount().
static GU_AgentClipPtr GU_AgentClip::addClip ( const char *  name,
const GU_AgentRigConstPtr rig 
)
static

Create an empty clip.

Examples:
SOP/SOP_BouncyAgent.C.
static GU_AgentClipPtr GU_AgentClip::addClipFromFile ( const char *  name,
const char *  filename,
const GU_AgentRigConstPtr rig,
UT_StringArray errors 
)
static

Create a clip given a CHOP clip file.

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.

Parameters
inv_total_weightInverse of the total blend weight at each joint.
exint GU_AgentClip::channelCount ( ) const
inline

Definition at line 394 of file GU_AgentClip.h.

const UT_StringArray& GU_AgentClip::channelNames ( ) const
inline

Returns the names of all additional channels in the clip.

Definition at line 393 of file GU_AgentClip.h.

void GU_AgentClip::clearIsFile ( )
static void GU_AgentClip::computeLocalTransforms ( const GU_AgentRig rig,
const XformArray xforms,
Matrix4Array matrices 
)
static

Compute the local transforms 'matrices' from the local 'xforms' corresponding to the transforms in 'rig'.

static void GU_AgentClip::computeLocalTransforms ( const GU_AgentRig rig,
const UT_BitArray in_world_space,
Matrix4Array xforms 
)
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 void GU_AgentClip::computeWorldTransforms ( const GU_AgentRig rig,
const XformArray xforms,
Matrix4Array matrices 
)
static

Compute the world transforms 'matrices' from the local 'xforms' corresponding to the transforms in 'rig'.

static void GU_AgentClip::computeWorldTransforms ( const GU_AgentRig rig,
const UT_BitArray in_world_space,
Matrix4Array xforms 
)
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.

const UT_StringHolder& GU_AgentClip::fileName ( ) const
inline

Definition at line 315 of file GU_AgentClip.h.

SYS_FORCE_INLINE exint GU_AgentClip::findChannel ( const UT_StringRef name) const

Finds a channel by name. Returns -1 if the channel does not exist.

Definition at line 481 of file GU_AgentClip.h.

static void GU_AgentClip::forceValidName ( UT_String clipname)
inlinestatic

Replaces whitespace, special characters, etc with underscores.

Definition at line 259 of file GU_AgentClip.h.

int64 GU_AgentClip::getMemoryUsage ( bool  inclusive) const
void GU_AgentClip::init ( exint  num_transform_samples,
exint  num_transforms_per_sample 
)

Initialize this clip to a 2D array of identity transforms given by 'num_transform_samples' columns each of length 'num_transforms_per_sample'.

Precondition
num_transform_samples must be larger than 0.
num_transforms_per_sample must be larger than 0.
bool GU_AgentClip::isFile ( ) const
inline

Definition at line 311 of file GU_AgentClip.h.

fpreal GU_AgentClip::length ( void  ) const
inline

Length of the clip, in seconds.

Definition at line 344 of file GU_AgentClip.h.

void GU_AgentClip::load ( const CL_Clip clip)

Load from clip.

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, identity matrices will be used for the additional joints.

const XformArray& GU_AgentClip::localTransforms ( exint  sample_i) const
inline

Definition at line 368 of file GU_AgentClip.h.

const UT_StringHolder& GU_AgentClip::name ( void  ) const
inline

Definition at line 308 of file GU_AgentClip.h.

exint GU_AgentClip::nearestSampleFromSeconds ( fpreal  seconds) const
inline

Definition at line 434 of file GU_AgentClip.h.

int GU_AgentClip::numTransformTracks ( ) const
inline

Return the number of transform tracks of the clip that was loaded into this clip.

Definition at line 301 of file GU_AgentClip.h.

const GU_AgentRig& GU_AgentClip::rig ( ) const
inline

Definition at line 318 of file GU_AgentClip.h.

FloatType GU_AgentClip::sampleChannel ( exint  channel_index,
fpreal  seconds 
) const

Samples an arbitrary channel in the clip at a specific time. For transforms, use GU_AgentClip::sampleTransform().

exint GU_AgentClip::sampleCount ( ) const
inline

Number of samples in this clip.

Definition at line 330 of file GU_AgentClip.h.

fpreal GU_AgentClip::sampleFromSeconds ( fpreal  seconds) const
inline

Definition at line 426 of file GU_AgentClip.h.

fpreal GU_AgentClip::sampleRate ( ) const
inline

Sample rate of this clip

Definition at line 351 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.

void GU_AgentClip::save ( CL_Clip clip,
bool  worldspace = false 
) const

Save to clip.

fpreal GU_AgentClip::secondsFromSample ( fpreal  sample) const
inline

Definition at line 430 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()).

Parameters
samplesAn array of local transform samples
Precondition
samples (and each sample within) must be at least length 1
Each entry in samples must be the same length
Postcondition
sampleCount() == samples.entries()
transformsPerSample() == samples.last().entries()
void GU_AgentClip::setSampleRate ( fpreal  sample_rate)
inline

Sample rate of this clip

Definition at line 352 of file GU_AgentClip.h.

void GU_AgentClip::setStart ( fpreal  t)
inline

Start time of this clip in seconds

Definition at line 339 of file GU_AgentClip.h.

fpreal GU_AgentClip::start ( ) const
inline

Start time of this clip in seconds

Definition at line 337 of file GU_AgentClip.h.

exint GU_AgentClip::transformsPerSample ( ) const
inline

Number of transforms in each sample.

Definition at line 322 of file GU_AgentClip.h.

Matrix4ArrayConstPtr GU_AgentClip::worldTransforms ( exint  sample_i) const
inline

Definition at line 370 of file GU_AgentClip.h.

fpreal GU_AgentClip::wrappedSampleFromSeconds ( fpreal  seconds) const
inline

Definition at line 439 of file GU_AgentClip.h.


The documentation for this class was generated from the following file: