diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-09-12 09:17:54 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-09-12 09:17:54 +0200 |
commit | 18cdfb81011969efcab0dd0725a2fc6b6fdc00fd (patch) | |
tree | 9a06bfa65e40fd49498e02f82454636f5aabcb88 | |
parent | f33a81977bf09f81f6301a7e1ccc5717f60f56e1 (diff) | |
parent | 09515bfc6c5f90c5ff7992454100edeb1c1765aa (diff) | |
download | redot-engine-18cdfb81011969efcab0dd0725a2fc6b6fdc00fd.tar.gz |
Merge pull request #96789 from SaracenOne/bezier_fixes
Fix errors when creating bezier component tracks.
-rw-r--r-- | editor/animation_track_editor.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 95ba301282..55bae8e592 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -4345,6 +4345,25 @@ PropertyInfo AnimationTrackEditor::_find_hint_for_track(int p_idx, NodePath &r_b property_info_base = property_info_base.get_named(leftover_path[i], valid); } + // Hack for the fact that bezier tracks leftover paths can reference + // the individual components for types like vectors. + if (property_info_base.is_null()) { + if (res.is_valid()) { + property_info_base = res; + } else if (node) { + property_info_base = node; + } + + if (leftover_path.size()) { + leftover_path.remove_at(leftover_path.size() - 1); + } + + for (int i = 0; i < leftover_path.size() - 1; i++) { + bool valid; + property_info_base = property_info_base.get_named(leftover_path[i], valid); + } + } + if (property_info_base.is_null()) { WARN_PRINT(vformat("Could not determine track hint for '%s:%s' because its base property is null.", String(path.get_concatenated_names()), String(path.get_concatenated_subnames()))); @@ -4472,7 +4491,11 @@ AnimationTrackEditor::TrackIndices AnimationTrackEditor::_confirm_insert(InsertD } break; case Animation::TYPE_BEZIER: { - int existing = animation->track_find_key(p_id.track_idx, time, Animation::FIND_MODE_APPROX); + int existing = -1; + if (p_id.track_idx < animation->get_track_count()) { + existing = animation->track_find_key(p_id.track_idx, time, Animation::FIND_MODE_APPROX); + } + if (existing != -1) { Array arr = animation->track_get_key_value(p_id.track_idx, existing); arr[0] = p_id.value; |