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