diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-09-25 12:39:22 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-09-25 12:39:22 +0200 |
commit | 4c5e879cc57c47f6225a22a56a1acdc016c95470 (patch) | |
tree | 101a5f33b3e21143c0c14c620ceab4658e7f38f0 | |
parent | 65c94ec8731914fbadafc9ba2535dd83a00cca14 (diff) | |
parent | 633df0b29c7ec602377ea7367f7ad047f90b90f1 (diff) | |
download | redot-engine-4c5e879cc57c47f6225a22a56a1acdc016c95470.tar.gz |
Merge pull request #97380 from TheSofox/handle_modes_default_fix
Ensure `handle_modes` is given default values rather than flagging error if undefined
-rw-r--r-- | scene/resources/animation.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index eff0e883de..9abc6a02d2 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<real_t> times = d["times"]; Vector<real_t> values = d["points"]; #ifdef TOOLS_ENABLED - ERR_FAIL_COND_V(!d.has("handle_modes"), false); - Vector<int> handle_modes = d["handle_modes"]; + Vector<int> 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); |