fix bezier editor throws error on ctrl click
This commit is contained in:
parent
907db8eebc
commit
71cff32f45
1 changed files with 2 additions and 10 deletions
|
@ -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 a new issue