From 633df0b29c7ec602377ea7367f7ad047f90b90f1 Mon Sep 17 00:00:00 2001 From: Sofox Date: Mon, 23 Sep 2024 19:59:44 +0100 Subject: [PATCH] Handle handle_modes being undefined by giving default values rather than flagging error --- scene/resources/animation.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index a2ed6af23c3..2a576a50624 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -321,8 +321,12 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) { Vector times = d["times"]; Vector values = d["points"]; #ifdef TOOLS_ENABLED - ERR_FAIL_COND_V(!d.has("handle_modes"), false); - Vector handle_modes = d["handle_modes"]; + Vector handle_modes; + if (d.has("handle_modes")) { + handle_modes = d["handle_modes"]; + } else { + handle_modes.resize_zeroed(times.size()); + } #endif // TOOLS_ENABLED ERR_FAIL_COND_V(times.size() * 5 != values.size(), false);