Merge pull request #97380 from TheSofox/handle_modes_default_fix

Ensure `handle_modes` is given default values rather than flagging error if undefined
This commit is contained in:
Rémi Verschelde 2024-09-25 12:39:22 +02:00
commit 4c5e879cc5
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 6 additions and 2 deletions

View File

@ -321,8 +321,12 @@ bool Animation::_set(const StringName &p_name, const Variant &p_value) {
Vector<real_t> times = d["times"]; Vector<real_t> times = d["times"];
Vector<real_t> values = d["points"]; Vector<real_t> values = d["points"];
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
ERR_FAIL_COND_V(!d.has("handle_modes"), false); Vector<int> handle_modes;
Vector<int> handle_modes = d["handle_modes"]; if (d.has("handle_modes")) {
handle_modes = d["handle_modes"];
} else {
handle_modes.resize_zeroed(times.size());
}
#endif // TOOLS_ENABLED #endif // TOOLS_ENABLED
ERR_FAIL_COND_V(times.size() * 5 != values.size(), false); ERR_FAIL_COND_V(times.size() * 5 != values.size(), false);