Skip to content

Commit

Permalink
Merge pull request #88459 from CookieBadger/animation-bezier-selectio…
Browse files Browse the repository at this point in the history
…n-fixes

Fix Animation Bezier Editor key selection bugs
  • Loading branch information
akien-mga committed Feb 20, 2024
2 parents 12de2f1 + 080315c commit 2cc14f3
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions editor/animation_bezier_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -840,19 +840,30 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {
}
accept_event();
}
if (ED_IS_SHORTCUT("animation_editor/cut_selected_keys", p_event)) {
if (!read_only) {
copy_selected_keys(true);
}
accept_event();
}
if (ED_IS_SHORTCUT("animation_editor/copy_selected_keys", p_event)) {
if (!read_only) {
copy_selected_keys(false);
}
accept_event();
}

if (ED_IS_SHORTCUT("animation_editor/paste_keys", p_event)) {
if (!read_only) {
paste_keys(-1.0);
}
accept_event();
}
if (ED_IS_SHORTCUT("animation_editor/delete_selection", p_event)) {
if (!read_only) {
delete_selection();
}
accept_event();
}
}

Ref<InputEventKey> key_press = p_event;
Expand Down Expand Up @@ -1247,7 +1258,7 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) {

if (moving_selection_attempt && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
if (!read_only) {
if (moving_selection) {
if (moving_selection && (abs(moving_selection_offset.x) > 0 || abs(moving_selection_offset.y) > 0)) {
//combit it

EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
Expand Down Expand Up @@ -1504,7 +1515,7 @@ bool AnimationBezierTrackEdit::_try_select_at_ui_pos(const Point2 &p_pos, bool p
}

set_animation_and_track(animation, pair.first, read_only);
if (p_deselectable || !selection.has(pair)) {
if (!selection.has(pair)) {
selection.clear();
selection.insert(pair);
}
Expand Down

0 comments on commit 2cc14f3

Please sign in to comment.