Panda3D
movingPartBase.I
1 // Filename: movingPartBase.I
2 // Created by: drose (22Feb99)
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: MovingPartBase::Copy Constructor
18 // Access: Protected
19 // Description: Normally, you'd use make_copy() or copy_subgraph() to
20 // make a copy of this.
21 ////////////////////////////////////////////////////////////////////
22 INLINE MovingPartBase::
23 MovingPartBase(const MovingPartBase &copy) :
24  PartGroup(copy),
25  _num_effective_channels(0),
26  _effective_control(NULL),
27  _forced_channel(copy._forced_channel)
28 {
29  // We don't copy the bound channels. We do copy the forced_channel,
30  // though this is just a pointerwise copy.
31 }
32 
33 ////////////////////////////////////////////////////////////////////
34 // Function: MovingPartBase::get_max_bound
35 // Access: Published
36 // Description: Returns the number of channels that might be bound to
37 // this PartGroup. This might not be the actual number
38 // of channels, since there might be holes in the list;
39 // it is one more than the index number of the highest
40 // bound channel. Thus, it is called get_max_bound()
41 // instead of get_num_bound().
42 ////////////////////////////////////////////////////////////////////
43 INLINE int MovingPartBase::
44 get_max_bound() const {
45  return _channels.size();
46 }
47 
48 ////////////////////////////////////////////////////////////////////
49 // Function: MovingPartBase::get_bound
50 // Access: Published
51 // Description: Returns the nth bound channel on this PartGroup. n
52 // can be determined by iterating from 0 to one less
53 // than get_max_bound(); or n might be
54 // AnimControl::get_channel_index().
55 //
56 // This will return NULL if there is no channel bound on
57 // the indicated index. It is an error to call this if
58 // n is less than zero or greater than or equal to
59 // get_max_bound().
60 ////////////////////////////////////////////////////////////////////
62 get_bound(int n) const {
63  nassertr(n >= 0 && n < (int)_channels.size(), NULL);
64  return _channels[n];
65 }
This is the base class for a single animatable piece that may be bound to one channel (or more...
Parent class for all animation channels.
int get_max_bound() const
Returns the number of channels that might be bound to this PartGroup.
AnimChannelBase * get_bound(int n) const
Returns the nth bound channel on this PartGroup.
This is the base class for PartRoot and MovingPart.
Definition: partGroup.h:45