29 #ifndef ANIMATION_PLAYER_H 30 #define ANIMATION_PLAYER_H 33 #include "scene/resources/animation.h" 34 #include "scene/3d/spatial.h" 35 #include "scene/3d/skeleton.h" 36 #include "scene/main/misc.h" 37 #include "scene/2d/node_2d.h" 44 OBJ_CATEGORY(
"Animation Nodes");
48 enum AnimationProcessMode {
49 ANIMATION_PROCESS_FIXED,
50 ANIMATION_PROCESS_IDLE,
57 NODE_CACHE_UPDATE_MAX=1024,
62 enum SpecialProperty {
69 struct TrackNodeCache {
88 TrackNodeCache *owner;
89 SpecialProperty special;
100 TrackNodeCache() { skeleton=NULL; spatial=NULL; node=NULL; accum_pass=0; bone_idx=-1; node_2d=NULL; }
104 struct TrackNodeCacheKey {
109 inline bool operator<(
const TrackNodeCacheKey& p_right)
const {
113 else if (
id>p_right.id)
116 return bone_idx<p_right.bone_idx;
122 TrackNodeCache* cache_update[NODE_CACHE_UPDATE_MAX];
123 int cache_update_size;
125 int cache_update_prop_size;
130 float default_blend_time;
133 struct AnimationData {
146 bool operator<(
const BlendKey& bk)
const {
return from==bk.from?to<bk.to:from<bk.from; }
153 struct PlaybackData {
186 PlaybackData current;
195 AnimationProcessMode animation_process_mode;
201 void _animation_process_animation(AnimationData* p_anim,
float p_time,
float p_delta,
float p_interp,
bool p_allow_discrete=
true);
203 void _generate_node_caches(AnimationData* p_anim);
204 void _animation_process_data(PlaybackData &cd,
float p_delta,
float p_blend);
205 void _animation_process2(
float p_delta);
206 void _animation_update_transforms();
207 void _animation_process(
float p_delta);
209 void _node_removed(
Node *p_node);
215 get_animation_list(&animations);
217 while(animations.size()) {
219 ret.push_back( animations.
front()->get());
220 animations.pop_front();
225 void _animation_changed();
230 void _set_process(
bool p_process,
bool p_force=
false);
238 void _notification(
int p_what);
240 static void _bind_methods();
247 void remove_animation(
const StringName& p_name);
249 bool has_animation(
const StringName& p_name)
const;
253 void set_blend_time(
const StringName& p_animation1,
const StringName& p_animation2,
float p_time);
259 void set_default_blend_time(
float p_default);
260 float get_default_blend_time()
const;
262 void play(
const StringName& p_name=
StringName(),
float p_custom_blend=-1,
float p_custom_scale=1.0,
bool p_from_end=
false);
266 void stop(
bool p_reset=
true);
267 bool is_playing()
const;
268 String get_current_animation()
const;
269 void set_current_animation(
const String& p_anim);
271 void set_active(
bool p_active);
272 bool is_active()
const;
273 bool is_valid()
const;
275 void set_speed(
float p_speed);
276 float get_speed()
const;
278 void set_autoplay(
const String& pname);
279 String get_autoplay()
const;
281 void set_animation_process_mode(AnimationProcessMode p_mode);
282 AnimationProcessMode get_animation_process_mode()
const;
284 void seek(
float p_time,
bool p_update=
false);
285 void seek_delta(
float p_time,
float p_delta);
286 float get_current_animation_pos()
const;
287 float get_current_animation_length()
const;
289 void advance(
float p_time);
291 void set_root(
const NodePath& p_root);
305 VARIANT_ENUM_CAST( AnimationPlayer::AnimationProcessMode );
Definition: animation_player.h:86
void clear_caches()
must be called by hand if an animation was modified after added
Definition: animation_player.cpp:1152
_FORCE_INLINE_ const Element * front() const
Definition: list.h:189
Definition: string_db.h:48
Definition: skeleton.h:38
Definition: animation_player.h:42