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 */
22get_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 */
37get_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 */
49get_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 */
59get_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 */
71get_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 */
80find_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 */
90make_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 */
101get_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 */
110get_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 */
119get_num_sliders() const {
120 return _sliders.size();
121}
122
123/**
124 * Returns the nth slider in the character slider list.
125 */
127get_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 */
136get_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 */
147get_component(int n) const {
148 nassertr(n >= 0 && n < (int)_components.size(), nullptr);
149 return _components[n];
150}
EggJointData * get_root_joint() const
Returns the root joint of the character hierarchy.
int get_model_index(int n) const
Returns the model_index of the nth model associated with this character.
int get_num_components() const
Returns the total number of joints and sliders in the character.
int get_num_sliders() const
Returns the number of sliders in the character slider list.
EggData * get_egg_data(int n) const
Returns the EggData representing the egg file that defined this particular model.
EggJointData * get_joint(int n) const
Returns the nth joint in the character joint hierarchy.
EggJointData * make_new_joint(const std::string &name, EggJointData *parent)
Creates a new joint as a child of the indicated joint and returns it.
EggNode * get_model_root(int n) const
Returns the model_root of the nth model associated with this character.
EggSliderData * get_slider(int n) const
Returns the nth slider in the character slider list.
int get_num_models() const
Returns the total number of models associated with this character.
int get_num_joints() const
Returns the total number of joints in the character joint hierarchy.
EggComponentData * get_component(int n) const
Returns the nth joint or slider in the character.
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.
This is the base class of both EggJointData and EggSliderData.
This is the primary interface into all the egg data, and the root of the egg file structure.
Definition eggData.h:37
This is one node of a hierarchy of EggJointData nodes, each of which represents a single joint of the...
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.
A base class for things that may be directly added into the egg hierarchy.
Definition eggNode.h:36
This corresponds to a single morph slider control.