From 3c596094ab0d65461e64442942ffea21ccc5a5bc Mon Sep 17 00:00:00 2001 From: jsjtxietian Date: Mon, 22 Jan 2024 10:47:52 +0800 Subject: [PATCH] Fix pass int to tween's from with float property will be forced to interpolate as int --- scene/animation/tween.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index 8193bbf3f16..34fc83500fb 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -505,11 +505,13 @@ Tween::Tween(bool p_valid) { Ref PropertyTweener::from(const Variant &p_value) { ERR_FAIL_COND_V(tween.is_null(), nullptr); - if (!tween->_validate_type_match(p_value, final_val)) { + + Variant from_value = p_value; + if (!tween->_validate_type_match(final_val, from_value)) { return nullptr; } - initial_val = p_value; + initial_val = from_value; do_continue = false; return this; }