Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/scene/animation/animation_player.cpp
20960 views
1
/**************************************************************************/
2
/* animation_player.cpp */
3
/**************************************************************************/
4
/* This file is part of: */
5
/* GODOT ENGINE */
6
/* https://godotengine.org */
7
/**************************************************************************/
8
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10
/* */
11
/* Permission is hereby granted, free of charge, to any person obtaining */
12
/* a copy of this software and associated documentation files (the */
13
/* "Software"), to deal in the Software without restriction, including */
14
/* without limitation the rights to use, copy, modify, merge, publish, */
15
/* distribute, sublicense, and/or sell copies of the Software, and to */
16
/* permit persons to whom the Software is furnished to do so, subject to */
17
/* the following conditions: */
18
/* */
19
/* The above copyright notice and this permission notice shall be */
20
/* included in all copies or substantial portions of the Software. */
21
/* */
22
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29
/**************************************************************************/
30
31
#include "animation_player.h"
32
#include "animation_player.compat.inc"
33
34
#include "core/config/engine.h"
35
36
bool AnimationPlayer::_set(const StringName &p_name, const Variant &p_value) {
37
String name = p_name;
38
if (name.begins_with("playback/play")) { // For backward compatibility.
39
set_current_animation(p_value);
40
} else if (name.begins_with("next/")) {
41
String which = name.get_slicec('/', 1);
42
animation_set_next(which, p_value);
43
} else if (p_name == SceneStringName(blend_times)) {
44
Array array = p_value;
45
int len = array.size();
46
ERR_FAIL_COND_V(len % 3, false);
47
48
for (int i = 0; i < len / 3; i++) {
49
StringName from = array[i * 3 + 0];
50
StringName to = array[i * 3 + 1];
51
float time = array[i * 3 + 2];
52
set_blend_time(from, to, time);
53
}
54
#ifndef DISABLE_DEPRECATED
55
} else if (p_name == "method_call_mode") {
56
set_callback_mode_method(static_cast<AnimationCallbackModeMethod>((int)p_value));
57
} else if (p_name == "playback_process_mode") {
58
set_callback_mode_process(static_cast<AnimationCallbackModeProcess>((int)p_value));
59
} else if (p_name == "playback_active") {
60
set_active(p_value);
61
#endif // DISABLE_DEPRECATED
62
} else {
63
return false;
64
}
65
return true;
66
}
67
68
bool AnimationPlayer::_get(const StringName &p_name, Variant &r_ret) const {
69
String name = p_name;
70
71
if (name == "playback/play") { // For backward compatibility.
72
73
r_ret = get_current_animation();
74
75
} else if (name.begins_with("next/")) {
76
String which = name.get_slicec('/', 1);
77
r_ret = animation_get_next(which);
78
79
} else if (p_name == SceneStringName(blend_times)) {
80
Vector<BlendKey> keys;
81
for (const KeyValue<BlendKey, double> &E : blend_times) {
82
keys.ordered_insert(E.key);
83
}
84
85
Array array;
86
for (int i = 0; i < keys.size(); i++) {
87
array.push_back(keys[i].from);
88
array.push_back(keys[i].to);
89
array.push_back(blend_times.get(keys[i]));
90
}
91
92
r_ret = array;
93
#ifndef DISABLE_DEPRECATED
94
} else if (name == "method_call_mode") {
95
r_ret = get_callback_mode_method();
96
} else if (name == "playback_process_mode") {
97
r_ret = get_callback_mode_process();
98
} else if (name == "playback_active") {
99
r_ret = is_active();
100
#endif // DISABLE_DEPRECATED
101
} else {
102
return false;
103
}
104
105
return true;
106
}
107
108
void AnimationPlayer::_validate_property(PropertyInfo &p_property) const {
109
if (Engine::get_singleton()->is_editor_hint() && p_property.name == "current_animation") {
110
List<String> names;
111
112
for (const KeyValue<StringName, AnimationData> &E : animation_set) {
113
names.push_back(E.key);
114
}
115
names.push_front("[stop]");
116
String hint;
117
for (List<String>::Element *E = names.front(); E; E = E->next()) {
118
if (E != names.front()) {
119
hint += ",";
120
}
121
hint += E->get();
122
}
123
124
p_property.hint_string = hint;
125
} else if (!auto_capture && p_property.name.begins_with("playback_auto_capture_")) {
126
p_property.usage = PROPERTY_USAGE_NONE;
127
}
128
}
129
130
void AnimationPlayer::_get_property_list(List<PropertyInfo> *p_list) const {
131
List<PropertyInfo> anim_names;
132
133
for (const KeyValue<StringName, AnimationData> &E : animation_set) {
134
AHashMap<StringName, StringName>::ConstIterator F = animation_next_set.find(E.key);
135
if (F && F->value != StringName()) {
136
anim_names.push_back(PropertyInfo(Variant::STRING, "next/" + String(E.key), PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL));
137
}
138
}
139
140
for (const PropertyInfo &E : anim_names) {
141
p_list->push_back(E);
142
}
143
144
p_list->push_back(PropertyInfo(Variant::ARRAY, "blend_times", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL));
145
}
146
147
void AnimationPlayer::_notification(int p_what) {
148
switch (p_what) {
149
case NOTIFICATION_READY: {
150
if (!Engine::get_singleton()->is_editor_hint() && animation_set.has(autoplay)) {
151
set_active(active);
152
play(autoplay);
153
_check_immediately_after_start();
154
}
155
} break;
156
}
157
}
158
159
void AnimationPlayer::_process_playback_data(PlaybackData &cd, double p_delta, float p_blend, bool p_seeked, bool p_internal_seeked, bool p_started, bool p_is_current) {
160
double speed = speed_scale * cd.speed_scale;
161
bool backwards = std::signbit(speed); // Negative zero means playing backwards too.
162
double delta = p_started ? 0 : p_delta * speed;
163
double next_pos = cd.pos + delta;
164
165
double start = cd.get_start_time();
166
double end = cd.get_end_time();
167
168
Animation::LoopedFlag looped_flag = Animation::LOOPED_FLAG_NONE;
169
170
switch (cd.from->animation->get_loop_mode()) {
171
case Animation::LOOP_NONE: {
172
if (Animation::is_less_approx(next_pos, start)) {
173
next_pos = start;
174
} else if (Animation::is_greater_approx(next_pos, end)) {
175
next_pos = end;
176
}
177
delta = next_pos - cd.pos; // Fix delta (after determination of backwards because negative zero is lost here).
178
} break;
179
180
case Animation::LOOP_LINEAR: {
181
if (Animation::is_less_approx(next_pos, start) && Animation::is_greater_or_equal_approx(cd.pos, start)) {
182
looped_flag = Animation::LOOPED_FLAG_START;
183
}
184
if (Animation::is_greater_approx(next_pos, end) && Animation::is_less_or_equal_approx(cd.pos, end)) {
185
looped_flag = Animation::LOOPED_FLAG_END;
186
}
187
next_pos = Math::fposmod(next_pos - start, end - start) + start;
188
} break;
189
190
case Animation::LOOP_PINGPONG: {
191
if (Animation::is_less_approx(next_pos, start) && Animation::is_greater_or_equal_approx(cd.pos, start)) {
192
cd.speed_scale *= -1.0;
193
looped_flag = Animation::LOOPED_FLAG_START;
194
}
195
if (Animation::is_greater_approx(next_pos, end) && Animation::is_less_or_equal_approx(cd.pos, end)) {
196
cd.speed_scale *= -1.0;
197
looped_flag = Animation::LOOPED_FLAG_END;
198
}
199
next_pos = Math::pingpong(next_pos - start, end - start) + start;
200
} break;
201
202
default:
203
break;
204
}
205
206
double prev_pos = cd.pos; // The animation may be changed during process, so it is safer that the state is changed before process.
207
208
// End detection.
209
if (p_is_current) {
210
if (cd.from->animation->get_loop_mode() == Animation::LOOP_NONE) {
211
if (!backwards && Animation::is_less_or_equal_approx(prev_pos, end) && Math::is_equal_approx(next_pos, end)) {
212
// Playback finished.
213
next_pos = end; // Snap to the edge.
214
end_reached = true;
215
end_notify = Animation::is_less_approx(prev_pos, end); // Notify only if not already at the end.
216
p_blend = 1.0;
217
}
218
if (backwards && Animation::is_greater_or_equal_approx(prev_pos, start) && Math::is_equal_approx(next_pos, start)) {
219
// Playback finished.
220
next_pos = start; // Snap to the edge.
221
end_reached = true;
222
end_notify = Animation::is_greater_approx(prev_pos, start); // Notify only if not already at the beginning.
223
p_blend = 1.0;
224
}
225
}
226
}
227
228
cd.pos = next_pos;
229
230
PlaybackInfo pi;
231
if (p_started) {
232
pi.time = prev_pos;
233
pi.delta = 0;
234
pi.start = start;
235
pi.end = end;
236
pi.seeked = true;
237
} else {
238
pi.time = next_pos;
239
pi.delta = delta;
240
pi.start = start;
241
pi.end = end;
242
pi.seeked = p_seeked;
243
}
244
if (Math::is_zero_approx(pi.delta) && backwards) {
245
pi.delta = -0.0; // Sign is needed to handle converted Continuous track from Discrete track correctly.
246
}
247
// Immediately after playback, discrete keys should be retrieved with EXACT mode since behind keys must be ignored at that time.
248
pi.is_external_seeking = !p_internal_seeked && !p_started;
249
pi.looped_flag = looped_flag;
250
pi.weight = p_blend;
251
make_animation_instance(cd.from->name, pi);
252
}
253
254
float AnimationPlayer::get_current_blend_amount() {
255
Playback &c = playback;
256
float blend = 1.0;
257
for (const Blend &b : c.blend) {
258
blend = blend - b.blend_left;
259
}
260
return MAX(0, blend);
261
}
262
263
void AnimationPlayer::_blend_playback_data(double p_delta, bool p_started) {
264
Playback &c = playback;
265
266
bool seeked = c.seeked; // The animation may be changed during process, so it is safer that the state is changed before process.
267
bool internal_seeked = c.internal_seeked;
268
269
if (!Math::is_zero_approx(p_delta)) {
270
c.seeked = false;
271
c.internal_seeked = false;
272
}
273
274
// Second, process current animation to check if the animation end reached.
275
_process_playback_data(c.current, p_delta, get_current_blend_amount(), seeked, internal_seeked, p_started, true);
276
277
// Finally, if not end the animation, do blending.
278
if (end_reached) {
279
playback.blend.clear();
280
if (end_notify) {
281
finished_anim = playback.assigned;
282
}
283
return;
284
}
285
List<List<Blend>::Element *> to_erase;
286
for (List<Blend>::Element *E = c.blend.front(); E; E = E->next()) {
287
Blend &b = E->get();
288
b.blend_left = MAX(0, b.blend_left - Math::abs(speed_scale * p_delta) / b.blend_time);
289
if (Animation::is_less_or_equal_approx(b.blend_left, 0)) {
290
to_erase.push_back(E);
291
b.blend_left = CMP_EPSILON; // May want to play last frame.
292
}
293
// Note: There may be issues if an animation event triggers an animation change while this blend is active,
294
// so it is best to use "deferred" calls instead of "immediate" for animation events that can trigger new animations.
295
_process_playback_data(b.data, p_delta, b.blend_left, false, false, false);
296
}
297
for (List<Blend>::Element *&E : to_erase) {
298
c.blend.erase(E);
299
}
300
}
301
302
bool AnimationPlayer::_blend_pre_process(double p_delta, int p_track_count, const AHashMap<NodePath, int> &p_track_map) {
303
if (!playback.current.from) {
304
_set_process(false);
305
return false;
306
}
307
308
tmp_from = playback.current.from->animation->get_instance_id();
309
end_reached = false;
310
end_notify = false;
311
312
finished_anim = StringName();
313
314
bool started = playback.started; // The animation may be changed during process, so it is safer that the state is changed before process.
315
if (playback.started) {
316
playback.started = false;
317
}
318
319
AnimationData *prev_from = playback.current.from;
320
_blend_playback_data(p_delta, started);
321
322
if (prev_from != playback.current.from) {
323
return false; // Animation has been changed in the process (may be caused by method track), abort process.
324
}
325
326
return true;
327
}
328
329
void AnimationPlayer::_blend_capture(double p_delta) {
330
blend_capture(p_delta * Math::abs(speed_scale));
331
}
332
333
void AnimationPlayer::_blend_post_process() {
334
if (end_reached) {
335
// If the method track changes current animation, the animation is not finished.
336
if (tmp_from == playback.current.from->animation->get_instance_id()) {
337
if (playback_queue.size()) {
338
if (!finished_anim.is_empty()) {
339
emit_signal(SceneStringName(animation_finished), finished_anim);
340
}
341
String old = playback.assigned;
342
play(playback_queue.front()->get());
343
String new_name = playback.assigned;
344
playback_queue.pop_front();
345
if (end_notify) {
346
emit_signal(SceneStringName(animation_changed), old, new_name);
347
}
348
} else {
349
_clear_caches();
350
playing = false;
351
_set_process(false);
352
if (end_notify) {
353
if (!finished_anim.is_empty()) {
354
emit_signal(SceneStringName(animation_finished), finished_anim);
355
}
356
emit_signal(SNAME("current_animation_changed"), "");
357
if (movie_quit_on_finish && OS::get_singleton()->has_feature("movie")) {
358
print_line(vformat("Movie Maker mode is enabled. Quitting on animation finish as requested by: %s", get_path()));
359
get_tree()->quit();
360
}
361
}
362
}
363
}
364
end_reached = false;
365
end_notify = false;
366
}
367
tmp_from = ObjectID();
368
}
369
370
void AnimationPlayer::queue(const StringName &p_name) {
371
if (!is_playing()) {
372
play(p_name);
373
} else {
374
playback_queue.push_back(p_name);
375
}
376
}
377
378
TypedArray<StringName> AnimationPlayer::get_queue() {
379
TypedArray<StringName> ret;
380
for (const StringName &E : playback_queue) {
381
ret.push_back(E);
382
}
383
384
return ret;
385
}
386
387
void AnimationPlayer::clear_queue() {
388
playback_queue.clear();
389
}
390
391
void AnimationPlayer::play_backwards(const StringName &p_name, double p_custom_blend) {
392
play(p_name, p_custom_blend, -1, true);
393
}
394
395
void AnimationPlayer::play_section_with_markers_backwards(const StringName &p_name, const StringName &p_start_marker, const StringName &p_end_marker, double p_custom_blend) {
396
play_section_with_markers(p_name, p_start_marker, p_end_marker, p_custom_blend, -1, true);
397
}
398
399
void AnimationPlayer::play_section_backwards(const StringName &p_name, double p_start_time, double p_end_time, double p_custom_blend) {
400
play_section(p_name, p_start_time, p_end_time, p_custom_blend, -1, true);
401
}
402
403
void AnimationPlayer::play(const StringName &p_name, double p_custom_blend, float p_custom_scale, bool p_from_end) {
404
if (auto_capture) {
405
play_with_capture(p_name, auto_capture_duration, p_custom_blend, p_custom_scale, p_from_end, auto_capture_transition_type, auto_capture_ease_type);
406
} else {
407
_play(p_name, p_custom_blend, p_custom_scale, p_from_end);
408
}
409
}
410
411
void AnimationPlayer::_play(const StringName &p_name, double p_custom_blend, float p_custom_scale, bool p_from_end) {
412
play_section_with_markers(p_name, StringName(), StringName(), p_custom_blend, p_custom_scale, p_from_end);
413
}
414
415
void AnimationPlayer::play_section_with_markers(const StringName &p_name, const StringName &p_start_marker, const StringName &p_end_marker, double p_custom_blend, float p_custom_scale, bool p_from_end) {
416
StringName name = p_name;
417
418
if (name == StringName()) {
419
name = playback.assigned;
420
}
421
422
ERR_FAIL_COND_MSG(!animation_set.has(name), vformat("Animation not found: %s.", name));
423
424
Ref<Animation> animation = animation_set[name].animation;
425
426
ERR_FAIL_COND_MSG(p_start_marker == p_end_marker && p_start_marker, vformat("Start marker and end marker cannot be the same marker: %s.", p_start_marker));
427
ERR_FAIL_COND_MSG(p_start_marker && !animation->has_marker(p_start_marker), vformat("Marker %s not found in animation: %s.", p_start_marker, name));
428
ERR_FAIL_COND_MSG(p_end_marker && !animation->has_marker(p_end_marker), vformat("Marker %s not found in animation: %s.", p_end_marker, name));
429
430
double start_time = p_start_marker ? animation->get_marker_time(p_start_marker) : -1;
431
double end_time = p_end_marker ? animation->get_marker_time(p_end_marker) : -1;
432
433
ERR_FAIL_COND_MSG(p_start_marker && p_end_marker && Animation::is_greater_approx(start_time, end_time), vformat("End marker %s is placed earlier than start marker %s in animation: %s.", p_end_marker, p_start_marker, name));
434
435
if (p_start_marker && Animation::is_less_approx(start_time, 0)) {
436
WARN_PRINT_ED(vformat("Negative time start marker: %s is invalid in the section, so the start of the animation: %s is used instead.", p_start_marker, playback.current.from->animation->get_name()));
437
}
438
if (p_end_marker && Animation::is_less_approx(end_time, 0)) {
439
WARN_PRINT_ED(vformat("Negative time end marker: %s is invalid in the section, so the end of the animation: %s is used instead.", p_end_marker, playback.current.from->animation->get_name()));
440
}
441
442
play_section(name, start_time, end_time, p_custom_blend, p_custom_scale, p_from_end);
443
}
444
445
void AnimationPlayer::play_section(const StringName &p_name, double p_start_time, double p_end_time, double p_custom_blend, float p_custom_scale, bool p_from_end) {
446
StringName name = p_name;
447
448
if (name == StringName()) {
449
name = playback.assigned;
450
}
451
452
ERR_FAIL_COND_MSG(!animation_set.has(name), vformat("Animation not found: %s.", name));
453
ERR_FAIL_COND_MSG(p_start_time >= 0 && p_end_time >= 0 && Math::is_equal_approx(p_start_time, p_end_time), "Start time and end time must not equal to each other.");
454
ERR_FAIL_COND_MSG(p_start_time >= 0 && p_end_time >= 0 && Animation::is_greater_approx(p_start_time, p_end_time), vformat("Start time %f is greater than end time %f.", p_start_time, p_end_time));
455
456
Playback &c = playback;
457
458
if (c.current.from) {
459
double blend_time = 0.0;
460
// Find if it can blend.
461
BlendKey bk;
462
bk.from = c.current.from->name;
463
bk.to = name;
464
465
if (Animation::is_greater_or_equal_approx(p_custom_blend, 0)) {
466
blend_time = p_custom_blend;
467
} else if (blend_times.has(bk)) {
468
blend_time = blend_times[bk];
469
} else {
470
bk.from = "*";
471
if (blend_times.has(bk)) {
472
blend_time = blend_times[bk];
473
} else {
474
bk.from = c.current.from->name;
475
bk.to = "*";
476
477
if (blend_times.has(bk)) {
478
blend_time = blend_times[bk];
479
}
480
}
481
}
482
483
if (Animation::is_less_approx(p_custom_blend, 0) && Math::is_zero_approx(blend_time) && default_blend_time) {
484
blend_time = default_blend_time;
485
}
486
if (Animation::is_greater_approx(blend_time, 0)) {
487
Blend b;
488
b.data = c.current;
489
b.blend_left = get_current_blend_amount();
490
b.blend_time = blend_time;
491
c.blend.push_back(b);
492
} else {
493
c.blend.clear();
494
}
495
}
496
497
if (get_current_animation() != p_name) {
498
_clear_playing_caches();
499
}
500
501
c.current.from = &animation_set[name];
502
c.current.speed_scale = p_custom_scale;
503
c.current.start_time = p_start_time;
504
c.current.end_time = p_end_time;
505
506
double start = playback.current.get_start_time();
507
double end = playback.current.get_end_time();
508
509
if (!end_reached) {
510
playback_queue.clear();
511
}
512
513
if (c.assigned != name) { // Reset.
514
c.current.pos = p_from_end ? end : start;
515
c.assigned = name;
516
emit_signal(SNAME("current_animation_changed"), c.assigned);
517
} else {
518
if (p_from_end && Animation::is_less_or_equal_approx(c.current.pos, start)) {
519
// Animation reset but played backwards, set position to the end.
520
seek_internal(end, true, true, true);
521
} else if (!p_from_end && Animation::is_greater_or_equal_approx(c.current.pos, end)) {
522
// Animation resumed but already ended, set position to the beginning.
523
seek_internal(start, true, true, true);
524
} else if (playing) {
525
return;
526
}
527
}
528
529
c.seeked = false;
530
c.started = true;
531
532
_set_process(true); // Always process when starting an animation.
533
playing = true;
534
535
emit_signal(SceneStringName(animation_started), c.assigned);
536
537
if (is_inside_tree() && Engine::get_singleton()->is_editor_hint()) {
538
return; // No next in this case.
539
}
540
541
StringName next = animation_get_next(p_name);
542
if (next != StringName() && animation_set.has(next)) {
543
queue(next);
544
}
545
}
546
547
void AnimationPlayer::_capture(const StringName &p_name, bool p_from_end, double p_duration, Tween::TransitionType p_trans_type, Tween::EaseType p_ease_type) {
548
StringName name = p_name;
549
if (name == StringName()) {
550
name = playback.assigned;
551
}
552
553
Ref<Animation> anim = get_animation(name);
554
if (anim.is_null() || !anim->is_capture_included()) {
555
return;
556
}
557
if (std::signbit(p_duration)) {
558
double max_dur = 0;
559
double current_pos = playback.current.pos;
560
if (playback.assigned != name) {
561
current_pos = p_from_end ? anim->get_length() : 0;
562
}
563
for (int i = 0; i < anim->get_track_count(); i++) {
564
if (anim->track_get_type(i) != Animation::TYPE_VALUE) {
565
continue;
566
}
567
if (anim->value_track_get_update_mode(i) != Animation::UPDATE_CAPTURE) {
568
continue;
569
}
570
if (anim->track_get_key_count(i) == 0) {
571
continue;
572
}
573
max_dur = MAX(max_dur, p_from_end ? current_pos - anim->track_get_key_time(i, anim->track_get_key_count(i) - 1) : anim->track_get_key_time(i, 0) - current_pos);
574
}
575
p_duration = max_dur;
576
}
577
if (Math::is_zero_approx(p_duration)) {
578
return;
579
}
580
capture(name, p_duration, p_trans_type, p_ease_type);
581
}
582
583
void AnimationPlayer::play_with_capture(const StringName &p_name, double p_duration, double p_custom_blend, float p_custom_scale, bool p_from_end, Tween::TransitionType p_trans_type, Tween::EaseType p_ease_type) {
584
_capture(p_name, p_from_end, p_duration, p_trans_type, p_ease_type);
585
_play(p_name, p_custom_blend, p_custom_scale, p_from_end);
586
}
587
588
bool AnimationPlayer::is_playing() const {
589
return playing;
590
}
591
592
void AnimationPlayer::set_current_animation(const StringName &p_animation) {
593
if (p_animation == SNAME("[stop]") || p_animation.is_empty()) {
594
stop();
595
} else if (!is_playing()) {
596
play(p_animation);
597
} else if (playback.assigned != p_animation) {
598
float speed = playback.current.speed_scale;
599
play(p_animation, -1.0, speed, std::signbit(speed));
600
} else {
601
// Same animation, do not replay from start.
602
}
603
}
604
605
StringName AnimationPlayer::get_current_animation() const {
606
return (is_playing() ? playback.assigned : StringName());
607
}
608
609
void AnimationPlayer::set_assigned_animation(const StringName &p_animation) {
610
if (is_playing()) {
611
float speed = playback.current.speed_scale;
612
play(p_animation, -1.0, speed, std::signbit(speed));
613
} else {
614
ERR_FAIL_COND_MSG(!animation_set.has(p_animation), vformat("Animation not found: %s.", p_animation.operator String()));
615
playback.current.pos = 0;
616
playback.current.from = &animation_set[p_animation];
617
playback.current.start_time = -1;
618
playback.current.end_time = -1;
619
playback.assigned = p_animation;
620
emit_signal(SNAME("current_animation_changed"), playback.assigned);
621
}
622
}
623
624
StringName AnimationPlayer::get_assigned_animation() const {
625
return playback.assigned;
626
}
627
628
void AnimationPlayer::pause() {
629
_stop_internal(false, false);
630
}
631
632
void AnimationPlayer::stop(bool p_keep_state) {
633
_stop_internal(true, p_keep_state);
634
}
635
636
void AnimationPlayer::set_speed_scale(float p_speed) {
637
speed_scale = p_speed;
638
}
639
640
float AnimationPlayer::get_speed_scale() const {
641
return speed_scale;
642
}
643
644
float AnimationPlayer::get_playing_speed() const {
645
if (!playing) {
646
return 0;
647
}
648
return speed_scale * playback.current.speed_scale;
649
}
650
651
void AnimationPlayer::seek_internal(double p_time, bool p_update, bool p_update_only, bool p_is_internal_seek) {
652
if (!active) {
653
return;
654
}
655
656
bool is_backward = Animation::is_less_approx(p_time, playback.current.pos);
657
658
_check_immediately_after_start();
659
660
playback.current.pos = p_time;
661
if (!playback.current.from) {
662
if (playback.assigned) {
663
ERR_FAIL_COND_MSG(!animation_set.has(playback.assigned), vformat("Animation not found: %s.", playback.assigned));
664
playback.current.from = &animation_set[playback.assigned];
665
}
666
if (!playback.current.from) {
667
return; // There is no animation.
668
}
669
}
670
671
double start = playback.current.get_start_time();
672
double end = playback.current.get_end_time();
673
674
// Clamp the seek position.
675
p_time = CLAMP(p_time, start, end);
676
677
playback.seeked = true;
678
playback.internal_seeked = p_is_internal_seek;
679
680
if (p_update) {
681
_process_animation(is_backward ? -0.0 : 0.0, p_update_only);
682
playback.seeked = false; // If animation was proceeded here, no more seek in internal process.
683
}
684
}
685
686
void AnimationPlayer::seek(double p_time, bool p_update, bool p_update_only) {
687
seek_internal(p_time, p_update, p_update_only);
688
}
689
690
void AnimationPlayer::advance(double p_time) {
691
_check_immediately_after_start();
692
AnimationMixer::advance(p_time);
693
}
694
695
void AnimationPlayer::_check_immediately_after_start() {
696
if (playback.started) {
697
_process_animation(0); // Force process current key for Discrete/Method/Audio/AnimationPlayback. Then, started flag is cleared.
698
}
699
}
700
701
bool AnimationPlayer::is_valid() const {
702
return (playback.current.from);
703
}
704
705
double AnimationPlayer::get_current_animation_position() const {
706
ERR_FAIL_NULL_V_MSG(playback.current.from, 0, "AnimationPlayer has no current animation.");
707
return playback.current.pos;
708
}
709
710
double AnimationPlayer::get_current_animation_length() const {
711
ERR_FAIL_NULL_V_MSG(playback.current.from, 0, "AnimationPlayer has no current animation.");
712
return playback.current.from->animation->get_length();
713
}
714
715
void AnimationPlayer::set_section_with_markers(const StringName &p_start_marker, const StringName &p_end_marker) {
716
ERR_FAIL_NULL_MSG(playback.current.from, "AnimationPlayer has no current animation.");
717
ERR_FAIL_COND_MSG(p_start_marker == p_end_marker && p_start_marker, vformat("Start marker and end marker cannot be the same marker: %s.", p_start_marker));
718
ERR_FAIL_COND_MSG(p_start_marker && !playback.current.from->animation->has_marker(p_start_marker), vformat("Marker %s not found in animation: %s.", p_start_marker, playback.current.from->animation->get_name()));
719
ERR_FAIL_COND_MSG(p_end_marker && !playback.current.from->animation->has_marker(p_end_marker), vformat("Marker %s not found in animation: %s.", p_end_marker, playback.current.from->animation->get_name()));
720
double start_time = p_start_marker ? playback.current.from->animation->get_marker_time(p_start_marker) : -1;
721
double end_time = p_end_marker ? playback.current.from->animation->get_marker_time(p_end_marker) : -1;
722
if (p_start_marker && Animation::is_less_approx(start_time, 0)) {
723
WARN_PRINT_ONCE_ED(vformat("Marker %s time must be positive in animation: %s.", p_start_marker, playback.current.from->animation->get_name()));
724
}
725
if (p_end_marker && Animation::is_less_approx(end_time, 0)) {
726
WARN_PRINT_ONCE_ED(vformat("Marker %s time must be positive in animation: %s.", p_end_marker, playback.current.from->animation->get_name()));
727
}
728
set_section(start_time, end_time);
729
}
730
731
void AnimationPlayer::set_section(double p_start_time, double p_end_time) {
732
ERR_FAIL_NULL_MSG(playback.current.from, "AnimationPlayer has no current animation.");
733
ERR_FAIL_COND_MSG(Animation::is_greater_or_equal_approx(p_start_time, 0) && Animation::is_greater_or_equal_approx(p_end_time, 0) && Animation::is_greater_or_equal_approx(p_start_time, p_end_time), vformat("Start time %f is greater than end time %f.", p_start_time, p_end_time));
734
playback.current.start_time = p_start_time;
735
playback.current.end_time = p_end_time;
736
playback.current.pos = CLAMP(playback.current.pos, playback.current.get_start_time(), playback.current.get_end_time());
737
}
738
739
void AnimationPlayer::reset_section() {
740
playback.current.start_time = -1;
741
playback.current.end_time = -1;
742
}
743
744
double AnimationPlayer::get_section_start_time() const {
745
ERR_FAIL_NULL_V_MSG(playback.current.from, playback.current.start_time, "AnimationPlayer has no current animation.");
746
return playback.current.get_start_time();
747
}
748
749
double AnimationPlayer::get_section_end_time() const {
750
ERR_FAIL_NULL_V_MSG(playback.current.from, playback.current.end_time, "AnimationPlayer has no current animation.");
751
return playback.current.get_end_time();
752
}
753
754
bool AnimationPlayer::has_section() const {
755
return Animation::is_greater_or_equal_approx(playback.current.start_time, 0) || Animation::is_greater_or_equal_approx(playback.current.end_time, 0);
756
}
757
758
void AnimationPlayer::set_autoplay(const StringName &p_name) {
759
if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint()) {
760
WARN_PRINT("Setting autoplay after the node has been added to the scene has no effect.");
761
}
762
763
autoplay = p_name;
764
}
765
766
StringName AnimationPlayer::get_autoplay() const {
767
return autoplay;
768
}
769
770
void AnimationPlayer::set_movie_quit_on_finish_enabled(bool p_enabled) {
771
movie_quit_on_finish = p_enabled;
772
}
773
774
bool AnimationPlayer::is_movie_quit_on_finish_enabled() const {
775
return movie_quit_on_finish;
776
}
777
778
void AnimationPlayer::_stop_internal(bool p_reset, bool p_keep_state) {
779
_clear_caches();
780
Playback &c = playback;
781
// c.blend.clear();
782
double start = c.current.from ? playback.current.get_start_time() : 0;
783
if (p_reset) {
784
c.blend.clear();
785
if (p_keep_state) {
786
c.current.pos = start;
787
} else {
788
is_stopping = true;
789
seek_internal(start, true, true, true);
790
is_stopping = false;
791
}
792
c.current.from = nullptr;
793
c.current.speed_scale = 1;
794
emit_signal(SNAME("current_animation_changed"), "");
795
}
796
_set_process(false);
797
playback_queue.clear();
798
playing = false;
799
}
800
801
void AnimationPlayer::animation_set_next(const StringName &p_animation, const StringName &p_next) {
802
ERR_FAIL_COND_MSG(!animation_set.has(p_animation), vformat("Animation not found: %s.", p_animation));
803
animation_next_set[p_animation] = p_next;
804
}
805
806
StringName AnimationPlayer::animation_get_next(const StringName &p_animation) const {
807
if (!animation_next_set.has(p_animation)) {
808
return StringName();
809
}
810
return animation_next_set[p_animation];
811
}
812
813
void AnimationPlayer::set_default_blend_time(double p_default) {
814
default_blend_time = p_default;
815
}
816
817
double AnimationPlayer::get_default_blend_time() const {
818
return default_blend_time;
819
}
820
821
void AnimationPlayer::set_blend_time(const StringName &p_animation1, const StringName &p_animation2, double p_time) {
822
ERR_FAIL_COND_MSG(!animation_set.has(p_animation1), vformat("Animation not found: %s.", p_animation1));
823
ERR_FAIL_COND_MSG(!animation_set.has(p_animation2), vformat("Animation not found: %s.", p_animation2));
824
ERR_FAIL_COND_MSG(p_time < 0, "Blend time cannot be smaller than 0.");
825
826
BlendKey bk;
827
bk.from = p_animation1;
828
bk.to = p_animation2;
829
if (Math::is_zero_approx(p_time)) {
830
blend_times.erase(bk);
831
} else {
832
blend_times[bk] = p_time;
833
}
834
}
835
836
double AnimationPlayer::get_blend_time(const StringName &p_animation1, const StringName &p_animation2) const {
837
BlendKey bk;
838
bk.from = p_animation1;
839
bk.to = p_animation2;
840
841
if (blend_times.has(bk)) {
842
return blend_times[bk];
843
} else {
844
return 0;
845
}
846
}
847
848
void AnimationPlayer::set_auto_capture(bool p_auto_capture) {
849
auto_capture = p_auto_capture;
850
notify_property_list_changed();
851
}
852
853
bool AnimationPlayer::is_auto_capture() const {
854
return auto_capture;
855
}
856
857
void AnimationPlayer::set_auto_capture_duration(double p_auto_capture_duration) {
858
auto_capture_duration = p_auto_capture_duration;
859
}
860
861
double AnimationPlayer::get_auto_capture_duration() const {
862
return auto_capture_duration;
863
}
864
865
void AnimationPlayer::set_auto_capture_transition_type(Tween::TransitionType p_auto_capture_transition_type) {
866
auto_capture_transition_type = p_auto_capture_transition_type;
867
}
868
869
Tween::TransitionType AnimationPlayer::get_auto_capture_transition_type() const {
870
return auto_capture_transition_type;
871
}
872
873
void AnimationPlayer::set_auto_capture_ease_type(Tween::EaseType p_auto_capture_ease_type) {
874
auto_capture_ease_type = p_auto_capture_ease_type;
875
}
876
877
Tween::EaseType AnimationPlayer::get_auto_capture_ease_type() const {
878
return auto_capture_ease_type;
879
}
880
881
#ifdef TOOLS_ENABLED
882
void AnimationPlayer::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {
883
const String pf = p_function;
884
if (p_idx == 0 && (pf == "play" || pf == "play_backwards" || pf == "has_animation" || pf == "queue")) {
885
List<StringName> al;
886
get_animation_list(&al);
887
for (const StringName &name : al) {
888
r_options->push_back(String(name).quote());
889
}
890
}
891
AnimationMixer::get_argument_options(p_function, p_idx, r_options);
892
}
893
#endif
894
895
void AnimationPlayer::_animation_removed(const StringName &p_name, const StringName &p_library) {
896
AnimationMixer::_animation_removed(p_name, p_library);
897
898
StringName name = p_library == StringName() ? p_name : StringName(String(p_library) + "/" + String(p_name));
899
900
if (!animation_set.has(name)) {
901
return; // No need to update because not the one from the library being used.
902
}
903
904
_animation_set_cache_update();
905
906
// Erase blends if needed
907
List<BlendKey> to_erase;
908
for (const KeyValue<BlendKey, double> &E : blend_times) {
909
BlendKey bk = E.key;
910
if (bk.from == name || bk.to == name) {
911
to_erase.push_back(bk);
912
}
913
}
914
915
while (to_erase.size()) {
916
blend_times.erase(to_erase.front()->get());
917
to_erase.pop_front();
918
}
919
}
920
921
void AnimationPlayer::_rename_animation(const StringName &p_from_name, const StringName &p_to_name) {
922
AnimationMixer::_rename_animation(p_from_name, p_to_name);
923
924
// Rename autoplay or blends if needed.
925
List<BlendKey> to_erase;
926
HashMap<BlendKey, double, BlendKey> to_insert;
927
for (const KeyValue<BlendKey, double> &E : blend_times) {
928
BlendKey bk = E.key;
929
BlendKey new_bk = bk;
930
bool erase = false;
931
if (bk.from == p_from_name) {
932
new_bk.from = p_to_name;
933
erase = true;
934
}
935
if (bk.to == p_from_name) {
936
new_bk.to = p_to_name;
937
erase = true;
938
}
939
940
if (erase) {
941
to_erase.push_back(bk);
942
to_insert[new_bk] = E.value;
943
}
944
}
945
946
while (to_erase.size()) {
947
blend_times.erase(to_erase.front()->get());
948
to_erase.pop_front();
949
}
950
951
while (to_insert.size()) {
952
blend_times[to_insert.begin()->key] = to_insert.begin()->value;
953
to_insert.remove(to_insert.begin());
954
}
955
956
if (autoplay == p_from_name) {
957
autoplay = p_to_name;
958
}
959
}
960
961
void AnimationPlayer::_bind_methods() {
962
ClassDB::bind_method(D_METHOD("animation_set_next", "animation_from", "animation_to"), &AnimationPlayer::animation_set_next);
963
ClassDB::bind_method(D_METHOD("animation_get_next", "animation_from"), &AnimationPlayer::animation_get_next);
964
965
ClassDB::bind_method(D_METHOD("set_blend_time", "animation_from", "animation_to", "sec"), &AnimationPlayer::set_blend_time);
966
ClassDB::bind_method(D_METHOD("get_blend_time", "animation_from", "animation_to"), &AnimationPlayer::get_blend_time);
967
968
ClassDB::bind_method(D_METHOD("set_default_blend_time", "sec"), &AnimationPlayer::set_default_blend_time);
969
ClassDB::bind_method(D_METHOD("get_default_blend_time"), &AnimationPlayer::get_default_blend_time);
970
971
ClassDB::bind_method(D_METHOD("set_auto_capture", "auto_capture"), &AnimationPlayer::set_auto_capture);
972
ClassDB::bind_method(D_METHOD("is_auto_capture"), &AnimationPlayer::is_auto_capture);
973
ClassDB::bind_method(D_METHOD("set_auto_capture_duration", "auto_capture_duration"), &AnimationPlayer::set_auto_capture_duration);
974
ClassDB::bind_method(D_METHOD("get_auto_capture_duration"), &AnimationPlayer::get_auto_capture_duration);
975
ClassDB::bind_method(D_METHOD("set_auto_capture_transition_type", "auto_capture_transition_type"), &AnimationPlayer::set_auto_capture_transition_type);
976
ClassDB::bind_method(D_METHOD("get_auto_capture_transition_type"), &AnimationPlayer::get_auto_capture_transition_type);
977
ClassDB::bind_method(D_METHOD("set_auto_capture_ease_type", "auto_capture_ease_type"), &AnimationPlayer::set_auto_capture_ease_type);
978
ClassDB::bind_method(D_METHOD("get_auto_capture_ease_type"), &AnimationPlayer::get_auto_capture_ease_type);
979
980
ClassDB::bind_method(D_METHOD("play", "name", "custom_blend", "custom_speed", "from_end"), &AnimationPlayer::play, DEFVAL(StringName()), DEFVAL(-1), DEFVAL(1.0), DEFVAL(false));
981
ClassDB::bind_method(D_METHOD("play_section_with_markers", "name", "start_marker", "end_marker", "custom_blend", "custom_speed", "from_end"), &AnimationPlayer::play_section_with_markers, DEFVAL(StringName()), DEFVAL(StringName()), DEFVAL(StringName()), DEFVAL(-1), DEFVAL(1.0), DEFVAL(false));
982
ClassDB::bind_method(D_METHOD("play_section", "name", "start_time", "end_time", "custom_blend", "custom_speed", "from_end"), &AnimationPlayer::play_section, DEFVAL(StringName()), DEFVAL(-1), DEFVAL(-1), DEFVAL(-1), DEFVAL(1.0), DEFVAL(false));
983
ClassDB::bind_method(D_METHOD("play_backwards", "name", "custom_blend"), &AnimationPlayer::play_backwards, DEFVAL(StringName()), DEFVAL(-1));
984
ClassDB::bind_method(D_METHOD("play_section_with_markers_backwards", "name", "start_marker", "end_marker", "custom_blend"), &AnimationPlayer::play_section_with_markers_backwards, DEFVAL(StringName()), DEFVAL(StringName()), DEFVAL(StringName()), DEFVAL(-1));
985
ClassDB::bind_method(D_METHOD("play_section_backwards", "name", "start_time", "end_time", "custom_blend"), &AnimationPlayer::play_section_backwards, DEFVAL(StringName()), DEFVAL(-1), DEFVAL(-1), DEFVAL(-1));
986
ClassDB::bind_method(D_METHOD("play_with_capture", "name", "duration", "custom_blend", "custom_speed", "from_end", "trans_type", "ease_type"), &AnimationPlayer::play_with_capture, DEFVAL(StringName()), DEFVAL(-1.0), DEFVAL(-1), DEFVAL(1.0), DEFVAL(false), DEFVAL(Tween::TRANS_LINEAR), DEFVAL(Tween::EASE_IN));
987
ClassDB::bind_method(D_METHOD("pause"), &AnimationPlayer::pause);
988
ClassDB::bind_method(D_METHOD("stop", "keep_state"), &AnimationPlayer::stop, DEFVAL(false));
989
ClassDB::bind_method(D_METHOD("is_playing"), &AnimationPlayer::is_playing);
990
ClassDB::bind_method(D_METHOD("is_animation_active"), &AnimationPlayer::is_valid);
991
992
ClassDB::bind_method(D_METHOD("set_current_animation", "animation"), &AnimationPlayer::set_current_animation);
993
ClassDB::bind_method(D_METHOD("get_current_animation"), &AnimationPlayer::get_current_animation);
994
ClassDB::bind_method(D_METHOD("set_assigned_animation", "animation"), &AnimationPlayer::set_assigned_animation);
995
ClassDB::bind_method(D_METHOD("get_assigned_animation"), &AnimationPlayer::get_assigned_animation);
996
ClassDB::bind_method(D_METHOD("queue", "name"), &AnimationPlayer::queue);
997
ClassDB::bind_method(D_METHOD("get_queue"), &AnimationPlayer::get_queue);
998
ClassDB::bind_method(D_METHOD("clear_queue"), &AnimationPlayer::clear_queue);
999
1000
ClassDB::bind_method(D_METHOD("set_speed_scale", "speed"), &AnimationPlayer::set_speed_scale);
1001
ClassDB::bind_method(D_METHOD("get_speed_scale"), &AnimationPlayer::get_speed_scale);
1002
ClassDB::bind_method(D_METHOD("get_playing_speed"), &AnimationPlayer::get_playing_speed);
1003
1004
ClassDB::bind_method(D_METHOD("set_autoplay", "name"), &AnimationPlayer::set_autoplay);
1005
ClassDB::bind_method(D_METHOD("get_autoplay"), &AnimationPlayer::get_autoplay);
1006
1007
ClassDB::bind_method(D_METHOD("find_animation", "animation"), &AnimationPlayer::find_animation);
1008
ClassDB::bind_method(D_METHOD("find_animation_library", "animation"), &AnimationPlayer::find_animation_library);
1009
1010
ClassDB::bind_method(D_METHOD("set_movie_quit_on_finish_enabled", "enabled"), &AnimationPlayer::set_movie_quit_on_finish_enabled);
1011
ClassDB::bind_method(D_METHOD("is_movie_quit_on_finish_enabled"), &AnimationPlayer::is_movie_quit_on_finish_enabled);
1012
1013
ClassDB::bind_method(D_METHOD("get_current_animation_position"), &AnimationPlayer::get_current_animation_position);
1014
ClassDB::bind_method(D_METHOD("get_current_animation_length"), &AnimationPlayer::get_current_animation_length);
1015
1016
ClassDB::bind_method(D_METHOD("set_section_with_markers", "start_marker", "end_marker"), &AnimationPlayer::set_section_with_markers, DEFVAL(StringName()), DEFVAL(StringName()));
1017
ClassDB::bind_method(D_METHOD("set_section", "start_time", "end_time"), &AnimationPlayer::set_section, DEFVAL(-1), DEFVAL(-1));
1018
ClassDB::bind_method(D_METHOD("reset_section"), &AnimationPlayer::reset_section);
1019
1020
ClassDB::bind_method(D_METHOD("get_section_start_time"), &AnimationPlayer::get_section_start_time);
1021
ClassDB::bind_method(D_METHOD("get_section_end_time"), &AnimationPlayer::get_section_end_time);
1022
ClassDB::bind_method(D_METHOD("has_section"), &AnimationPlayer::has_section);
1023
1024
ClassDB::bind_method(D_METHOD("seek", "seconds", "update", "update_only"), &AnimationPlayer::seek, DEFVAL(false), DEFVAL(false));
1025
1026
ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "current_animation", PROPERTY_HINT_ENUM, "", PROPERTY_USAGE_EDITOR), "set_current_animation", "get_current_animation");
1027
ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "assigned_animation", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "set_assigned_animation", "get_assigned_animation");
1028
ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "autoplay", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_autoplay", "get_autoplay");
1029
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "current_animation_length", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "", "get_current_animation_length");
1030
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "current_animation_position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "", "get_current_animation_position");
1031
1032
ADD_GROUP("Playback Options", "playback_");
1033
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "playback_auto_capture"), "set_auto_capture", "is_auto_capture");
1034
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "playback_auto_capture_duration", PROPERTY_HINT_NONE, "suffix:s"), "set_auto_capture_duration", "get_auto_capture_duration");
1035
ADD_PROPERTY(PropertyInfo(Variant::INT, "playback_auto_capture_transition_type", PROPERTY_HINT_ENUM, "Linear,Sine,Quint,Quart,Quad,Expo,Elastic,Cubic,Circ,Bounce,Back,Spring"), "set_auto_capture_transition_type", "get_auto_capture_transition_type");
1036
ADD_PROPERTY(PropertyInfo(Variant::INT, "playback_auto_capture_ease_type", PROPERTY_HINT_ENUM, "In,Out,InOut,OutIn"), "set_auto_capture_ease_type", "get_auto_capture_ease_type");
1037
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "playback_default_blend_time", PROPERTY_HINT_RANGE, "0,4096,0.01,suffix:s"), "set_default_blend_time", "get_default_blend_time");
1038
1039
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "speed_scale", PROPERTY_HINT_RANGE, "-4,4,0.001,or_less,or_greater"), "set_speed_scale", "get_speed_scale");
1040
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "movie_quit_on_finish"), "set_movie_quit_on_finish_enabled", "is_movie_quit_on_finish_enabled");
1041
1042
ADD_SIGNAL(MethodInfo(SNAME("current_animation_changed"), PropertyInfo(Variant::STRING_NAME, "name")));
1043
ADD_SIGNAL(MethodInfo(SNAME("animation_changed"), PropertyInfo(Variant::STRING_NAME, "old_name"), PropertyInfo(Variant::STRING_NAME, "new_name")));
1044
}
1045
1046
AnimationPlayer::AnimationPlayer() {
1047
}
1048
1049
AnimationPlayer::~AnimationPlayer() {
1050
}
1051
1052