00001 // Filename: animControl.I 00002 // Created by: drose (19Feb99) 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: AnimControl::is_pending 00018 // Access: Published 00019 // Description: Returns true if the AnimControl is being bound 00020 // asynchronously, and has not yet finished. If this is 00021 // true, the AnimControl's interface is still available 00022 // and will be perfectly useful (though get_anim() might 00023 // return NULL), but nothing visible will happen 00024 // immediately. 00025 //////////////////////////////////////////////////////////////////// 00026 INLINE bool AnimControl:: 00027 is_pending() const { 00028 return _pending; 00029 } 00030 00031 //////////////////////////////////////////////////////////////////// 00032 // Function: AnimControl::has_anim 00033 // Access: Published 00034 // Description: Returns true if the AnimControl was successfully 00035 // loaded, or false if there was a problem. This may 00036 // return false while is_pending() is true. 00037 //////////////////////////////////////////////////////////////////// 00038 INLINE bool AnimControl:: 00039 has_anim() const { 00040 return (_anim != (AnimBundle *)NULL); 00041 } 00042 00043 //////////////////////////////////////////////////////////////////// 00044 // Function: AnimControl::get_anim 00045 // Access: Published 00046 // Description: Returns the AnimBundle bound in with this 00047 // AnimControl. 00048 //////////////////////////////////////////////////////////////////// 00049 INLINE AnimBundle *AnimControl:: 00050 get_anim() const { 00051 return _anim; 00052 } 00053 00054 //////////////////////////////////////////////////////////////////// 00055 // Function: AnimControl::get_channel_index 00056 // Access: Published 00057 // Description: Returns the particular channel index associated with 00058 // this AnimControl. This channel index is the slot on 00059 // which each AnimGroup is bound to its associated 00060 // PartGroup, for each joint in the animation. 00061 // 00062 // It will be true that 00063 // get_part()->find_child("n")->get_bound(get_channel_index()) 00064 // == get_anim()->find_child("n"), for each joint "n". 00065 //////////////////////////////////////////////////////////////////// 00066 INLINE int AnimControl:: 00067 get_channel_index() const { 00068 return _channel_index; 00069 } 00070 00071 //////////////////////////////////////////////////////////////////// 00072 // Function: AnimControl::get_bound_joints 00073 // Access: Published 00074 // Description: Returns the subset of joints controlled by this 00075 // AnimControl. Most of the time, this will be 00076 // BitArray::all_on(), for a normal full-body animation. 00077 // For a subset animation, however, this will be just a 00078 // subset of those bits, corresponding to the set of 00079 // joints and sliders actually bound (as enumerated by 00080 // bind_hierarchy() in depth-first LIFO order). 00081 //////////////////////////////////////////////////////////////////// 00082 INLINE const BitArray &AnimControl:: 00083 get_bound_joints() const { 00084 return _bound_joints; 00085 } 00086 00087 //////////////////////////////////////////////////////////////////// 00088 // Function: AnimControl::set_anim_model 00089 // Access: Published 00090 // Description: Associates the indicated PandaNode with the 00091 // AnimControl. By convention, this node represents the 00092 // root node of the model file that corresponds to this 00093 // AnimControl's animation file, though nothing in this 00094 // code makes this assumption or indeed does anything 00095 // with this node. 00096 // 00097 // The purpose of this is simply to allow the 00098 // AnimControl to keep a reference count on the 00099 // ModelRoot node that generated it, so that the model 00100 // will not disappear from the model pool until it is no 00101 // longer referenced. 00102 //////////////////////////////////////////////////////////////////// 00103 INLINE void AnimControl:: 00104 set_anim_model(PandaNode *model) { 00105 _anim_model = model; 00106 } 00107 00108 //////////////////////////////////////////////////////////////////// 00109 // Function: AnimControl::get_anim_model 00110 // Access: Published 00111 // Description: Retrieves the pointer set via set_anim_model(). See 00112 // set_anim_model(). 00113 //////////////////////////////////////////////////////////////////// 00114 INLINE PandaNode *AnimControl:: 00115 get_anim_model() const { 00116 return _anim_model; 00117 } 00118 00119 INLINE ostream & 00120 operator << (ostream &out, const AnimControl &control) { 00121 control.output(out); 00122 return out; 00123 }