Panda3D
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
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"

Classes

class  EggInfo
 

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. More...
 
void check_errors (std::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. More...
 
EggCharacterDataget_character (int i) const
 Returns the ith character in the collection. More...
 
EggCharacterDataget_character_by_model_index (int model_index) const
 Returns the character associated with the indicated model index. More...
 
EggCharacterDataget_character_by_name (const std::string &character_name) const
 Returns the Character with the indicated name, if it exists in the collection, or NULL if it does not. More...
 
EggDataget_egg (int i) const
 Returns the ith egg file. More...
 
int get_first_model_index (int egg_index) const
 Returns the first model index associated with the indicated egg file. More...
 
int get_num_characters () const
 Returns the number of separate Characters that have been discovered in the various egg files added to the collection. More...
 
int get_num_eggs () const
 Returns the number of egg files that have successfully been added to the Character table. More...
 
int get_num_models (int egg_index) const
 Returns the number of different models found in the indicated egg file. More...
 
EggCharacterDatamake_character (const std::string &character_name)
 Allocates and returns a new EggCharacterData object representing the named character, if there is not already a character by that name. More...
 
virtual EggCharacterDatamake_character_data ()
 Allocates and returns a new EggCharacterData structure. More...
 
virtual EggJointDatamake_joint_data (EggCharacterData *char_data)
 Allocates and returns a new EggJointData structure for the given character. More...
 
virtual EggSliderDatamake_slider_data (EggCharacterData *char_data)
 Allocates and returns a new EggSliderData structure for the given character. More...
 
void rename_char (int i, const std::string &name)
 Renames the ith character to the indicated name. More...
 
virtual void write (std::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 32 of file eggCharacterCollection.h.

Member Function Documentation

◆ add_egg()

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 67 of file eggCharacterCollection.cxx.

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

◆ check_errors()

void EggCharacterCollection::check_errors ( std::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 651 of file eggCharacterCollection.cxx.

References EggCharacterData::check_num_frames(), EggJointData::force_initial_rest_frame(), 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().

◆ get_character()

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

Returns the ith character in the collection.

Definition at line 73 of file eggCharacterCollection.I.

◆ get_character_by_model_index()

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

Returns the character associated with the indicated model index.

Definition at line 82 of file eggCharacterCollection.I.

◆ get_character_by_name()

EggCharacterData * EggCharacterCollection::get_character_by_name ( const std::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 121 of file eggCharacterCollection.cxx.

◆ get_egg()

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

Returns the ith egg file.

Definition at line 27 of file eggCharacterCollection.I.

◆ get_first_model_index()

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 41 of file eggCharacterCollection.I.

◆ get_num_characters()

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 65 of file eggCharacterCollection.I.

◆ get_num_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 19 of file eggCharacterCollection.I.

◆ get_num_models()

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 55 of file eggCharacterCollection.I.

◆ make_character()

EggCharacterData * EggCharacterCollection::make_character ( const std::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 170 of file eggCharacterCollection.cxx.

References make_character_data().

Referenced by add_egg().

◆ make_character_data()

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 140 of file eggCharacterCollection.cxx.

Referenced by make_character().

◆ make_joint_data()

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 150 of file eggCharacterCollection.cxx.

◆ make_slider_data()

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 161 of file eggCharacterCollection.cxx.

Referenced by EggCharacterData::make_slider().

◆ rename_char()

void EggCharacterCollection::rename_char ( int  i,
const std::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 617 of file eggCharacterCollection.cxx.


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