Fix pass int to tween's from with float property will be forced to interpolate as int

(cherry picked from commit 3c596094ab)
This commit is contained in:
jsjtxietian 2024-01-22 10:47:52 +08:00 committed by Rémi Verschelde
parent 0b03a281e1
commit c71cda870b
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 4 additions and 2 deletions

View File

@ -505,11 +505,13 @@ Tween::Tween(bool p_valid) {
Ref<PropertyTweener> PropertyTweener::from(const Variant &p_value) { Ref<PropertyTweener> PropertyTweener::from(const Variant &p_value) {
ERR_FAIL_COND_V(tween.is_null(), nullptr); 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; return nullptr;
} }
initial_val = p_value; initial_val = from_value;
do_continue = false; do_continue = false;
return this; return this;
} }