00001 // Filename: movingPartBase.I 00002 // Created by: drose (22Feb99) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: MovingPartBase::Copy Constructor 00018 // Access: Protected 00019 // Description: Normally, you'd use make_copy() or copy_subgraph() to 00020 // make a copy of this. 00021 //////////////////////////////////////////////////////////////////// 00022 INLINE MovingPartBase:: 00023 MovingPartBase(const MovingPartBase ©) : 00024 PartGroup(copy), 00025 _num_effective_channels(0), 00026 _effective_control(NULL), 00027 _forced_channel(copy._forced_channel) 00028 { 00029 // We don't copy the bound channels. We do copy the forced_channel, 00030 // though this is just a pointerwise copy. 00031 } 00032 00033 //////////////////////////////////////////////////////////////////// 00034 // Function: MovingPartBase::get_max_bound 00035 // Access: Published 00036 // Description: Returns the number of channels that might be bound to 00037 // this PartGroup. This might not be the actual number 00038 // of channels, since there might be holes in the list; 00039 // it is one more than the index number of the highest 00040 // bound channel. Thus, it is called get_max_bound() 00041 // instead of get_num_bound(). 00042 //////////////////////////////////////////////////////////////////// 00043 INLINE int MovingPartBase:: 00044 get_max_bound() const { 00045 return _channels.size(); 00046 } 00047 00048 //////////////////////////////////////////////////////////////////// 00049 // Function: MovingPartBase::get_bound 00050 // Access: Published 00051 // Description: Returns the nth bound channel on this PartGroup. n 00052 // can be determined by iterating from 0 to one less 00053 // than get_max_bound(); or n might be 00054 // AnimControl::get_channel_index(). 00055 // 00056 // This will return NULL if there is no channel bound on 00057 // the indicated index. It is an error to call this if 00058 // n is less than zero or greater than or equal to 00059 // get_max_bound(). 00060 //////////////////////////////////////////////////////////////////// 00061 INLINE AnimChannelBase *MovingPartBase:: 00062 get_bound(int n) const { 00063 nassertr(n >= 0 && n < (int)_channels.size(), NULL); 00064 return _channels[n]; 00065 }