Panda3D

Loading...
Searching...
No Matches
eggCharacterData.I
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 eggCharacterData.I
10 * @author drose
11 * @date 2001-02-23
12 */
13
14/**
15 * Returns the total number of models associated with this character.
16 *
17 * A "model" here is either a character model (or one LOD of a character
18 * model), or a character animation file: in either case, a hierarchy of
19 * joints.
20 */
21INLINE int EggCharacterData::
22 get_num_models() const {
23 return _models.size();
24}
25
26/**
27 * Returns the model_index of the nth model associated with this character.
28 * This model_index may be used to ask questions about the particular model
29 * from the EggCharacterCollection object, or from the individual EggJointData
30 * and EggSliderData objects.
31 *
32 * A "model" here is either a character model (or one LOD of a character
33 * model), or a character animation file: in either case, a hierarchy of
34 * joints.
35 */
36INLINE int EggCharacterData::
37 get_model_index(int n) const {
38 nassertr(n >= 0 && n < (int)_models.size(), 0);
39 return _models[n]._model_index;
40}
41
42/**
43 * Returns the model_root of the nth model associated with this character.
44 *
45 * This is the node at which the character, animation bundle, or LOD
46 * officially began within its particular egg file.
47 */
48INLINE EggNode *EggCharacterData::
49 get_model_root(int n) const {
50 nassertr(n >= 0 && n < (int)_models.size(), nullptr);
51 return _models[n]._model_root;
52}
53
54/**
55 * Returns the EggData representing the egg file that defined this particular
56 * model. Note that one egg file might contain multiple models.
57 */
58INLINE EggData *EggCharacterData::
59 get_egg_data(int n) const {
60 nassertr(n >= 0 && n < (int)_models.size(), nullptr);
61 return _models[n]._egg_data;
62}
63
64/**
65 * Returns the root joint of the character hierarchy. This root joint does
66 * not represent an actual joint in the hierarchy, but instead is a fictitious
67 * joint that is the parent of all the top joints in the hierarchy (since the
68 * hierarchy may actually contain zero or more top joints).
69 */
70INLINE EggJointData *EggCharacterData::
71 get_root_joint() const {
72 return _root_joint;
73}
74
75/**
76 * Returns the first joint found with the indicated name, or NULL if no joint
77 * has that name.
78 */
79INLINE EggJointData *EggCharacterData::
80 find_joint(const std::string &name) const {
81 return _root_joint->find_joint(name);
82}
83
84/**
85 * Creates a new joint as a child of the indicated joint and returns it. The
86 * new joint will be initialized to the identity transform, so that in
87 * inherits the net transform of the indicated parent joint.
88 */
89INLINE EggJointData *EggCharacterData::
90 make_new_joint(const std::string &name, EggJointData *parent) {
91 EggJointData *joint = parent->make_new_joint(name);
92 _joints.push_back(joint);
93 _components.push_back(joint);
94 return joint;
95}
96
97/**
98 * Returns the total number of joints in the character joint hierarchy.
99 */
100INLINE int EggCharacterData::
101 get_num_joints() const {
102 return _joints.size();
103}
104
105/**
106 * Returns the nth joint in the character joint hierarchy. This returns all
107 * of the joints in the hierarchy in an arbitrary ordering.
108 */
109INLINE EggJointData *EggCharacterData::
110 get_joint(int n) const {
111 nassertr(n >= 0 && n < (int)_joints.size(), nullptr);
112 return _joints[n];
113}
114
115/**
116 * Returns the number of sliders in the character slider list.
117 */
118INLINE int EggCharacterData::
119 get_num_sliders() const {
120 return _sliders.size();
121}
122
123/**
124 * Returns the nth slider in the character slider list.
125 */
126INLINE EggSliderData *EggCharacterData::
127 get_slider(int n) const {
128 nassertr(n >= 0 && n < (int)_sliders.size(), nullptr);
129 return _sliders[n];
130}
131
132/**
133 * Returns the total number of joints and sliders in the character.
134 */
135INLINE int EggCharacterData::
136 get_num_components() const {
137 return _components.size();
138}
139
140/**
141 * Returns the nth joint or slider in the character. This can be used to walk
142 * linearly through all joints and sliders in the character when you don't
143 * care about making a distinction between the two; it returns the same
144 * objects that can also be discovered via get_slider() and get_root_joint().
145 */
146INLINE EggComponentData *EggCharacterData::
147 get_component(int n) const {
148 nassertr(n >= 0 && n < (int)_components.size(), nullptr);
149 return _components[n];
150}
EggCharacterData::get_root_joint
EggJointData * get_root_joint() const
Returns the root joint of the character hierarchy.
Definition eggCharacterData.I:71
EggCharacterData::get_model_index
int get_model_index(int n) const
Returns the model_index of the nth model associated with this character.
Definition eggCharacterData.I:37
EggCharacterData::get_num_components
int get_num_components() const
Returns the total number of joints and sliders in the character.
Definition eggCharacterData.I:136
EggCharacterData::get_num_sliders
int get_num_sliders() const
Returns the number of sliders in the character slider list.
Definition eggCharacterData.I:119
EggCharacterData::get_egg_data
EggData * get_egg_data(int n) const
Returns the EggData representing the egg file that defined this particular model.
Definition eggCharacterData.I:59
EggCharacterData::get_joint
EggJointData * get_joint(int n) const
Returns the nth joint in the character joint hierarchy.
Definition eggCharacterData.I:110
EggCharacterData::make_new_joint
EggJointData * make_new_joint(const std::string &name, EggJointData *parent)
Creates a new joint as a child of the indicated joint and returns it.
Definition eggCharacterData.I:90
EggCharacterData::get_model_root
EggNode * get_model_root(int n) const
Returns the model_root of the nth model associated with this character.
Definition eggCharacterData.I:49
EggCharacterData::get_slider
EggSliderData * get_slider(int n) const
Returns the nth slider in the character slider list.
Definition eggCharacterData.I:127
EggCharacterData::get_num_models
int get_num_models() const
Returns the total number of models associated with this character.
Definition eggCharacterData.I:22
EggCharacterData::get_num_joints
int get_num_joints() const
Returns the total number of joints in the character joint hierarchy.
Definition eggCharacterData.I:101
EggCharacterData::get_component
EggComponentData * get_component(int n) const
Returns the nth joint or slider in the character.
Definition eggCharacterData.I:147
EggCharacterData::find_joint
EggJointData * find_joint(const std::string &name) const
Returns the first joint found with the indicated name, or NULL if no joint has that name.
Definition eggCharacterData.I:80
EggComponentData
This is the base class of both EggJointData and EggSliderData.
Definition eggComponentData.h:34
EggData
This is the primary interface into all the egg data, and the root of the egg file structure.
Definition eggData.h:37
EggJointData
This is one node of a hierarchy of EggJointData nodes, each of which represents a single joint of the...
Definition eggJointData.h:31
EggJointData::find_joint
EggJointData * find_joint(const std::string &name)
Returns the first descendent joint found with the indicated name, or NULL if no joint has that name.
Definition eggJointData.I:44
EggNode
A base class for things that may be directly added into the egg hierarchy.
Definition eggNode.h:36
EggSliderData
This corresponds to a single morph slider control.
Definition eggSliderData.h:28