EggCharacterCollection Class Reference

Represents a set of characters, as read and collected from possibly several model and/or animation egg files. More...

#include "eggCharacterCollection.h"

List of all members.

Classes

class  EggInfo
class  ModelDescription

Public Types

typedef pvector
< EggCharacterData * > 
Characters
typedef pvector< EggInfoEggs

Public Member Functions

int add_egg (EggData *egg)
 Adds a new egg file to the list of models and animation files for this particular character.
void check_errors (ostream &out, bool force_initial_rest_frame)
 Can be called after the collection has been completely filled up with egg files to output any messages from warning conditions that have been detected, such as inconsistent animation tables.
EggCharacterDataget_character (int i) const
 Returns the ith character in the collection.
EggCharacterDataget_character_by_model_index (int model_index) const
 Returns the character associated with the indicated model index.
EggCharacterDataget_character_by_name (const string &character_name) const
 Returns the Character with the indicated name, if it exists in the collection, or NULL if it does not.
EggDataget_egg (int i) const
 Returns the ith egg file.
int get_first_model_index (int egg_index) const
 Returns the first model index associated with the indicated egg file.
int get_num_characters () const
 Returns the number of separate Characters that have been discovered in the various egg files added to the collection.
int get_num_eggs () const
 Returns the number of egg files that have successfully been added to the Character table.
int get_num_models (int egg_index) const
 Returns the number of different models found in the indicated egg file.
EggCharacterDatamake_character (const string &character_name)
 Allocates and returns a new EggCharacterData object representing the named character, if there is not already a character by that name.
virtual EggCharacterDatamake_character_data ()
 Allocates and returns a new EggCharacterData structure.
virtual EggJointDatamake_joint_data (EggCharacterData *char_data)
 Allocates and returns a new EggJointData structure for the given character.
virtual EggSliderDatamake_slider_data (EggCharacterData *char_data)
 Allocates and returns a new EggSliderData structure for the given character.
void rename_char (int i, const string &name)
 Renames the ith character to the indicated name.
virtual void write (ostream &out, int indent_level=0) const

Public Attributes

Characters _characters
Characters _characters_by_model_index
Eggs _eggs

Detailed Description

Represents a set of characters, as read and collected from possibly several model and/or animation egg files.

Definition at line 35 of file eggCharacterCollection.h.


Member Function Documentation

int EggCharacterCollection::add_egg ( EggData egg)

Adds a new egg file to the list of models and animation files for this particular character.

Returns the new egg_index if the file is successfully added, or -1 if there is some problem (for instance, it does not contain a character model or animation table).

If the joint hierarchy does not match the existing joint hierarchy, a best match is attempted.

Definition at line 73 of file eggCharacterCollection.cxx.

References EggJointData::add_back_pointer(), EggCharacterData::add_model(), EggCharacterData::get_root_joint(), and make_character().

Referenced by EggCharacterFilter::post_command_line().

void EggCharacterCollection::check_errors ( ostream &  out,
bool  force_initial_rest_frame 
)

Can be called after the collection has been completely filled up with egg files to output any messages from warning conditions that have been detected, such as inconsistent animation tables.

In addition to reporting this errors, calling this function will also ensure that they are all repaired. Pass force_initial_rest_frame as true to also force rest frames from different models to be the same if they are initially different.

Definition at line 711 of file eggCharacterCollection.cxx.

References EggCharacterData::check_num_frames(), EggJointData::force_initial_rest_frame(), Filename::get_basename(), EggCharacterData::get_egg_data(), EggData::get_egg_filename(), EggCharacterData::get_joint(), EggCharacterData::get_model_index(), EggCharacterData::get_num_joints(), EggCharacterData::get_num_models(), and EggJointData::rest_frames_differ().

Referenced by EggCharacterFilter::post_command_line().

EggCharacterData * EggCharacterCollection::get_character ( int  i) const [inline]

Returns the ith character in the collection.

Definition at line 94 of file eggCharacterCollection.I.

Referenced by EggCharacterFilter::write_eggs().

EggCharacterData * EggCharacterCollection::get_character_by_model_index ( int  model_index) const [inline]

Returns the character associated with the indicated model index.

Definition at line 106 of file eggCharacterCollection.I.

EggCharacterData * EggCharacterCollection::get_character_by_name ( const string &  character_name) const

Returns the Character with the indicated name, if it exists in the collection, or NULL if it does not.

Definition at line 129 of file eggCharacterCollection.cxx.

Referenced by rename_char().

EggData * EggCharacterCollection::get_egg ( int  i) const [inline]

Returns the ith egg file.

Definition at line 33 of file eggCharacterCollection.I.

int EggCharacterCollection::get_first_model_index ( int  egg_index) const [inline]

Returns the first model index associated with the indicated egg file.

An egg file may contain multiple models, which will be consecutive integers beginning at get_first_model_index() and continuing for get_num_models().

Each "model" corresponds to a single character model, or one LOD of a multiple-LOD model, or a single animation bundle.

Definition at line 52 of file eggCharacterCollection.I.

int EggCharacterCollection::get_num_characters ( ) const [inline]

Returns the number of separate Characters that have been discovered in the various egg files added to the collection.

Definition at line 84 of file eggCharacterCollection.I.

Referenced by EggCharacterFilter::write_eggs().

int EggCharacterCollection::get_num_eggs ( ) const [inline]

Returns the number of egg files that have successfully been added to the Character table.

Definition at line 23 of file eggCharacterCollection.I.

int EggCharacterCollection::get_num_models ( int  egg_index) const [inline]

Returns the number of different models found in the indicated egg file.

An egg file may contain multiple models, which will be consecutive integers beginning at get_first_model_index() and continuing for get_num_models().

Each "model" corresponds to a single character model, or one LOD of a multiple-LOD model, or a single animation bundle.

Definition at line 71 of file eggCharacterCollection.I.

EggCharacterData * EggCharacterCollection::make_character ( const string &  character_name)

Allocates and returns a new EggCharacterData object representing the named character, if there is not already a character by that name.

Definition at line 192 of file eggCharacterCollection.cxx.

References make_character_data().

Referenced by add_egg().

EggCharacterData * EggCharacterCollection::make_character_data ( ) [virtual]

Allocates and returns a new EggCharacterData structure.

This is primarily intended as a hook so derived classes can customize the type of EggCharacterData nodes used to represent the characters in this collection.

Definition at line 152 of file eggCharacterCollection.cxx.

Referenced by make_character().

EggJointData * EggCharacterCollection::make_joint_data ( EggCharacterData char_data) [virtual]

Allocates and returns a new EggJointData structure for the given character.

This is primarily intended as a hook so derived classes can customize the type of EggJointData nodes used to represent the joint hierarchy.

Definition at line 166 of file eggCharacterCollection.cxx.

EggSliderData * EggCharacterCollection::make_slider_data ( EggCharacterData char_data) [virtual]

Allocates and returns a new EggSliderData structure for the given character.

This is primarily intended as a hook so derived classes can customize the type of EggSliderData nodes used to represent the slider list.

Definition at line 180 of file eggCharacterCollection.cxx.

Referenced by EggCharacterData::make_slider().

void EggCharacterCollection::rename_char ( int  i,
const string &  name 
)

Renames the ith character to the indicated name.

This name must not already be used by another character in the collection.

Definition at line 671 of file eggCharacterCollection.cxx.

References get_character_by_name().


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