mirror of
https://github.com/godotengine/godot.git
synced 2024-11-27 09:16:35 +08:00
Merge pull request #88360 from CookieBadger/bezier-ctrl-click-add-key-fix
Fix Bezier Editor throwing error when adding key with CTRL+click
This commit is contained in:
commit
e42141fe8a
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user