diff options
author | CookieBadger <emil.dobetsberger@gmail.com> | 2024-02-15 14:34:53 +0100 |
---|---|---|
committer | CookieBadger <emil.dobetsberger@gmail.com> | 2024-02-15 14:34:53 +0100 |
commit | 71cff32f45d6f5e160f17d9284103dea36a2bc73 (patch) | |
tree | fddf0634522283ed74b809d21f60e72f75df7c6c /editor/animation_bezier_editor.cpp | |
parent | 907db8eebcecb97d527edcaff77a1c87a6c068f5 (diff) | |
download | redot-engine-71cff32f45d6f5e160f17d9284103dea36a2bc73.tar.gz |
fix bezier editor throws error on 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 b69faa7152..5029b5caa9 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(); |