diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-02-15 15:45:31 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-02-15 15:45:31 +0100 |
commit | e42141fe8a1f6ec4cf910a02defc2d6ade58cb1a (patch) | |
tree | 0f71865fdbb73df45cb6575865c6e92fc7c9d296 /editor/animation_bezier_editor.cpp | |
parent | b8a402b3cb41fc417cd5cf3ce4ecb8daee7f9445 (diff) | |
parent | 71cff32f45d6f5e160f17d9284103dea36a2bc73 (diff) | |
download | redot-engine-e42141fe8a1f6ec4cf910a02defc2d6ade58cb1a.tar.gz |
Merge pull request #88360 from CookieBadger/bezier-ctrl-click-add-key-fix
Fix Bezier Editor throwing error when adding key with CTRL+click
Diffstat (limited to 'editor/animation_bezier_editor.cpp')
-rw-r--r-- | editor/animation_bezier_editor.cpp | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index c612b02ab7..e1ce08b83e 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -1143,16 +1143,8 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) { //insert new point if (mb->get_position().x >= limit && mb->get_position().x < get_size().width && mb->is_command_or_control_pressed()) { - Array new_point; - new_point.resize(5); - float h = (get_size().height / 2.0 - mb->get_position().y) * timeline_v_zoom + timeline_v_scroll; - - new_point[0] = h; - new_point[1] = -0.25; - new_point[2] = 0; - new_point[3] = 0.25; - new_point[4] = 0; + Array new_point = make_default_bezier_key(h); real_t time = ((mb->get_position().x - limit) / timeline->get_zoom_scale()) + timeline->get_value(); while (animation->track_find_key(selected_track, time, Animation::FIND_MODE_APPROX) != -1) { @@ -1161,7 +1153,7 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) { EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); undo_redo->create_action(TTR("Add Bezier Point")); - undo_redo->add_do_method(animation.ptr(), "bezier_track_insert_key", selected_track, time, new_point); + undo_redo->add_do_method(animation.ptr(), "bezier_track_insert_key", selected_track, time, new_point[0], Vector2(new_point[1], new_point[2]), Vector2(new_point[3], new_point[4])); undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_time", selected_track, time); undo_redo->commit_action(); |