Panda3D
animControl.I
1 // Filename: animControl.I
2 // Created by: drose (19Feb99)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: AnimControl::is_pending
18 // Access: Published
19 // Description: Returns true if the AnimControl is being bound
20 // asynchronously, and has not yet finished. If this is
21 // true, the AnimControl's interface is still available
22 // and will be perfectly useful (though get_anim() might
23 // return NULL), but nothing visible will happen
24 // immediately.
25 ////////////////////////////////////////////////////////////////////
26 INLINE bool AnimControl::
27 is_pending() const {
28  return _pending;
29 }
30 
31 ////////////////////////////////////////////////////////////////////
32 // Function: AnimControl::has_anim
33 // Access: Published
34 // Description: Returns true if the AnimControl was successfully
35 // loaded, or false if there was a problem. This may
36 // return false while is_pending() is true.
37 ////////////////////////////////////////////////////////////////////
38 INLINE bool AnimControl::
39 has_anim() const {
40  return (_anim != (AnimBundle *)NULL);
41 }
42 
43 ////////////////////////////////////////////////////////////////////
44 // Function: AnimControl::get_anim
45 // Access: Published
46 // Description: Returns the AnimBundle bound in with this
47 // AnimControl.
48 ////////////////////////////////////////////////////////////////////
50 get_anim() const {
51  return _anim;
52 }
53 
54 ////////////////////////////////////////////////////////////////////
55 // Function: AnimControl::get_channel_index
56 // Access: Published
57 // Description: Returns the particular channel index associated with
58 // this AnimControl. This channel index is the slot on
59 // which each AnimGroup is bound to its associated
60 // PartGroup, for each joint in the animation.
61 //
62 // It will be true that
63 // get_part()->find_child("n")->get_bound(get_channel_index())
64 // == get_anim()->find_child("n"), for each joint "n".
65 ////////////////////////////////////////////////////////////////////
66 INLINE int AnimControl::
68  return _channel_index;
69 }
70 
71 ////////////////////////////////////////////////////////////////////
72 // Function: AnimControl::get_bound_joints
73 // Access: Published
74 // Description: Returns the subset of joints controlled by this
75 // AnimControl. Most of the time, this will be
76 // BitArray::all_on(), for a normal full-body animation.
77 // For a subset animation, however, this will be just a
78 // subset of those bits, corresponding to the set of
79 // joints and sliders actually bound (as enumerated by
80 // bind_hierarchy() in depth-first LIFO order).
81 ////////////////////////////////////////////////////////////////////
82 INLINE const BitArray &AnimControl::
84  return _bound_joints;
85 }
86 
87 ////////////////////////////////////////////////////////////////////
88 // Function: AnimControl::set_anim_model
89 // Access: Published
90 // Description: Associates the indicated PandaNode with the
91 // AnimControl. By convention, this node represents the
92 // root node of the model file that corresponds to this
93 // AnimControl's animation file, though nothing in this
94 // code makes this assumption or indeed does anything
95 // with this node.
96 //
97 // The purpose of this is simply to allow the
98 // AnimControl to keep a reference count on the
99 // ModelRoot node that generated it, so that the model
100 // will not disappear from the model pool until it is no
101 // longer referenced.
102 ////////////////////////////////////////////////////////////////////
103 INLINE void AnimControl::
105  _anim_model = model;
106 }
107 
108 ////////////////////////////////////////////////////////////////////
109 // Function: AnimControl::get_anim_model
110 // Access: Published
111 // Description: Retrieves the pointer set via set_anim_model(). See
112 // set_anim_model().
113 ////////////////////////////////////////////////////////////////////
114 INLINE PandaNode *AnimControl::
115 get_anim_model() const {
116  return _anim_model;
117 }
118 
119 INLINE ostream &
120 operator << (ostream &out, const AnimControl &control) {
121  control.output(out);
122  return out;
123 }
A basic node of the scene graph or data graph.
Definition: pandaNode.h:72
const BitArray & get_bound_joints() const
Returns the subset of joints controlled by this AnimControl.
Definition: animControl.I:83
This is the root of an AnimChannel hierarchy.
Definition: animBundle.h:31
AnimBundle * get_anim() const
Returns the AnimBundle bound in with this AnimControl.
Definition: animControl.I:50
A dynamic array with an unlimited number of bits.
Definition: bitArray.h:42
bool has_anim() const
Returns true if the AnimControl was successfully loaded, or false if there was a problem.
Definition: animControl.I:39
PandaNode * get_anim_model() const
Retrieves the pointer set via set_anim_model().
Definition: animControl.I:115
int get_channel_index() const
Returns the particular channel index associated with this AnimControl.
Definition: animControl.I:67
Controls the timing of a character animation.
Definition: animControl.h:41
bool is_pending() const
Returns true if the AnimControl is being bound asynchronously, and has not yet finished.
Definition: animControl.I:27
void set_anim_model(PandaNode *model)
Associates the indicated PandaNode with the AnimControl.
Definition: animControl.I:104