Panda3D
Loading...
Searching...
No Matches
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.
 
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.
 
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 std::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 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.
 
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 std::string &name)
 Renames the ith character to the indicated name.
 
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 Typedef Documentation

◆ Characters

Definition at line 73 of file eggCharacterCollection.h.

◆ Eggs

Definition at line 70 of file eggCharacterCollection.h.

Constructor & Destructor Documentation

◆ EggCharacterCollection()

EggCharacterCollection::EggCharacterCollection ( )

Definition at line 38 of file eggCharacterCollection.cxx.

◆ ~EggCharacterCollection()

EggCharacterCollection::~EggCharacterCollection ( )
virtual

Definition at line 46 of file eggCharacterCollection.cxx.

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

References EggJointData::add_back_pointer(), 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 650 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 72 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 81 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 120 of file eggCharacterCollection.cxx.

Referenced by rename_char().

◆ get_egg()

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

Returns the ith egg file.

Definition at line 26 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 40 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 64 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 18 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 54 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 169 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 139 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 149 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 160 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 616 of file eggCharacterCollection.cxx.

References get_character_by_name(), and EggCharacterData::rename_char().

◆ write()

void EggCharacterCollection::write ( std::ostream & out,
int indent_level = 0 ) const
virtual

Definition at line 630 of file eggCharacterCollection.cxx.

Member Data Documentation

◆ _characters

Characters EggCharacterCollection::_characters

Definition at line 74 of file eggCharacterCollection.h.

◆ _characters_by_model_index

Characters EggCharacterCollection::_characters_by_model_index

Definition at line 75 of file eggCharacterCollection.h.

◆ _eggs

Eggs EggCharacterCollection::_eggs

Definition at line 71 of file eggCharacterCollection.h.


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