summaryrefslogtreecommitdiffstats
path: root/scene/animation/tween.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/animation/tween.cpp')
-rw-r--r--scene/animation/tween.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp
index c778129eb6..d6a6af3f08 100644
--- a/scene/animation/tween.cpp
+++ b/scene/animation/tween.cpp
@@ -104,7 +104,15 @@ Ref<PropertyTweener> Tween::tween_property(const Object *p_target, const NodePat
CHECK_VALID();
Vector<StringName> property_subnames = p_property.get_as_property_path().get_subnames();
- if (!_validate_type_match(p_target->get_indexed(property_subnames), p_to)) {
+#ifdef DEBUG_ENABLED
+ bool prop_valid;
+ const Variant &prop_value = p_target->get_indexed(property_subnames, &prop_valid);
+ ERR_FAIL_COND_V_MSG(!prop_valid, nullptr, vformat("The tweened property \"%s\" does not exist in object \"%s\".", p_property, p_target));
+#else
+ const Variant &prop_value = p_target->get_indexed(property_subnames);
+#endif
+
+ if (!_validate_type_match(prop_value, p_to)) {
return nullptr;
}
@@ -412,13 +420,8 @@ Variant Tween::interpolate_variant(const Variant &p_initial_val, const Variant &
ERR_FAIL_INDEX_V(p_trans, TransitionType::TRANS_MAX, Variant());
ERR_FAIL_INDEX_V(p_ease, EaseType::EASE_MAX, Variant());
- // Special case for bool.
- if (p_initial_val.get_type() == Variant::BOOL) {
- return run_equation(p_trans, p_ease, p_time, p_initial_val, p_delta_val, p_duration) >= 0.5;
- }
-
Variant ret = Animation::add_variant(p_initial_val, p_delta_val);
- ret = Animation::interpolate_variant(p_initial_val, ret, run_equation(p_trans, p_ease, p_time, 0.0, 1.0, p_duration));
+ ret = Animation::interpolate_variant(p_initial_val, ret, run_equation(p_trans, p_ease, p_time, 0.0, 1.0, p_duration), p_initial_val.is_string());
return ret;
}