00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef ANIMCONTROLCOLLECTION_H
00016 #define ANIMCONTROLCOLLECTION_H
00017
00018 #include "pandabase.h"
00019
00020 #include "animControl.h"
00021
00022 #include "event.h"
00023 #include "pt_Event.h"
00024
00025 #include "pmap.h"
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 class EXPCL_PANDA_CHAN AnimControlCollection {
00038 PUBLISHED:
00039 AnimControlCollection();
00040 ~AnimControlCollection();
00041
00042 void store_anim(AnimControl *control, const string &name);
00043 AnimControl *find_anim(const string &name) const;
00044 bool unbind_anim(const string &name);
00045
00046 int get_num_anims() const;
00047 AnimControl *get_anim(int n) const;
00048 string get_anim_name(int n) const;
00049 MAKE_SEQ(get_anims, get_num_anims, get_anim);
00050 MAKE_SEQ(get_anim_names, get_num_anims, get_anim_name);
00051
00052 void clear_anims();
00053
00054
00055
00056
00057 INLINE bool play(const string &anim_name);
00058 INLINE bool play(const string &anim_name, int from, int to);
00059 INLINE bool loop(const string &anim_name, bool restart);
00060 INLINE bool loop(const string &anim_name, bool restart, int from, int to);
00061 INLINE bool stop(const string &anim_name);
00062 INLINE bool pose(const string &anim_name, int frame);
00063
00064
00065 void play_all();
00066 void play_all(int from, int to);
00067 void loop_all(bool restart);
00068 void loop_all(bool restart, int from, int to);
00069 bool stop_all();
00070 void pose_all(int frame);
00071
00072 INLINE int get_frame(const string &anim_name) const;
00073 INLINE int get_frame() const;
00074
00075 INLINE int get_num_frames(const string &anim_name) const;
00076 INLINE int get_num_frames() const;
00077
00078 INLINE bool is_playing(const string &anim_name) const;
00079 INLINE bool is_playing() const;
00080
00081 string which_anim_playing() const;
00082
00083 void output(ostream &out) const;
00084 void write(ostream &out) const;
00085
00086 private:
00087 class ControlDef {
00088 public:
00089 string _name;
00090 PT(AnimControl) _control;
00091 };
00092 typedef pvector<ControlDef> Controls;
00093 Controls _controls;
00094
00095 typedef pmap<string, size_t> ControlsByName;
00096 ControlsByName _controls_by_name;
00097
00098 AnimControl *_last_started_control;
00099 };
00100
00101 INLINE ostream &operator << (ostream &out, const AnimControlCollection &collection);
00102
00103 #include "animControlCollection.I"
00104
00105 #endif