Panda3D

Loading...
Searching...
No Matches
eggComponentData.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file eggComponentData.h
10 * @author drose
11 * @date 2001-02-26
12 */
13
14#ifndef EGGCOMPONENTDATA_H
15#define EGGCOMPONENTDATA_H
16
17#include "pandatoolbase.h"
18
19#include "eggObject.h"
20#include "namable.h"
21#include "pset.h"
22
23 class EggCharacterCollection;
24 class EggCharacterData;
25 class EggBackPointer;
26 class NameUniquifier;
27
28/**
29 * This is the base class of both EggJointData and EggSliderData. It
30 * represents a single component of a character, either a joint or a slider,
31 * along with back pointers to the references to this component in all model
32 * and animation egg files read.
33 */
34 class EggComponentData : public EggObject, public Namable {
35 public:
36 EggComponentData(EggCharacterCollection *collection,
37 EggCharacterData *char_data);
38 virtual ~EggComponentData();
39
40 void add_name(const std::string &name, NameUniquifier &uniquifier);
41 bool matches_name(const std::string &name) const;
42
43 int get_num_frames(int model_index) const;
44 void extend_to(int model_index, int num_frames) const;
45 double get_frame_rate(int model_index) const;
46
47 virtual void add_back_pointer(int model_index, EggObject *egg_object)=0;
48 virtual void write(std::ostream &out, int indent_level = 0) const=0;
49
50 INLINE int get_num_models() const;
51 INLINE bool has_model(int model_index) const;
52 INLINE EggBackPointer *get_model(int model_index) const;
53 void set_model(int model_index, EggBackPointer *back);
54
55 protected:
56
57 // This points back to all the egg structures that reference this particular
58 // table or slider.
59 typedef pvector<EggBackPointer *> BackPointers;
60 BackPointers _back_pointers;
61
62 typedef pset<std::string> Names;
63 Names _names;
64
65 EggCharacterCollection *_collection;
66 EggCharacterData *_char_data;
67
68
69 public:
70 static TypeHandle get_class_type() {
71 return _type_handle;
72 }
73 static void init_type() {
74 EggObject::init_type();
75 register_type(_type_handle, "EggComponentData",
76 EggObject::get_class_type());
77 }
78 virtual TypeHandle get_type() const {
79 return get_class_type();
80 }
81 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
82
83 private:
84 static TypeHandle _type_handle;
85};
86
87#include "eggComponentData.I"
88
89#endif
EggBackPointer
This stores a pointer from an EggJointData or EggSliderData object back to the referencing data in an...
Definition eggBackPointer.h:31
EggCharacterCollection
Represents a set of characters, as read and collected from possibly several model and/or animation eg...
Definition eggCharacterCollection.h:32
EggCharacterData
Represents a single character, as read and collected from several models and animation files.
Definition eggCharacterData.h:52
EggComponentData::extend_to
void extend_to(int model_index, int num_frames) const
Extends the number of frames in the indicated model (presumably an animation table model) to the give...
Definition eggComponentData.cxx:99
EggComponentData::get_num_frames
int get_num_frames(int model_index) const
Returns the number of frames of animation for this particular component in the indicated model.
Definition eggComponentData.cxx:86
EggComponentData::add_name
void add_name(const std::string &name, NameUniquifier &uniquifier)
Adds the indicated name to the set of names that this component can be identified with.
Definition eggComponentData.cxx:56
EggComponentData::get_model
EggBackPointer * get_model(int model_index) const
Returns the back pointer to an egg file for the indicated model if it exists, or NULL if it does not.
Definition eggComponentData.I:42
EggComponentData::get_num_models
int get_num_models() const
Returns the maximum number of back pointers this component may have.
Definition eggComponentData.I:21
EggComponentData::matches_name
bool matches_name(const std::string &name) const
Returns true if the indicated name matches any name that was ever matched with this particular joint,...
Definition eggComponentData.cxx:74
EggComponentData::get_frame_rate
double get_frame_rate(int model_index) const
Returns the number of frames of animation for this particular component in the indicated model.
Definition eggComponentData.cxx:110
EggComponentData::has_model
bool has_model(int model_index) const
Returns true if the component has a back pointer to an egg file somewhere for the indicated model,...
Definition eggComponentData.I:30
EggComponentData::set_model
void set_model(int model_index, EggBackPointer *back)
Sets the back_pointer associated with the given model_index.
Definition eggComponentData.cxx:122
NameUniquifier
A handy class for converting a list of arbitrary names (strings) so that each name is guaranteed to b...
Definition nameUniquifier.h:28
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
eggComponentData.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
eggObject.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
namable.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandatoolbase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pset.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition register_type.I:22