summaryrefslogtreecommitdiff
path: root/scene/animation
diff options
context:
space:
mode:
Diffstat (limited to 'scene/animation')
-rw-r--r--scene/animation/animation_blend_space_2d.cpp36
-rw-r--r--scene/animation/animation_blend_tree.cpp240
-rw-r--r--scene/animation/animation_blend_tree.h38
-rw-r--r--scene/animation/animation_node_state_machine.cpp76
-rw-r--r--scene/animation/animation_node_state_machine.h4
-rw-r--r--scene/animation/animation_player.cpp77
-rw-r--r--scene/animation/animation_player.h28
-rw-r--r--scene/animation/animation_tree.cpp59
-rw-r--r--scene/animation/animation_tree.h4
-rw-r--r--scene/animation/easing_equations.h6
-rw-r--r--scene/animation/tween.cpp62
-rw-r--r--scene/animation/tween.h52
12 files changed, 337 insertions, 345 deletions
diff --git a/scene/animation/animation_blend_space_2d.cpp b/scene/animation/animation_blend_space_2d.cpp
index 2dc61efb94..0d8b7ba8f7 100644
--- a/scene/animation/animation_blend_space_2d.cpp
+++ b/scene/animation/animation_blend_space_2d.cpp
@@ -343,10 +343,10 @@ void AnimationNodeBlendSpace2D::_update_triangles() {
points.write[i] = blend_points[i].position;
}
- Vector<Delaunay2D::Triangle> triangles = Delaunay2D::triangulate(points);
+ Vector<Delaunay2D::Triangle> tr = Delaunay2D::triangulate(points);
- for (int i = 0; i < triangles.size(); i++) {
- add_triangle(triangles[i].points[0], triangles[i].points[1], triangles[i].points[2]);
+ for (int i = 0; i < tr.size(); i++) {
+ add_triangle(tr[i].points[0], tr[i].points[1], tr[i].points[2]);
}
emit_signal(SNAME("triangles_updated"));
}
@@ -376,9 +376,9 @@ Vector2 AnimationNodeBlendSpace2D::get_closest_point(const Vector2 &p_point) {
points[j],
points[(j + 1) % 3]
};
- Vector2 closest = Geometry2D::get_closest_point_to_segment(p_point, s);
- if (first || closest.distance_to(p_point) < best_point.distance_to(p_point)) {
- best_point = closest;
+ Vector2 closest_point = Geometry2D::get_closest_point_to_segment(p_point, s);
+ if (first || closest_point.distance_to(p_point) < best_point.distance_to(p_point)) {
+ best_point = closest_point;
first = false;
}
}
@@ -436,8 +436,8 @@ double AnimationNodeBlendSpace2D::process(double p_time, bool p_seek, bool p_see
_update_triangles();
Vector2 blend_pos = get_parameter(blend_position);
- int closest = get_parameter(this->closest);
- double length_internal = get_parameter(this->length_internal);
+ int cur_closest = get_parameter(closest);
+ double cur_length_internal = get_parameter(length_internal);
double mind = 0.0; //time of min distance point
if (blend_mode == BLEND_MODE_INTERPOLATED) {
@@ -528,37 +528,37 @@ double AnimationNodeBlendSpace2D::process(double p_time, bool p_seek, bool p_see
}
}
- if (new_closest != closest && new_closest != -1) {
+ if (new_closest != cur_closest && new_closest != -1) {
double from = 0.0;
- if (blend_mode == BLEND_MODE_DISCRETE_CARRY && closest != -1) {
+ if (blend_mode == BLEND_MODE_DISCRETE_CARRY && cur_closest != -1) {
//for ping-pong loop
- Ref<AnimationNodeAnimation> na_c = static_cast<Ref<AnimationNodeAnimation>>(blend_points[closest].node);
+ Ref<AnimationNodeAnimation> na_c = static_cast<Ref<AnimationNodeAnimation>>(blend_points[cur_closest].node);
Ref<AnimationNodeAnimation> na_n = static_cast<Ref<AnimationNodeAnimation>>(blend_points[new_closest].node);
if (!na_c.is_null() && !na_n.is_null()) {
na_n->set_backward(na_c->is_backward());
}
//see how much animation remains
- from = length_internal - blend_node(blend_points[closest].name, blend_points[closest].node, p_time, false, p_seek_root, 0.0, FILTER_IGNORE, true);
+ from = cur_length_internal - blend_node(blend_points[cur_closest].name, blend_points[cur_closest].node, p_time, false, p_seek_root, 0.0, FILTER_IGNORE, true);
}
mind = blend_node(blend_points[new_closest].name, blend_points[new_closest].node, from, true, p_seek_root, 1.0, FILTER_IGNORE, true);
- length_internal = from + mind;
+ cur_length_internal = from + mind;
- closest = new_closest;
+ cur_closest = new_closest;
} else {
- mind = blend_node(blend_points[closest].name, blend_points[closest].node, p_time, p_seek, p_seek_root, 1.0, FILTER_IGNORE, true);
+ mind = blend_node(blend_points[cur_closest].name, blend_points[cur_closest].node, p_time, p_seek, p_seek_root, 1.0, FILTER_IGNORE, true);
}
for (int i = 0; i < blend_points_used; i++) {
- if (i != closest) {
+ if (i != cur_closest) {
blend_node(blend_points[i].name, blend_points[i].node, p_time, p_seek, p_seek_root, 0, FILTER_IGNORE, sync);
}
}
}
- set_parameter(this->closest, closest);
- set_parameter(this->length_internal, length_internal);
+ set_parameter(this->closest, cur_closest);
+ set_parameter(this->length_internal, cur_length_internal);
return mind;
}
diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp
index 1efbaacb3b..0c91729a6f 100644
--- a/scene/animation/animation_blend_tree.cpp
+++ b/scene/animation/animation_blend_tree.cpp
@@ -68,13 +68,13 @@ double AnimationNodeAnimation::process(double p_time, bool p_seek, bool p_seek_r
AnimationPlayer *ap = state->player;
ERR_FAIL_COND_V(!ap, 0);
- double time = get_parameter(this->time);
+ double cur_time = get_parameter(time);
if (!ap->has_animation(animation)) {
AnimationNodeBlendTree *tree = Object::cast_to<AnimationNodeBlendTree>(parent);
if (tree) {
- String name = tree->get_node_name(Ref<AnimationNodeAnimation>(this));
- make_invalid(vformat(RTR("On BlendTree node '%s', animation not found: '%s'"), name, animation));
+ String node_name = tree->get_node_name(Ref<AnimationNodeAnimation>(this));
+ make_invalid(vformat(RTR("On BlendTree node '%s', animation not found: '%s'"), node_name, animation));
} else {
make_invalid(vformat(RTR("Animation not found: '%s'"), animation));
@@ -86,58 +86,58 @@ double AnimationNodeAnimation::process(double p_time, bool p_seek, bool p_seek_r
Ref<Animation> anim = ap->get_animation(animation);
double anim_size = (double)anim->get_length();
double step = 0.0;
- double prev_time = time;
+ double prev_time = cur_time;
int pingponged = 0;
bool current_backward = signbit(p_time);
if (p_seek) {
- step = p_time - time;
- time = p_time;
+ step = p_time - cur_time;
+ cur_time = p_time;
} else {
p_time *= backward ? -1.0 : 1.0;
- if (!(time == anim_size && !current_backward) && !(time == 0 && current_backward)) {
- time = time + p_time;
+ if (!(cur_time == anim_size && !current_backward) && !(cur_time == 0 && current_backward)) {
+ cur_time = cur_time + p_time;
step = p_time;
}
}
if (anim->get_loop_mode() == Animation::LOOP_PINGPONG) {
if (!Math::is_zero_approx(anim_size)) {
- if ((int)Math::floor(abs(time - prev_time) / anim_size) % 2 == 0) {
- if (prev_time >= 0 && time < 0) {
+ if ((int)Math::floor(abs(cur_time - prev_time) / anim_size) % 2 == 0) {
+ if (prev_time >= 0 && cur_time < 0) {
backward = !backward;
pingponged = -1;
}
- if (prev_time <= anim_size && time > anim_size) {
+ if (prev_time <= anim_size && cur_time > anim_size) {
backward = !backward;
pingponged = 1;
}
}
- time = Math::pingpong(time, anim_size);
+ cur_time = Math::pingpong(cur_time, anim_size);
}
} else {
if (anim->get_loop_mode() == Animation::LOOP_LINEAR) {
if (!Math::is_zero_approx(anim_size)) {
- time = Math::fposmod(time, anim_size);
+ cur_time = Math::fposmod(cur_time, anim_size);
}
- } else if (time < 0) {
- step += time;
- time = 0;
- } else if (time > anim_size) {
- step += anim_size - time;
- time = anim_size;
+ } else if (cur_time < 0) {
+ step += cur_time;
+ cur_time = 0;
+ } else if (cur_time > anim_size) {
+ step += anim_size - cur_time;
+ cur_time = anim_size;
}
backward = false;
}
if (play_mode == PLAY_MODE_FORWARD) {
- blend_animation(animation, time, step, p_seek, p_seek_root, 1.0, pingponged);
+ blend_animation(animation, cur_time, step, p_seek, p_seek_root, 1.0, pingponged);
} else {
- blend_animation(animation, anim_size - time, -step, p_seek, p_seek_root, 1.0, pingponged);
+ blend_animation(animation, anim_size - cur_time, -step, p_seek, p_seek_root, 1.0, pingponged);
}
- set_parameter(this->time, time);
+ set_parameter(time, cur_time);
- return anim_size - time;
+ return anim_size - cur_time;
}
String AnimationNodeAnimation::get_caption() const {
@@ -217,19 +217,19 @@ Variant AnimationNodeOneShot::get_parameter_default_value(const StringName &p_pa
}
}
-void AnimationNodeOneShot::set_fadein_time(float p_time) {
+void AnimationNodeOneShot::set_fadein_time(double p_time) {
fade_in = p_time;
}
-void AnimationNodeOneShot::set_fadeout_time(float p_time) {
+void AnimationNodeOneShot::set_fadeout_time(double p_time) {
fade_out = p_time;
}
-float AnimationNodeOneShot::get_fadein_time() const {
+double AnimationNodeOneShot::get_fadein_time() const {
return fade_in;
}
-float AnimationNodeOneShot::get_fadeout_time() const {
+double AnimationNodeOneShot::get_fadeout_time() const {
return fade_out;
}
@@ -237,11 +237,11 @@ void AnimationNodeOneShot::set_autorestart(bool p_active) {
autorestart = p_active;
}
-void AnimationNodeOneShot::set_autorestart_delay(float p_time) {
+void AnimationNodeOneShot::set_autorestart_delay(double p_time) {
autorestart_delay = p_time;
}
-void AnimationNodeOneShot::set_autorestart_random_delay(float p_time) {
+void AnimationNodeOneShot::set_autorestart_random_delay(double p_time) {
autorestart_random_delay = p_time;
}
@@ -249,11 +249,11 @@ bool AnimationNodeOneShot::has_autorestart() const {
return autorestart;
}
-float AnimationNodeOneShot::get_autorestart_delay() const {
+double AnimationNodeOneShot::get_autorestart_delay() const {
return autorestart_delay;
}
-float AnimationNodeOneShot::get_autorestart_random_delay() const {
+double AnimationNodeOneShot::get_autorestart_random_delay() const {
return autorestart_random_delay;
}
@@ -274,28 +274,28 @@ bool AnimationNodeOneShot::has_filter() const {
}
double AnimationNodeOneShot::process(double p_time, bool p_seek, bool p_seek_root) {
- bool active = get_parameter(this->active);
- bool prev_active = get_parameter(this->prev_active);
- double time = get_parameter(this->time);
- double remaining = get_parameter(this->remaining);
- double time_to_restart = get_parameter(this->time_to_restart);
+ bool cur_active = get_parameter(active);
+ bool cur_prev_active = get_parameter(prev_active);
+ double cur_time = get_parameter(time);
+ double cur_remaining = get_parameter(remaining);
+ double cur_time_to_restart = get_parameter(time_to_restart);
- if (!active) {
+ if (!cur_active) {
//make it as if this node doesn't exist, pass input 0 by.
- if (prev_active) {
- set_parameter(this->prev_active, false);
+ if (cur_prev_active) {
+ set_parameter(prev_active, false);
}
- if (time_to_restart >= 0.0 && !p_seek) {
- time_to_restart -= p_time;
- if (time_to_restart < 0) {
+ if (cur_time_to_restart >= 0.0 && !p_seek) {
+ cur_time_to_restart -= p_time;
+ if (cur_time_to_restart < 0) {
//restart
- set_parameter(this->active, true);
- active = true;
+ set_parameter(active, true);
+ cur_active = true;
}
- set_parameter(this->time_to_restart, time_to_restart);
+ set_parameter(time_to_restart, cur_time_to_restart);
}
- if (!active) {
+ if (!cur_active) {
return blend_input(0, p_time, p_seek, p_seek_root, 1.0, FILTER_IGNORE, sync);
}
}
@@ -303,27 +303,27 @@ double AnimationNodeOneShot::process(double p_time, bool p_seek, bool p_seek_roo
bool os_seek = p_seek;
if (p_seek) {
- time = p_time;
+ cur_time = p_time;
}
- bool do_start = !prev_active;
+ bool do_start = !cur_prev_active;
if (do_start) {
- time = 0;
+ cur_time = 0;
os_seek = true;
- set_parameter(this->prev_active, true);
+ set_parameter(prev_active, true);
}
- float blend;
+ real_t blend;
- if (time < fade_in) {
+ if (cur_time < fade_in) {
if (fade_in > 0) {
- blend = time / fade_in;
+ blend = cur_time / fade_in;
} else {
blend = 0;
}
- } else if (!do_start && remaining <= fade_out) {
+ } else if (!do_start && cur_remaining <= fade_out) {
if (fade_out > 0) {
- blend = (remaining / fade_out);
+ blend = (cur_remaining / fade_out);
} else {
blend = 0;
}
@@ -338,29 +338,29 @@ double AnimationNodeOneShot::process(double p_time, bool p_seek, bool p_seek_roo
main_rem = blend_input(0, p_time, p_seek, p_seek_root, 1.0 - blend, FILTER_BLEND, sync);
}
- double os_rem = blend_input(1, os_seek ? time : p_time, os_seek, p_seek_root, blend, FILTER_PASS, true);
+ double os_rem = blend_input(1, os_seek ? cur_time : p_time, os_seek, p_seek_root, blend, FILTER_PASS, true);
if (do_start) {
- remaining = os_rem;
+ cur_remaining = os_rem;
}
if (!p_seek) {
- time += p_time;
- remaining = os_rem;
- if (remaining <= 0) {
- set_parameter(this->active, false);
- set_parameter(this->prev_active, false);
+ cur_time += p_time;
+ cur_remaining = os_rem;
+ if (cur_remaining <= 0) {
+ set_parameter(active, false);
+ set_parameter(prev_active, false);
if (autorestart) {
- float restart_sec = autorestart_delay + Math::randf() * autorestart_random_delay;
- set_parameter(this->time_to_restart, restart_sec);
+ double restart_sec = autorestart_delay + Math::randd() * autorestart_random_delay;
+ set_parameter(time_to_restart, restart_sec);
}
}
}
- set_parameter(this->time, time);
- set_parameter(this->remaining, remaining);
+ set_parameter(time, cur_time);
+ set_parameter(remaining, cur_remaining);
- return MAX(main_rem, remaining);
+ return MAX(main_rem, cur_remaining);
}
void AnimationNodeOneShot::_bind_methods() {
@@ -554,11 +554,11 @@ String AnimationNodeTimeScale::get_caption() const {
}
double AnimationNodeTimeScale::process(double p_time, bool p_seek, bool p_seek_root) {
- double scale = get_parameter(this->scale);
+ double cur_scale = get_parameter(scale);
if (p_seek) {
return blend_input(0, p_time, true, p_seek_root, 1.0, FILTER_IGNORE, true);
} else {
- return blend_input(0, p_time * scale, false, p_seek_root, 1.0, FILTER_IGNORE, true);
+ return blend_input(0, p_time * cur_scale, false, p_seek_root, 1.0, FILTER_IGNORE, true);
}
}
@@ -584,12 +584,12 @@ String AnimationNodeTimeSeek::get_caption() const {
}
double AnimationNodeTimeSeek::process(double p_time, bool p_seek, bool p_seek_root) {
- double seek_pos = get_parameter(this->seek_pos);
+ double cur_seek_pos = get_parameter(seek_pos);
if (p_seek) {
return blend_input(0, p_time, true, p_seek_root, 1.0, FILTER_IGNORE, true);
- } else if (seek_pos >= 0) {
- double ret = blend_input(0, seek_pos, true, true, 1.0, FILTER_IGNORE, true);
- set_parameter(this->seek_pos, -1.0); //reset
+ } else if (cur_seek_pos >= 0) {
+ double ret = blend_input(0, cur_seek_pos, true, true, 1.0, FILTER_IGNORE, true);
+ set_parameter(seek_pos, -1.0); //reset
return ret;
} else {
return blend_input(0, p_time, false, p_seek_root, 1.0, FILTER_IGNORE, true);
@@ -676,11 +676,11 @@ String AnimationNodeTransition::get_input_caption(int p_input) const {
return inputs[p_input].name;
}
-void AnimationNodeTransition::set_xfade_time(float p_fade) {
+void AnimationNodeTransition::set_xfade_time(double p_fade) {
xfade_time = p_fade;
}
-float AnimationNodeTransition::get_xfade_time() const {
+double AnimationNodeTransition::get_xfade_time() const {
return xfade_time;
}
@@ -701,80 +701,80 @@ bool AnimationNodeTransition::is_from_start() const {
}
double AnimationNodeTransition::process(double p_time, bool p_seek, bool p_seek_root) {
- int current = get_parameter(this->current);
- int prev = get_parameter(this->prev);
- int prev_current = get_parameter(this->prev_current);
+ int cur_current = get_parameter(current);
+ int cur_prev = get_parameter(prev);
+ int cur_prev_current = get_parameter(prev_current);
- double time = get_parameter(this->time);
- double prev_xfading = get_parameter(this->prev_xfading);
+ double cur_time = get_parameter(time);
+ double cur_prev_xfading = get_parameter(prev_xfading);
- bool switched = current != prev_current;
+ bool switched = cur_current != cur_prev_current;
if (switched) {
- set_parameter(this->prev_current, current);
- set_parameter(this->prev, prev_current);
+ set_parameter(prev_current, cur_current);
+ set_parameter(prev, cur_prev_current);
- prev = prev_current;
- prev_xfading = xfade_time;
- time = 0;
+ cur_prev = cur_prev_current;
+ cur_prev_xfading = xfade_time;
+ cur_time = 0;
switched = true;
}
- if (current < 0 || current >= enabled_inputs || prev >= enabled_inputs) {
+ if (cur_current < 0 || cur_current >= enabled_inputs || cur_prev >= enabled_inputs) {
return 0;
}
double rem = 0.0;
for (int i = 0; i < enabled_inputs; i++) {
- if (i != current && i != prev) {
+ if (i != cur_current && i != cur_prev) {
blend_input(i, p_time, p_seek, p_seek_root, 0, FILTER_IGNORE, sync);
}
}
- if (prev < 0) { // process current animation, check for transition
+ if (cur_prev < 0) { // process current animation, check for transition
- rem = blend_input(current, p_time, p_seek, p_seek_root, 1.0, FILTER_IGNORE, true);
+ rem = blend_input(cur_current, p_time, p_seek, p_seek_root, 1.0, FILTER_IGNORE, true);
if (p_seek) {
- time = p_time;
+ cur_time = p_time;
} else {
- time += p_time;
+ cur_time += p_time;
}
- if (inputs[current].auto_advance && rem <= xfade_time) {
- set_parameter(this->current, (current + 1) % enabled_inputs);
+ if (inputs[cur_current].auto_advance && rem <= xfade_time) {
+ set_parameter(current, (cur_current + 1) % enabled_inputs);
}
} else { // cross-fading from prev to current
- float blend = xfade_time == 0 ? 0 : (prev_xfading / xfade_time);
+ real_t blend = xfade_time == 0 ? 0 : (cur_prev_xfading / xfade_time);
if (xfade_curve.is_valid()) {
blend = xfade_curve->sample(blend);
}
if (from_start && !p_seek && switched) { //just switched, seek to start of current
- rem = blend_input(current, 0, true, p_seek_root, 1.0 - blend, FILTER_IGNORE, true);
+ rem = blend_input(cur_current, 0, true, p_seek_root, 1.0 - blend, FILTER_IGNORE, true);
} else {
- rem = blend_input(current, p_time, p_seek, p_seek_root, 1.0 - blend, FILTER_IGNORE, true);
+ rem = blend_input(cur_current, p_time, p_seek, p_seek_root, 1.0 - blend, FILTER_IGNORE, true);
}
if (p_seek) {
- blend_input(prev, p_time, true, p_seek_root, blend, FILTER_IGNORE, true);
- time = p_time;
+ blend_input(cur_prev, p_time, true, p_seek_root, blend, FILTER_IGNORE, true);
+ cur_time = p_time;
} else {
- blend_input(prev, p_time, false, p_seek_root, blend, FILTER_IGNORE, true);
- time += p_time;
- prev_xfading -= p_time;
- if (prev_xfading < 0) {
- set_parameter(this->prev, -1);
+ blend_input(cur_prev, p_time, false, p_seek_root, blend, FILTER_IGNORE, true);
+ cur_time += p_time;
+ cur_prev_xfading -= p_time;
+ if (cur_prev_xfading < 0) {
+ set_parameter(prev, -1);
}
}
}
- set_parameter(this->time, time);
- set_parameter(this->prev_xfading, prev_xfading);
+ set_parameter(time, cur_time);
+ set_parameter(prev_xfading, cur_prev_xfading);
return rem;
}
@@ -1070,10 +1070,10 @@ Ref<AnimationNode> AnimationNodeBlendTree::get_child_by_name(const StringName &p
}
bool AnimationNodeBlendTree::_set(const StringName &p_name, const Variant &p_value) {
- String name = p_name;
- if (name.begins_with("nodes/")) {
- String node_name = name.get_slicec('/', 1);
- String what = name.get_slicec('/', 2);
+ String prop_name = p_name;
+ if (prop_name.begins_with("nodes/")) {
+ String node_name = prop_name.get_slicec('/', 1);
+ String what = prop_name.get_slicec('/', 2);
if (what == "node") {
Ref<AnimationNode> anode = p_value;
@@ -1089,7 +1089,7 @@ bool AnimationNodeBlendTree::_set(const StringName &p_name, const Variant &p_val
}
return true;
}
- } else if (name == "node_connections") {
+ } else if (prop_name == "node_connections") {
Array conns = p_value;
ERR_FAIL_COND_V(conns.size() % 3 != 0, false);
@@ -1103,10 +1103,10 @@ bool AnimationNodeBlendTree::_set(const StringName &p_name, const Variant &p_val
}
bool AnimationNodeBlendTree::_get(const StringName &p_name, Variant &r_ret) const {
- String name = p_name;
- if (name.begins_with("nodes/")) {
- String node_name = name.get_slicec('/', 1);
- String what = name.get_slicec('/', 2);
+ String prop_name = p_name;
+ if (prop_name.begins_with("nodes/")) {
+ String node_name = prop_name.get_slicec('/', 1);
+ String what = prop_name.get_slicec('/', 2);
if (what == "node") {
if (nodes.has(node_name)) {
@@ -1121,7 +1121,7 @@ bool AnimationNodeBlendTree::_get(const StringName &p_name, Variant &r_ret) cons
return true;
}
}
- } else if (name == "node_connections") {
+ } else if (prop_name == "node_connections") {
List<NodeConnection> nc;
get_node_connections(&nc);
Array conns;
@@ -1150,11 +1150,11 @@ void AnimationNodeBlendTree::_get_property_list(List<PropertyInfo> *p_list) cons
names.sort_custom<StringName::AlphCompare>();
for (const StringName &E : names) {
- String name = E;
- if (name != "output") {
- p_list->push_back(PropertyInfo(Variant::OBJECT, "nodes/" + name + "/node", PROPERTY_HINT_RESOURCE_TYPE, "AnimationNode", PROPERTY_USAGE_NO_EDITOR));
+ String prop_name = E;
+ if (prop_name != "output") {
+ p_list->push_back(PropertyInfo(Variant::OBJECT, "nodes/" + prop_name + "/node", PROPERTY_HINT_RESOURCE_TYPE, "AnimationNode", PROPERTY_USAGE_NO_EDITOR));
}
- p_list->push_back(PropertyInfo(Variant::VECTOR2, "nodes/" + name + "/position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR));
+ p_list->push_back(PropertyInfo(Variant::VECTOR2, "nodes/" + prop_name + "/position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR));
}
p_list->push_back(PropertyInfo(Variant::ARRAY, "node_connections", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR));
diff --git a/scene/animation/animation_blend_tree.h b/scene/animation/animation_blend_tree.h
index 59c074cc80..1c31718259 100644
--- a/scene/animation/animation_blend_tree.h
+++ b/scene/animation/animation_blend_tree.h
@@ -102,18 +102,18 @@ public:
};
private:
- float fade_in = 0.0;
- float fade_out = 0.0;
+ double fade_in = 0.0;
+ double fade_out = 0.0;
bool autorestart = false;
- float autorestart_delay = 1.0;
- float autorestart_random_delay = 0.0;
+ double autorestart_delay = 1.0;
+ double autorestart_random_delay = 0.0;
MixMode mix = MIX_MODE_BLEND;
/* bool active;
bool do_start;
- float time;
- float remaining;*/
+ double time;
+ double remaining;*/
StringName active = PNAME("active");
StringName prev_active = "prev_active";
@@ -130,19 +130,19 @@ public:
virtual String get_caption() const override;
- void set_fadein_time(float p_time);
- void set_fadeout_time(float p_time);
+ void set_fadein_time(double p_time);
+ void set_fadeout_time(double p_time);
- float get_fadein_time() const;
- float get_fadeout_time() const;
+ double get_fadein_time() const;
+ double get_fadeout_time() const;
void set_autorestart(bool p_active);
- void set_autorestart_delay(float p_time);
- void set_autorestart_random_delay(float p_time);
+ void set_autorestart_delay(double p_time);
+ void set_autorestart_random_delay(double p_time);
bool has_autorestart() const;
- float get_autorestart_delay() const;
- float get_autorestart_random_delay() const;
+ double get_autorestart_delay() const;
+ double get_autorestart_random_delay() const;
void set_mix_mode(MixMode p_mix);
MixMode get_mix_mode() const;
@@ -285,9 +285,9 @@ class AnimationNodeTransition : public AnimationNodeSync {
int enabled_inputs = 0;
/*
- float prev_xfading;
+ double prev_xfading;
int prev;
- float time;
+ double time;
int current;
int prev_current; */
@@ -297,7 +297,7 @@ class AnimationNodeTransition : public AnimationNodeSync {
StringName current = PNAME("current");
StringName prev_current = "prev_current";
- float xfade_time = 0.0;
+ double xfade_time = 0.0;
Ref<Curve> xfade_curve;
bool from_start = true;
@@ -322,8 +322,8 @@ public:
void set_input_caption(int p_input, const String &p_name);
String get_input_caption(int p_input) const;
- void set_xfade_time(float p_fade);
- float get_xfade_time() const;
+ void set_xfade_time(double p_fade);
+ double get_xfade_time() const;
void set_xfade_curve(const Ref<Curve> &p_curve);
Ref<Curve> get_xfade_curve() const;
diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp
index 49a59de9b2..8291df8036 100644
--- a/scene/animation/animation_node_state_machine.cpp
+++ b/scene/animation/animation_node_state_machine.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "animation_node_state_machine.h"
+#include "scene/main/window.h"
/////////////////////////////////////////////////
@@ -88,14 +89,6 @@ String AnimationNodeStateMachineTransition::get_advance_expression() const {
return advance_expression;
}
-void AnimationNodeStateMachineTransition::set_advance_expression_base_node(const NodePath &p_expression_base_node) {
- advance_expression_base_node = p_expression_base_node;
-}
-
-NodePath AnimationNodeStateMachineTransition::get_advance_expression_base_node() const {
- return advance_expression_base_node;
-}
-
void AnimationNodeStateMachineTransition::set_xfade_time(float p_xfade) {
ERR_FAIL_COND(p_xfade < 0);
xfade_time = p_xfade;
@@ -157,9 +150,6 @@ void AnimationNodeStateMachineTransition::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_advance_expression", "text"), &AnimationNodeStateMachineTransition::set_advance_expression);
ClassDB::bind_method(D_METHOD("get_advance_expression"), &AnimationNodeStateMachineTransition::get_advance_expression);
- ClassDB::bind_method(D_METHOD("set_advance_expression_base_node", "path"), &AnimationNodeStateMachineTransition::set_advance_expression_base_node);
- ClassDB::bind_method(D_METHOD("get_advance_expression_base_node"), &AnimationNodeStateMachineTransition::get_advance_expression_base_node);
-
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "xfade_time", PROPERTY_HINT_RANGE, "0,240,0.01,suffix:s"), "set_xfade_time", "get_xfade_time");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "xfade_curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve"), "set_xfade_curve", "get_xfade_curve");
ADD_PROPERTY(PropertyInfo(Variant::INT, "priority", PROPERTY_HINT_RANGE, "0,32,1"), "set_priority", "get_priority");
@@ -169,7 +159,6 @@ void AnimationNodeStateMachineTransition::_bind_methods() {
ADD_GROUP("Advance", "advance_");
ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "advance_condition"), "set_advance_condition", "get_advance_condition");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "advance_expression", PROPERTY_HINT_EXPRESSION, ""), "set_advance_expression", "get_advance_expression");
- ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "advance_expression_base_node"), "set_advance_expression_base_node", "get_advance_expression_base_node");
ADD_GROUP("Disabling", "");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "disabled"), "set_disabled", "is_disabled");
@@ -655,14 +644,11 @@ bool AnimationNodeStateMachinePlayback::_check_advance_condition(const Ref<Anima
AnimationTree *tree_base = state_machine->get_animation_tree();
ERR_FAIL_COND_V(tree_base == nullptr, false);
- NodePath advance_expression_base_node_path;
- if (!transition->advance_expression_base_node.is_empty()) {
- advance_expression_base_node_path = transition->advance_expression_base_node;
- } else {
- advance_expression_base_node_path = tree_base->get_advance_expression_base_node();
- }
-
+ NodePath advance_expression_base_node_path = tree_base->get_advance_expression_base_node();
Node *expression_base = tree_base->get_node_or_null(advance_expression_base_node_path);
+
+ WARN_PRINT_ONCE("Animation transition has a valid expression, but no expression base node was set on its AnimationTree.");
+
if (expression_base) {
Ref<Expression> exp = transition->expression;
bool ret = exp->execute(Array(), expression_base, false, Engine::get_singleton()->is_editor_hint()); // Avoids allowing the user to crash the system with an expression by only allowing const calls.
@@ -725,11 +711,11 @@ void AnimationNodeStateMachine::add_node(const StringName &p_name, Ref<Animation
ERR_FAIL_COND(p_node.is_null());
ERR_FAIL_COND(String(p_name).contains("/"));
- State state;
- state.node = p_node;
- state.position = p_position;
+ State state_new;
+ state_new.node = p_node;
+ state_new.position = p_position;
- states[p_name] = state;
+ states[p_name] = state_new;
Ref<AnimationNodeStateMachine> anodesm = p_node;
@@ -957,8 +943,8 @@ bool AnimationNodeStateMachine::_can_connect(const StringName &p_name, Vector<An
return true;
}
- String name = p_name;
- Vector<String> path = name.split("/");
+ String node_name = p_name;
+ Vector<String> path = node_name.split("/");
if (path.size() < 2) {
return false;
@@ -966,12 +952,12 @@ bool AnimationNodeStateMachine::_can_connect(const StringName &p_name, Vector<An
if (path[0] == "..") {
if (prev_state_machine != nullptr) {
- return prev_state_machine->_can_connect(name.replace_first("../", ""), p_parents);
+ return prev_state_machine->_can_connect(node_name.replace_first("../", ""), p_parents);
}
} else if (states.has(path[0])) {
Ref<AnimationNodeStateMachine> anodesm = states[path[0]].node;
if (anodesm.is_valid()) {
- return anodesm->_can_connect(name.replace_first(path[0] + "/", ""), p_parents);
+ return anodesm->_can_connect(node_name.replace_first(path[0] + "/", ""), p_parents);
}
}
@@ -1148,10 +1134,10 @@ Vector2 AnimationNodeStateMachine::get_graph_offset() const {
}
double AnimationNodeStateMachine::process(double p_time, bool p_seek, bool p_seek_root) {
- Ref<AnimationNodeStateMachinePlayback> playback = get_parameter(this->playback);
- ERR_FAIL_COND_V(playback.is_null(), 0.0);
+ Ref<AnimationNodeStateMachinePlayback> playback_new = get_parameter(playback);
+ ERR_FAIL_COND_V(playback_new.is_null(), 0.0);
- return playback->process(this, p_time, p_seek, p_seek_root);
+ return playback_new->process(this, p_time, p_seek, p_seek_root);
}
String AnimationNodeStateMachine::get_caption() const {
@@ -1175,10 +1161,10 @@ Ref<AnimationNode> AnimationNodeStateMachine::get_child_by_name(const StringName
}
bool AnimationNodeStateMachine::_set(const StringName &p_name, const Variant &p_value) {
- String name = p_name;
- if (name.begins_with("states/")) {
- String node_name = name.get_slicec('/', 1);
- String what = name.get_slicec('/', 2);
+ String prop_name = p_name;
+ if (prop_name.begins_with("states/")) {
+ String node_name = prop_name.get_slicec('/', 1);
+ String what = prop_name.get_slicec('/', 2);
if (what == "node") {
Ref<AnimationNode> anode = p_value;
@@ -1194,7 +1180,7 @@ bool AnimationNodeStateMachine::_set(const StringName &p_name, const Variant &p_
}
return true;
}
- } else if (name == "transitions") {
+ } else if (prop_name == "transitions") {
Array trans = p_value;
ERR_FAIL_COND_V(trans.size() % 3 != 0, false);
@@ -1202,7 +1188,7 @@ bool AnimationNodeStateMachine::_set(const StringName &p_name, const Variant &p_
add_transition(trans[i], trans[i + 1], trans[i + 2]);
}
return true;
- } else if (name == "graph_offset") {
+ } else if (prop_name == "graph_offset") {
set_graph_offset(p_value);
return true;
}
@@ -1211,10 +1197,10 @@ bool AnimationNodeStateMachine::_set(const StringName &p_name, const Variant &p_
}
bool AnimationNodeStateMachine::_get(const StringName &p_name, Variant &r_ret) const {
- String name = p_name;
- if (name.begins_with("states/")) {
- String node_name = name.get_slicec('/', 1);
- String what = name.get_slicec('/', 2);
+ String prop_name = p_name;
+ if (prop_name.begins_with("states/")) {
+ String node_name = prop_name.get_slicec('/', 1);
+ String what = prop_name.get_slicec('/', 2);
if (what == "node") {
if (states.has(node_name) && can_edit_node(node_name)) {
@@ -1229,7 +1215,7 @@ bool AnimationNodeStateMachine::_get(const StringName &p_name, Variant &r_ret) c
return true;
}
}
- } else if (name == "transitions") {
+ } else if (prop_name == "transitions") {
Array trans;
for (int i = 0; i < transitions.size(); i++) {
String from = transitions[i].from;
@@ -1246,7 +1232,7 @@ bool AnimationNodeStateMachine::_get(const StringName &p_name, Variant &r_ret) c
r_ret = trans;
return true;
- } else if (name == "graph_offset") {
+ } else if (prop_name == "graph_offset") {
r_ret = get_graph_offset();
return true;
}
@@ -1261,9 +1247,9 @@ void AnimationNodeStateMachine::_get_property_list(List<PropertyInfo> *p_list) c
}
names.sort_custom<StringName::AlphCompare>();
- for (const StringName &name : names) {
- p_list->push_back(PropertyInfo(Variant::OBJECT, "states/" + name + "/node", PROPERTY_HINT_RESOURCE_TYPE, "AnimationNode", PROPERTY_USAGE_NO_EDITOR));
- p_list->push_back(PropertyInfo(Variant::VECTOR2, "states/" + name + "/position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR));
+ for (const StringName &prop_name : names) {
+ p_list->push_back(PropertyInfo(Variant::OBJECT, "states/" + prop_name + "/node", PROPERTY_HINT_RESOURCE_TYPE, "AnimationNode", PROPERTY_USAGE_NO_EDITOR));
+ p_list->push_back(PropertyInfo(Variant::VECTOR2, "states/" + prop_name + "/position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR));
}
p_list->push_back(PropertyInfo(Variant::ARRAY, "transitions", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR));
diff --git a/scene/animation/animation_node_state_machine.h b/scene/animation/animation_node_state_machine.h
index ab78b1afe8..cdb4c7528a 100644
--- a/scene/animation/animation_node_state_machine.h
+++ b/scene/animation/animation_node_state_machine.h
@@ -54,7 +54,6 @@ private:
bool disabled = false;
int priority = 1;
String advance_expression;
- NodePath advance_expression_base_node;
friend class AnimationNodeStateMachinePlayback;
Ref<Expression> expression;
@@ -77,9 +76,6 @@ public:
void set_advance_expression(const String &p_expression);
String get_advance_expression() const;
- void set_advance_expression_base_node(const NodePath &p_expression_base_node);
- NodePath get_advance_expression_base_node() const;
-
void set_xfade_time(float p_xfade);
float get_xfade_time() const;
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp
index ce9406883d..59930a3fbb 100644
--- a/scene/animation/animation_player.cpp
+++ b/scene/animation/animation_player.cpp
@@ -109,7 +109,7 @@ bool AnimationPlayer::_set(const StringName &p_name, const Variant &p_value) {
Ref<AnimationLibrary> lib = d[lib_name];
add_animation_library(lib_name, lib);
}
-
+ emit_signal("animation_libraries_updated");
} else if (name.begins_with("next/")) {
String which = name.get_slicec('/', 1);
animation_set_next(which, p_value);
@@ -156,7 +156,7 @@ bool AnimationPlayer::_get(const StringName &p_name, Variant &r_ret) const {
} else if (name == "blend_times") {
Vector<BlendKey> keys;
- for (const KeyValue<BlendKey, float> &E : blend_times) {
+ for (const KeyValue<BlendKey, double> &E : blend_times) {
keys.ordered_insert(E.key);
}
@@ -216,7 +216,7 @@ void AnimationPlayer::_get_property_list(List<PropertyInfo> *p_list) const {
p_list->push_back(PropertyInfo(Variant::ARRAY, "blend_times", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL));
}
-void AnimationPlayer::advance(float p_time) {
+void AnimationPlayer::advance(double p_time) {
_animation_process(p_time);
}
@@ -1274,6 +1274,23 @@ void AnimationPlayer::_animation_set_cache_update() {
}
void AnimationPlayer::_animation_added(const StringName &p_name, const StringName &p_library) {
+ {
+ int at_pos = -1;
+
+ for (uint32_t i = 0; i < animation_libraries.size(); i++) {
+ if (animation_libraries[i].name == p_library) {
+ at_pos = i;
+ break;
+ }
+ }
+
+ ERR_FAIL_COND(at_pos == -1);
+
+ ERR_FAIL_COND(!animation_libraries[at_pos].library->animations.has(p_name));
+
+ _ref_anim(animation_libraries[at_pos].library->animations[p_name]);
+ }
+
_animation_set_cache_update();
}
@@ -1283,11 +1300,17 @@ void AnimationPlayer::_animation_removed(const StringName &p_name, const StringN
if (!animation_set.has(name)) {
return; // No need to update because not the one from the library being used.
}
+
+ AnimationData animation_data = animation_set[name];
+ if (animation_data.animation_library == p_library) {
+ _unref_anim(animation_data.animation);
+ }
+
_animation_set_cache_update();
// Erase blends if needed
List<BlendKey> to_erase;
- for (const KeyValue<BlendKey, float> &E : blend_times) {
+ for (const KeyValue<BlendKey, double> &E : blend_times) {
BlendKey bk = E.key;
if (bk.from == name || bk.to == name) {
to_erase.push_back(bk);
@@ -1303,8 +1326,8 @@ void AnimationPlayer::_animation_removed(const StringName &p_name, const StringN
void AnimationPlayer::_rename_animation(const StringName &p_from_name, const StringName &p_to_name) {
// Rename autoplay or blends if needed.
List<BlendKey> to_erase;
- HashMap<BlendKey, float, BlendKey> to_insert;
- for (const KeyValue<BlendKey, float> &E : blend_times) {
+ HashMap<BlendKey, double, BlendKey> to_insert;
+ for (const KeyValue<BlendKey, double> &E : blend_times) {
BlendKey bk = E.key;
BlendKey new_bk = bk;
bool erase = false;
@@ -1376,9 +1399,13 @@ Error AnimationPlayer::add_animation_library(const StringName &p_name, const Ref
animation_libraries.insert(insert_pos, ald);
ald.library->connect(SNAME("animation_added"), callable_mp(this, &AnimationPlayer::_animation_added).bind(p_name));
- ald.library->connect(SNAME("animation_removed"), callable_mp(this, &AnimationPlayer::_animation_added).bind(p_name));
+ ald.library->connect(SNAME("animation_removed"), callable_mp(this, &AnimationPlayer::_animation_removed).bind(p_name));
ald.library->connect(SNAME("animation_renamed"), callable_mp(this, &AnimationPlayer::_animation_renamed).bind(p_name));
+ for (const KeyValue<StringName, Ref<Animation>> &K : ald.library->animations) {
+ _ref_anim(K.value);
+ }
+
_animation_set_cache_update();
notify_property_list_changed();
@@ -1399,7 +1426,7 @@ void AnimationPlayer::remove_animation_library(const StringName &p_name) {
ERR_FAIL_COND(at_pos == -1);
animation_libraries[at_pos].library->disconnect(SNAME("animation_added"), callable_mp(this, &AnimationPlayer::_animation_added));
- animation_libraries[at_pos].library->disconnect(SNAME("animation_removed"), callable_mp(this, &AnimationPlayer::_animation_added));
+ animation_libraries[at_pos].library->disconnect(SNAME("animation_removed"), callable_mp(this, &AnimationPlayer::_animation_removed));
animation_libraries[at_pos].library->disconnect(SNAME("animation_renamed"), callable_mp(this, &AnimationPlayer::_animation_renamed));
stop();
@@ -1438,11 +1465,11 @@ void AnimationPlayer::rename_animation_library(const StringName &p_name, const S
animation_libraries[i].name = p_new_name;
// rename connections
animation_libraries[i].library->disconnect(SNAME("animation_added"), callable_mp(this, &AnimationPlayer::_animation_added));
- animation_libraries[i].library->disconnect(SNAME("animation_removed"), callable_mp(this, &AnimationPlayer::_animation_added));
+ animation_libraries[i].library->disconnect(SNAME("animation_removed"), callable_mp(this, &AnimationPlayer::_animation_removed));
animation_libraries[i].library->disconnect(SNAME("animation_renamed"), callable_mp(this, &AnimationPlayer::_animation_renamed));
animation_libraries[i].library->connect(SNAME("animation_added"), callable_mp(this, &AnimationPlayer::_animation_added).bind(p_new_name));
- animation_libraries[i].library->connect(SNAME("animation_removed"), callable_mp(this, &AnimationPlayer::_animation_added).bind(p_new_name));
+ animation_libraries[i].library->connect(SNAME("animation_removed"), callable_mp(this, &AnimationPlayer::_animation_removed).bind(p_new_name));
animation_libraries[i].library->connect(SNAME("animation_renamed"), callable_mp(this, &AnimationPlayer::_animation_renamed).bind(p_new_name));
for (const KeyValue<StringName, Ref<Animation>> &K : animation_libraries[i].library->animations) {
@@ -1504,9 +1531,9 @@ bool AnimationPlayer::has_animation(const StringName &p_name) const {
Ref<Animation> AnimationPlayer::get_animation(const StringName &p_name) const {
ERR_FAIL_COND_V_MSG(!animation_set.has(p_name), Ref<Animation>(), vformat("Animation not found: \"%s\".", p_name));
- const AnimationData &data = animation_set[p_name];
+ const AnimationData &anim_data = animation_set[p_name];
- return data.animation;
+ return anim_data.animation;
}
void AnimationPlayer::get_animation_list(List<StringName> *p_animations) const {
@@ -1523,7 +1550,7 @@ void AnimationPlayer::get_animation_list(List<StringName> *p_animations) const {
}
}
-void AnimationPlayer::set_blend_time(const StringName &p_animation1, const StringName &p_animation2, float p_time) {
+void AnimationPlayer::set_blend_time(const StringName &p_animation1, const StringName &p_animation2, double p_time) {
ERR_FAIL_COND_MSG(!animation_set.has(p_animation1), vformat("Animation not found: %s.", p_animation1));
ERR_FAIL_COND_MSG(!animation_set.has(p_animation2), vformat("Animation not found: %s.", p_animation2));
ERR_FAIL_COND_MSG(p_time < 0, "Blend time cannot be smaller than 0.");
@@ -1538,7 +1565,7 @@ void AnimationPlayer::set_blend_time(const StringName &p_animation1, const Strin
}
}
-float AnimationPlayer::get_blend_time(const StringName &p_animation1, const StringName &p_animation2) const {
+double AnimationPlayer::get_blend_time(const StringName &p_animation1, const StringName &p_animation2) const {
BlendKey bk;
bk.from = p_animation1;
bk.to = p_animation2;
@@ -1571,11 +1598,11 @@ void AnimationPlayer::clear_queue() {
queued.clear();
}
-void AnimationPlayer::play_backwards(const StringName &p_name, float p_custom_blend) {
+void AnimationPlayer::play_backwards(const StringName &p_name, double p_custom_blend) {
play(p_name, p_custom_blend, -1, true);
}
-void AnimationPlayer::play(const StringName &p_name, float p_custom_blend, float p_custom_scale, bool p_from_end) {
+void AnimationPlayer::play(const StringName &p_name, double p_custom_blend, float p_custom_scale, bool p_from_end) {
StringName name = p_name;
if (String(name) == "") {
@@ -1587,7 +1614,7 @@ void AnimationPlayer::play(const StringName &p_name, float p_custom_blend, float
Playback &c = playback;
if (c.current.from) {
- float blend_time = 0.0;
+ double blend_time = 0.0;
// find if it can blend
BlendKey bk;
bk.from = c.current.from->name;
@@ -1741,7 +1768,7 @@ void AnimationPlayer::seek(double p_time, bool p_update) {
}
}
-void AnimationPlayer::seek_delta(double p_time, float p_delta) {
+void AnimationPlayer::seek_delta(double p_time, double p_delta) {
if (!playback.current.from) {
if (playback.assigned) {
ERR_FAIL_COND_MSG(!animation_set.has(playback.assigned), vformat("Animation not found: %s.", playback.assigned));
@@ -1762,12 +1789,12 @@ bool AnimationPlayer::is_valid() const {
return (playback.current.from);
}
-float AnimationPlayer::get_current_animation_position() const {
+double AnimationPlayer::get_current_animation_position() const {
ERR_FAIL_COND_V_MSG(!playback.current.from, 0, "AnimationPlayer has no current animation");
return playback.current.pos;
}
-float AnimationPlayer::get_current_animation_length() const {
+double AnimationPlayer::get_current_animation_length() const {
ERR_FAIL_COND_V_MSG(!playback.current.from, 0, "AnimationPlayer has no current animation");
return playback.current.from->animation->get_length();
}
@@ -1933,11 +1960,11 @@ StringName AnimationPlayer::animation_get_next(const StringName &p_animation) co
return animation_set[p_animation].next;
}
-void AnimationPlayer::set_default_blend_time(float p_default) {
+void AnimationPlayer::set_default_blend_time(double p_default) {
default_blend_time = p_default;
}
-float AnimationPlayer::get_default_blend_time() const {
+double AnimationPlayer::get_default_blend_time() const {
return default_blend_time;
}
@@ -2037,10 +2064,9 @@ Ref<AnimatedValuesBackup> AnimationPlayer::apply_reset(bool p_user_initiated) {
aux_player->add_animation_library("", al);
aux_player->set_assigned_animation(SceneStringNames::get_singleton()->RESET);
// Forcing the use of the original root because the scene where original player belongs may be not the active one
- Node *root = get_node(get_root());
- Ref<AnimatedValuesBackup> old_values = aux_player->backup_animated_values(root);
+ Ref<AnimatedValuesBackup> old_values = aux_player->backup_animated_values(get_node(get_root()));
aux_player->seek(0.0f, true);
- aux_player->queue_delete();
+ aux_player->queue_free();
if (p_user_initiated) {
Ref<AnimatedValuesBackup> new_values = aux_player->backup_animated_values();
@@ -2152,6 +2178,7 @@ void AnimationPlayer::_bind_methods() {
ADD_SIGNAL(MethodInfo("animation_changed", PropertyInfo(Variant::STRING_NAME, "old_name"), PropertyInfo(Variant::STRING_NAME, "new_name")));
ADD_SIGNAL(MethodInfo("animation_started", PropertyInfo(Variant::STRING_NAME, "anim_name")));
ADD_SIGNAL(MethodInfo("animation_list_changed"));
+ ADD_SIGNAL(MethodInfo("animation_libraries_updated"));
ADD_SIGNAL(MethodInfo("caches_cleared"));
BIND_ENUM_CONSTANT(ANIMATION_PROCESS_PHYSICS);
diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h
index caf1387ff0..4f32927d25 100644
--- a/scene/animation/animation_player.h
+++ b/scene/animation/animation_player.h
@@ -191,7 +191,7 @@ private:
uint64_t accum_pass = 1;
float speed_scale = 1.0;
- float default_blend_time = 0.0;
+ double default_blend_time = 0.0;
struct AnimationData {
String name;
@@ -230,7 +230,7 @@ private:
}
};
- HashMap<BlendKey, float, BlendKey> blend_times;
+ HashMap<BlendKey, double, BlendKey> blend_times;
struct PlaybackData {
AnimationData *from = nullptr;
@@ -241,8 +241,8 @@ private:
struct Blend {
PlaybackData data;
- float blend_time = 0.0;
- float blend_left = 0.0;
+ double blend_time = 0.0;
+ double blend_left = 0.0;
};
struct Playback {
@@ -334,17 +334,17 @@ public:
void get_animation_list(List<StringName> *p_animations) const;
bool has_animation(const StringName &p_name) const;
- void set_blend_time(const StringName &p_animation1, const StringName &p_animation2, float p_time);
- float get_blend_time(const StringName &p_animation1, const StringName &p_animation2) const;
+ void set_blend_time(const StringName &p_animation1, const StringName &p_animation2, double p_time);
+ double get_blend_time(const StringName &p_animation1, const StringName &p_animation2) const;
void animation_set_next(const StringName &p_animation, const StringName &p_next);
StringName animation_get_next(const StringName &p_animation) const;
- void set_default_blend_time(float p_default);
- float get_default_blend_time() const;
+ void set_default_blend_time(double p_default);
+ double get_default_blend_time() const;
- void play(const StringName &p_name = StringName(), float p_custom_blend = -1, float p_custom_scale = 1.0, bool p_from_end = false);
- void play_backwards(const StringName &p_name = StringName(), float p_custom_blend = -1);
+ void play(const StringName &p_name = StringName(), double p_custom_blend = -1, float p_custom_scale = 1.0, bool p_from_end = false);
+ void play_backwards(const StringName &p_name = StringName(), double p_custom_blend = -1);
void queue(const StringName &p_name);
Vector<String> get_queue();
void clear_queue();
@@ -378,11 +378,11 @@ public:
bool is_movie_quit_on_finish_enabled() const;
void seek(double p_time, bool p_update = false);
- void seek_delta(double p_time, float p_delta);
- float get_current_animation_position() const;
- float get_current_animation_length() const;
+ void seek_delta(double p_time, double p_delta);
+ double get_current_animation_position() const;
+ double get_current_animation_length() const;
- void advance(float p_time);
+ void advance(double p_time);
void set_root(const NodePath &p_root);
NodePath get_root() const;
diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp
index 776706d7f3..517908077d 100644
--- a/scene/animation/animation_tree.cpp
+++ b/scene/animation/animation_tree.cpp
@@ -50,10 +50,8 @@ void AnimationNode::get_parameter_list(List<PropertyInfo> *r_list) const {
Variant AnimationNode::get_parameter_default_value(const StringName &p_parameter) const {
Variant ret;
- if (GDVIRTUAL_CALL(_get_parameter_default_value, p_parameter, ret)) {
- return ret;
- }
- return Variant();
+ GDVIRTUAL_CALL(_get_parameter_default_value, p_parameter, ret);
+ return ret;
}
void AnimationNode::set_parameter(const StringName &p_name, const Variant &p_value) {
@@ -97,8 +95,8 @@ void AnimationNode::blend_animation(const StringName &p_animation, double p_time
if (animation.is_null()) {
AnimationNodeBlendTree *btree = Object::cast_to<AnimationNodeBlendTree>(parent);
if (btree) {
- String name = btree->get_node_name(Ref<AnimationNodeAnimation>(this));
- make_invalid(vformat(RTR("In node '%s', invalid animation: '%s'."), name, p_animation));
+ String node_name = btree->get_node_name(Ref<AnimationNodeAnimation>(this));
+ make_invalid(vformat(RTR("In node '%s', invalid animation: '%s'."), node_name, p_animation));
} else {
make_invalid(vformat(RTR("Invalid animation: '%s'."), p_animation));
}
@@ -160,8 +158,8 @@ double AnimationNode::blend_input(int p_input, double p_time, bool p_seek, bool
StringName node_name = connections[p_input];
if (!blend_tree->has_node(node_name)) {
- String name = blend_tree->get_node_name(Ref<AnimationNode>(this));
- make_invalid(vformat(RTR("Nothing connected to input '%s' of node '%s'."), get_input_name(p_input), name));
+ String node_name2 = blend_tree->get_node_name(Ref<AnimationNode>(this));
+ make_invalid(vformat(RTR("Nothing connected to input '%s' of node '%s'."), get_input_name(p_input), node_name2));
return 0;
}
@@ -312,12 +310,9 @@ String AnimationNode::get_input_name(int p_input) {
}
String AnimationNode::get_caption() const {
- String ret;
- if (GDVIRTUAL_CALL(_get_caption, ret)) {
- return ret;
- }
-
- return "Node";
+ String ret = "Node";
+ GDVIRTUAL_CALL(_get_caption, ret);
+ return ret;
}
void AnimationNode::add_input(const String &p_name) {
@@ -344,12 +339,9 @@ void AnimationNode::remove_input(int p_index) {
}
double AnimationNode::process(double p_time, bool p_seek, bool p_seek_root) {
- double ret;
- if (GDVIRTUAL_CALL(_process, p_time, p_seek, p_seek_root, ret)) {
- return ret;
- }
-
- return 0;
+ double ret = 0;
+ GDVIRTUAL_CALL(_process, p_time, p_seek, p_seek_root, ret);
+ return ret;
}
void AnimationNode::set_filter_path(const NodePath &p_path, bool p_enable) {
@@ -373,12 +365,9 @@ bool AnimationNode::is_path_filtered(const NodePath &p_path) const {
}
bool AnimationNode::has_filter() const {
- bool ret;
- if (GDVIRTUAL_CALL(_has_filter, ret)) {
- return ret;
- }
-
- return false;
+ bool ret = false;
+ GDVIRTUAL_CALL(_has_filter, ret);
+ return ret;
}
Array AnimationNode::_get_filters() const {
@@ -407,10 +396,8 @@ void AnimationNode::_validate_property(PropertyInfo &p_property) const {
Ref<AnimationNode> AnimationNode::get_child_by_name(const StringName &p_name) {
Ref<AnimationNode> ret;
- if (GDVIRTUAL_CALL(_get_child_by_name, p_name, ret)) {
- return ret;
- }
- return Ref<AnimationNode>();
+ GDVIRTUAL_CALL(_get_child_by_name, p_name, ret);
+ return ret;
}
void AnimationNode::_bind_methods() {
@@ -1565,11 +1552,7 @@ void AnimationTree::_process_graph(double p_delta) {
}
real_t db = Math::linear_to_db(MAX(blend, 0.00001));
- if (t->object->has_method(SNAME("set_unit_db"))) {
- t->object->call(SNAME("set_unit_db"), db);
- } else {
- t->object->call(SNAME("set_volume_db"), db);
- }
+ t->object->call(SNAME("set_volume_db"), db);
} break;
case Animation::TYPE_ANIMATION: {
if (blend < CMP_EPSILON) {
@@ -1745,7 +1728,7 @@ Variant AnimationTree::_post_process_key_value(const Ref<Animation> &p_anim, int
return p_value;
}
-void AnimationTree::advance(real_t p_time) {
+void AnimationTree::advance(double p_time) {
_process_graph(p_time);
}
@@ -1849,8 +1832,8 @@ uint64_t AnimationTree::get_last_process_pass() const {
return process_pass;
}
-TypedArray<String> AnimationTree::get_configuration_warnings() const {
- TypedArray<String> warnings = Node::get_configuration_warnings();
+PackedStringArray AnimationTree::get_configuration_warnings() const {
+ PackedStringArray warnings = Node::get_configuration_warnings();
if (!root.is_valid()) {
warnings.push_back(RTR("No root AnimationNode for the graph is set."));
diff --git a/scene/animation/animation_tree.h b/scene/animation/animation_tree.h
index 573448be93..96c1279f82 100644
--- a/scene/animation/animation_tree.h
+++ b/scene/animation/animation_tree.h
@@ -342,7 +342,7 @@ public:
void set_advance_expression_base_node(const NodePath &p_advance_expression_base_node);
NodePath get_advance_expression_base_node() const;
- TypedArray<String> get_configuration_warnings() const override;
+ PackedStringArray get_configuration_warnings() const override;
bool is_state_invalid() const;
String get_invalid_state_reason() const;
@@ -353,7 +353,7 @@ public:
Transform3D get_root_motion_transform() const;
real_t get_connection_activity(const StringName &p_path, int p_connection) const;
- void advance(real_t p_time);
+ void advance(double p_time);
void rename_parameter(const String &p_base, const String &p_new_base);
diff --git a/scene/animation/easing_equations.h b/scene/animation/easing_equations.h
index 094829e406..03d9e16454 100644
--- a/scene/animation/easing_equations.h
+++ b/scene/animation/easing_equations.h
@@ -28,6 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#ifndef EASING_EQUATIONS_H
+#define EASING_EQUATIONS_H
+
/*
* Derived from Robert Penner's easing equations: http://robertpenner.com/easing/
*
@@ -52,9 +55,6 @@
* SOFTWARE.
*/
-#ifndef EASING_EQUATIONS_H
-#define EASING_EQUATIONS_H
-
namespace linear {
static real_t in(real_t t, real_t b, real_t c, real_t d) {
return c * t / d + b;
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp
index b02f1959b7..aa58e1044a 100644
--- a/scene/animation/tween.cpp
+++ b/scene/animation/tween.cpp
@@ -71,16 +71,16 @@ void Tween::start_tweeners() {
}
}
-Ref<PropertyTweener> Tween::tween_property(Object *p_target, NodePath p_property, Variant p_to, float p_duration) {
+Ref<PropertyTweener> Tween::tween_property(Object *p_target, NodePath p_property, Variant p_to, double p_duration) {
ERR_FAIL_NULL_V(p_target, nullptr);
ERR_FAIL_COND_V_MSG(!valid, nullptr, "Tween invalid. Either finished or created outside scene tree.");
ERR_FAIL_COND_V_MSG(started, nullptr, "Can't append to a Tween that has started. Use stop() first.");
Variant::Type property_type = p_target->get_indexed(p_property.get_as_property_path().get_subnames()).get_type();
if (property_type != p_to.get_type()) {
- // Cast p_to between floats and ints to avoid minor annoyances.
+ // Cast p_to between double and int to avoid minor annoyances.
if (property_type == Variant::FLOAT && p_to.get_type() == Variant::INT) {
- p_to = float(p_to);
+ p_to = double(p_to);
} else if (property_type == Variant::INT && p_to.get_type() == Variant::FLOAT) {
p_to = int(p_to);
} else {
@@ -93,7 +93,7 @@ Ref<PropertyTweener> Tween::tween_property(Object *p_target, NodePath p_property
return tweener;
}
-Ref<IntervalTweener> Tween::tween_interval(float p_time) {
+Ref<IntervalTweener> Tween::tween_interval(double p_time) {
ERR_FAIL_COND_V_MSG(!valid, nullptr, "Tween invalid. Either finished or created outside scene tree.");
ERR_FAIL_COND_V_MSG(started, nullptr, "Can't append to a Tween that has started. Use stop() first.");
@@ -111,7 +111,7 @@ Ref<CallbackTweener> Tween::tween_callback(Callable p_callback) {
return tweener;
}
-Ref<MethodTweener> Tween::tween_method(Callable p_callback, Variant p_from, Variant p_to, float p_duration) {
+Ref<MethodTweener> Tween::tween_method(Callable p_callback, Variant p_from, Variant p_to, double p_duration) {
ERR_FAIL_COND_V_MSG(!valid, nullptr, "Tween invalid. Either finished or created outside scene tree.");
ERR_FAIL_COND_V_MSG(started, nullptr, "Can't append to a Tween that has started. Use stop() first.");
@@ -245,7 +245,7 @@ Ref<Tween> Tween::chain() {
return this;
}
-bool Tween::custom_step(float p_delta) {
+bool Tween::custom_step(double p_delta) {
bool r = running;
running = true;
bool ret = step(p_delta);
@@ -253,7 +253,7 @@ bool Tween::custom_step(float p_delta) {
return ret;
}
-bool Tween::step(float p_delta) {
+bool Tween::step(double p_delta) {
if (dead) {
return false;
}
@@ -263,9 +263,9 @@ bool Tween::step(float p_delta) {
}
if (is_bound) {
- Node *bound_node = get_bound_node();
- if (bound_node) {
- if (!bound_node->is_inside_tree()) {
+ Node *node = get_bound_node();
+ if (node) {
+ if (!node->is_inside_tree()) {
return true;
}
} else {
@@ -282,22 +282,22 @@ bool Tween::step(float p_delta) {
started = true;
}
- float rem_delta = p_delta * speed_scale;
+ double rem_delta = p_delta * speed_scale;
bool step_active = false;
total_time += rem_delta;
#ifdef DEBUG_ENABLED
- float initial_delta = rem_delta;
+ double initial_delta = rem_delta;
bool potential_infinite = false;
#endif
while (rem_delta > 0 && running) {
- float step_delta = rem_delta;
+ double step_delta = rem_delta;
step_active = false;
for (Ref<Tweener> &tweener : tweeners.write[current_step]) {
// Modified inside Tweener.step().
- float temp_delta = rem_delta;
+ double temp_delta = rem_delta;
// Turns to true if any Tweener returns true (i.e. is still not finished).
step_active = tweener->step(temp_delta) || step_active;
step_delta = MIN(temp_delta, step_delta);
@@ -342,9 +342,9 @@ bool Tween::step(float p_delta) {
bool Tween::can_process(bool p_tree_paused) const {
if (is_bound && pause_mode == TWEEN_PAUSE_BOUND) {
- Node *bound_node = get_bound_node();
- if (bound_node) {
- return bound_node->is_inside_tree() && bound_node->can_process();
+ Node *node = get_bound_node();
+ if (node) {
+ return node->is_inside_tree() && node->can_process();
}
}
@@ -359,7 +359,7 @@ Node *Tween::get_bound_node() const {
}
}
-float Tween::get_total_time() const {
+double Tween::get_total_time() const {
return total_time;
}
@@ -373,7 +373,7 @@ real_t Tween::run_equation(TransitionType p_trans_type, EaseType p_ease_type, re
return func(p_time, p_initial, p_delta, p_duration);
}
-Variant Tween::interpolate_variant(Variant p_initial_val, Variant p_delta_val, float p_time, float p_duration, TransitionType p_trans, EaseType p_ease) {
+Variant Tween::interpolate_variant(Variant p_initial_val, Variant p_delta_val, double p_time, double p_duration, TransitionType p_trans, EaseType p_ease) {
ERR_FAIL_INDEX_V(p_trans, TransitionType::TRANS_MAX, Variant());
ERR_FAIL_INDEX_V(p_ease, EaseType::EASE_MAX, Variant());
@@ -480,7 +480,7 @@ Ref<PropertyTweener> PropertyTweener::set_ease(Tween::EaseType p_ease) {
return this;
}
-Ref<PropertyTweener> PropertyTweener::set_delay(float p_delay) {
+Ref<PropertyTweener> PropertyTweener::set_delay(double p_delay) {
delay = p_delay;
return this;
}
@@ -506,7 +506,7 @@ void PropertyTweener::start() {
delta_val = Animation::subtract_variant(final_val, initial_val);
}
-bool PropertyTweener::step(float &r_delta) {
+bool PropertyTweener::step(double &r_delta) {
if (finished) {
// This is needed in case there's a parallel Tweener with longer duration.
return false;
@@ -523,7 +523,7 @@ bool PropertyTweener::step(float &r_delta) {
return true;
}
- float time = MIN(elapsed_time - delay, duration);
+ double time = MIN(elapsed_time - delay, duration);
if (time < duration) {
target_instance->set_indexed(property, tween->interpolate_variant(initial_val, delta_val, time, duration, trans_type, ease_type));
r_delta = 0;
@@ -556,7 +556,7 @@ void PropertyTweener::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_delay", "delay"), &PropertyTweener::set_delay);
}
-PropertyTweener::PropertyTweener(Object *p_target, NodePath p_property, Variant p_to, float p_duration) {
+PropertyTweener::PropertyTweener(Object *p_target, NodePath p_property, Variant p_to, double p_duration) {
target = p_target->get_instance_id();
property = p_property.get_as_property_path().get_subnames();
initial_val = p_target->get_indexed(property);
@@ -574,7 +574,7 @@ void IntervalTweener::start() {
finished = false;
}
-bool IntervalTweener::step(float &r_delta) {
+bool IntervalTweener::step(double &r_delta) {
if (finished) {
return false;
}
@@ -592,7 +592,7 @@ bool IntervalTweener::step(float &r_delta) {
}
}
-IntervalTweener::IntervalTweener(float p_time) {
+IntervalTweener::IntervalTweener(double p_time) {
duration = p_time;
}
@@ -600,7 +600,7 @@ IntervalTweener::IntervalTweener() {
ERR_FAIL_MSG("Can't create empty IntervalTweener. Use get_tree().tween_interval() instead.");
}
-Ref<CallbackTweener> CallbackTweener::set_delay(float p_delay) {
+Ref<CallbackTweener> CallbackTweener::set_delay(double p_delay) {
delay = p_delay;
return this;
}
@@ -610,7 +610,7 @@ void CallbackTweener::start() {
finished = false;
}
-bool CallbackTweener::step(float &r_delta) {
+bool CallbackTweener::step(double &r_delta) {
if (finished) {
return false;
}
@@ -646,7 +646,7 @@ CallbackTweener::CallbackTweener() {
ERR_FAIL_MSG("Can't create empty CallbackTweener. Use get_tree().tween_callback() instead.");
}
-Ref<MethodTweener> MethodTweener::set_delay(float p_delay) {
+Ref<MethodTweener> MethodTweener::set_delay(double p_delay) {
delay = p_delay;
return this;
}
@@ -666,7 +666,7 @@ void MethodTweener::start() {
finished = false;
}
-bool MethodTweener::step(float &r_delta) {
+bool MethodTweener::step(double &r_delta) {
if (finished) {
return false;
}
@@ -679,7 +679,7 @@ bool MethodTweener::step(float &r_delta) {
}
Variant current_val;
- float time = MIN(elapsed_time - delay, duration);
+ double time = MIN(elapsed_time - delay, duration);
if (time < duration) {
current_val = tween->interpolate_variant(initial_val, delta_val, time, duration, trans_type, ease_type);
} else {
@@ -722,7 +722,7 @@ void MethodTweener::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_ease", "ease"), &MethodTweener::set_ease);
}
-MethodTweener::MethodTweener(Callable p_callback, Variant p_from, Variant p_to, float p_duration) {
+MethodTweener::MethodTweener(Callable p_callback, Variant p_from, Variant p_to, double p_duration) {
callback = p_callback;
initial_val = p_from;
delta_val = Animation::subtract_variant(p_to, p_from);
diff --git a/scene/animation/tween.h b/scene/animation/tween.h
index da7a8b5d71..345974ecc5 100644
--- a/scene/animation/tween.h
+++ b/scene/animation/tween.h
@@ -42,13 +42,13 @@ class Tweener : public RefCounted {
public:
virtual void set_tween(Ref<Tween> p_tween);
virtual void start() = 0;
- virtual bool step(float &r_delta) = 0;
+ virtual bool step(double &r_delta) = 0;
void clear_tween();
protected:
static void _bind_methods();
Ref<Tween> tween;
- float elapsed_time = 0;
+ double elapsed_time = 0;
bool finished = false;
};
@@ -103,7 +103,7 @@ private:
ObjectID bound_node;
Vector<List<Ref<Tweener>>> tweeners;
- float total_time = 0;
+ double total_time = 0;
int current_step = -1;
int loops = 1;
int loops_done = 0;
@@ -129,13 +129,13 @@ protected:
static void _bind_methods();
public:
- Ref<PropertyTweener> tween_property(Object *p_target, NodePath p_property, Variant p_to, float p_duration);
- Ref<IntervalTweener> tween_interval(float p_time);
+ Ref<PropertyTweener> tween_property(Object *p_target, NodePath p_property, Variant p_to, double p_duration);
+ Ref<IntervalTweener> tween_interval(double p_time);
Ref<CallbackTweener> tween_callback(Callable p_callback);
- Ref<MethodTweener> tween_method(Callable p_callback, Variant p_from, Variant p_to, float p_duration);
+ Ref<MethodTweener> tween_method(Callable p_callback, Variant p_from, Variant p_to, double p_duration);
void append(Ref<Tweener> p_tweener);
- bool custom_step(float p_delta);
+ bool custom_step(double p_delta);
void stop();
void pause();
void play();
@@ -163,12 +163,12 @@ public:
Ref<Tween> chain();
static real_t run_equation(TransitionType p_trans_type, EaseType p_ease_type, real_t t, real_t b, real_t c, real_t d);
- static Variant interpolate_variant(Variant p_initial_val, Variant p_delta_val, float p_time, float p_duration, Tween::TransitionType p_trans, Tween::EaseType p_ease);
+ static Variant interpolate_variant(Variant p_initial_val, Variant p_delta_val, double p_time, double p_duration, Tween::TransitionType p_trans, Tween::EaseType p_ease);
- bool step(float p_delta);
+ bool step(double p_delta);
bool can_process(bool p_tree_paused) const;
Node *get_bound_node() const;
- float get_total_time() const;
+ double get_total_time() const;
Tween();
Tween(bool p_valid);
@@ -188,13 +188,13 @@ public:
Ref<PropertyTweener> as_relative();
Ref<PropertyTweener> set_trans(Tween::TransitionType p_trans);
Ref<PropertyTweener> set_ease(Tween::EaseType p_ease);
- Ref<PropertyTweener> set_delay(float p_delay);
+ Ref<PropertyTweener> set_delay(double p_delay);
void set_tween(Ref<Tween> p_tween) override;
void start() override;
- bool step(float &r_delta) override;
+ bool step(double &r_delta) override;
- PropertyTweener(Object *p_target, NodePath p_property, Variant p_to, float p_duration);
+ PropertyTweener(Object *p_target, NodePath p_property, Variant p_to, double p_duration);
PropertyTweener();
protected:
@@ -208,11 +208,11 @@ private:
Variant final_val;
Variant delta_val;
- float duration = 0;
+ double duration = 0;
Tween::TransitionType trans_type = Tween::TRANS_MAX; // This is set inside set_tween();
Tween::EaseType ease_type = Tween::EASE_MAX;
- float delay = 0;
+ double delay = 0;
bool do_continue = true;
bool relative = false;
};
@@ -222,23 +222,23 @@ class IntervalTweener : public Tweener {
public:
void start() override;
- bool step(float &r_delta) override;
+ bool step(double &r_delta) override;
- IntervalTweener(float p_time);
+ IntervalTweener(double p_time);
IntervalTweener();
private:
- float duration = 0;
+ double duration = 0;
};
class CallbackTweener : public Tweener {
GDCLASS(CallbackTweener, Tweener);
public:
- Ref<CallbackTweener> set_delay(float p_delay);
+ Ref<CallbackTweener> set_delay(double p_delay);
void start() override;
- bool step(float &r_delta) override;
+ bool step(double &r_delta) override;
CallbackTweener(Callable p_callback);
CallbackTweener();
@@ -248,7 +248,7 @@ protected:
private:
Callable callback;
- float delay = 0;
+ double delay = 0;
};
class MethodTweener : public Tweener {
@@ -257,21 +257,21 @@ class MethodTweener : public Tweener {
public:
Ref<MethodTweener> set_trans(Tween::TransitionType p_trans);
Ref<MethodTweener> set_ease(Tween::EaseType p_ease);
- Ref<MethodTweener> set_delay(float p_delay);
+ Ref<MethodTweener> set_delay(double p_delay);
void set_tween(Ref<Tween> p_tween) override;
void start() override;
- bool step(float &r_delta) override;
+ bool step(double &r_delta) override;
- MethodTweener(Callable p_callback, Variant p_from, Variant p_to, float p_duration);
+ MethodTweener(Callable p_callback, Variant p_from, Variant p_to, double p_duration);
MethodTweener();
protected:
static void _bind_methods();
private:
- float duration = 0;
- float delay = 0;
+ double duration = 0;
+ double delay = 0;
Tween::TransitionType trans_type = Tween::TRANS_MAX;
Tween::EaseType ease_type = Tween::EASE_MAX;