summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-01-26 11:45:25 +0100
committerRémi Verschelde <rverschelde@gmail.com>2024-01-26 11:45:25 +0100
commit2a861ab5a2dfb2ce878da39ad959fd36bc013963 (patch)
treed7d20339ffe000c0a3acd6e2d92656d4a5e2c628
parent62c87dc83e1b1b58d94d7de544965d090ea73258 (diff)
parent3c596094ab0d65461e64442942ffea21ccc5a5bc (diff)
downloadredot-engine-2a861ab5a2dfb2ce878da39ad959fd36bc013963.tar.gz
Merge pull request #87459 from jsjtxietian/tween-from
Fix passing int to tween's `from` with float property will be forced to interpolate as int
-rw-r--r--scene/animation/tween.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp
index 8193bbf3f1..34fc83500f 100644
--- a/scene/animation/tween.cpp
+++ b/scene/animation/tween.cpp
@@ -505,11 +505,13 @@ Tween::Tween(bool p_valid) {
Ref<PropertyTweener> 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;
}