diff options
author | Silc Renew <tokage.it.lab@gmail.com> | 2022-08-22 19:45:30 +0900 |
---|---|---|
committer | Silc Renew <tokage.it.lab@gmail.com> | 2022-08-23 19:14:03 +0900 |
commit | 9327296e732d9d50aa556c3d335b2c18ba3c3420 (patch) | |
tree | 1f85a69910d8d8657518de504a03bbd22abbfc42 /editor | |
parent | 5e0d2b5097d5091490f6ca84c5e9188c4ebefa4b (diff) |
Add bezier preset and refactor bezier editor
Co-authored-by: Razoric480 <razoric480@gmail.com>
Diffstat (limited to 'editor')
-rw-r--r-- | editor/animation_bezier_editor.cpp | 290 | ||||
-rw-r--r-- | editor/animation_bezier_editor.h | 38 | ||||
-rw-r--r-- | editor/animation_track_editor.cpp | 108 | ||||
-rw-r--r-- | editor/animation_track_editor.h | 4 | ||||
-rw-r--r-- | editor/icons/BezierHandlesBalanced.svg | 2 | ||||
-rw-r--r-- | editor/icons/BezierHandlesFree.svg | 2 | ||||
-rw-r--r-- | editor/icons/BezierHandlesLinear.svg | 1 | ||||
-rw-r--r-- | editor/icons/BezierHandlesMirror.svg | 2 |
8 files changed, 277 insertions, 170 deletions
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index e10ed7e976..76e10db154 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -40,7 +40,7 @@ float AnimationBezierTrackEdit::_bezier_h_to_pixel(float p_h) { float h = p_h; h = (h - v_scroll) / v_zoom; - h = (get_size().height / 2) - h; + h = (get_size().height / 2.0) - h; return h; } @@ -51,10 +51,10 @@ void AnimationBezierTrackEdit::_draw_track(int p_track, const Color &p_color) { int right_limit = get_size().width; //selection may have altered the order of keys - RBMap<float, int> key_order; + RBMap<real_t, int> key_order; for (int i = 0; i < animation->track_get_key_count(p_track); i++) { - float ofs = animation->track_get_key_time(p_track, i); + real_t ofs = animation->track_get_key_time(p_track, i); if (moving_selection && selection.has(IntPair(p_track, i))) { ofs += moving_selection_offset.x; } @@ -62,7 +62,7 @@ void AnimationBezierTrackEdit::_draw_track(int p_track, const Color &p_color) { key_order[ofs] = i; } - for (RBMap<float, int>::Element *E = key_order.front(); E; E = E->next()) { + for (RBMap<real_t, int>::Element *E = key_order.front(); E; E = E->next()) { int i = E->get(); if (!E->next()) { @@ -74,7 +74,7 @@ void AnimationBezierTrackEdit::_draw_track(int p_track, const Color &p_color) { float offset = animation->track_get_key_time(p_track, i); float height = animation->bezier_track_get_key_value(p_track, i); Vector2 out_handle = animation->bezier_track_get_key_out_handle(p_track, i); - if (p_track == moving_handle_track && moving_handle != 0 && moving_handle_key == i) { + if (p_track == moving_handle_track && (moving_handle == -1 || moving_handle == 1) && moving_handle_key == i) { out_handle = moving_handle_right; } @@ -88,7 +88,7 @@ void AnimationBezierTrackEdit::_draw_track(int p_track, const Color &p_color) { float offset_n = animation->track_get_key_time(p_track, i_n); float height_n = animation->bezier_track_get_key_value(p_track, i_n); Vector2 in_handle = animation->bezier_track_get_key_in_handle(p_track, i_n); - if (p_track == moving_handle_track && moving_handle != 0 && moving_handle_key == i_n) { + if (p_track == moving_handle_track && (moving_handle == -1 || moving_handle == 1) && moving_handle_key == i_n) { in_handle = moving_handle_left; } @@ -138,7 +138,7 @@ void AnimationBezierTrackEdit::_draw_track(int p_track, const Color &p_color) { //narrow high and low as much as possible for (int k = 0; k < iterations; k++) { - float middle = (low + high) / 2; + float middle = (low + high) / 2.0; Vector2 interp = start.bezier_interpolate(out_handle, in_handle, end, middle); @@ -315,7 +315,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) { int h = MAX(text_buf.get_size().y, icon->get_height()); - draw_texture(icon, Point2(ofs, vofs + int(h - icon->get_height()) / 2)); + draw_texture(icon, Point2(ofs, vofs + int(h - icon->get_height()) / 2.0)); ofs += icon->get_width(); margin = icon->get_width(); @@ -402,29 +402,29 @@ void AnimationBezierTrackEdit::_notification(int p_what) { Vector2 string_pos = Point2(margin, vofs); text_buf.draw(get_canvas_item(), string_pos, cc); - float icon_start_height = vofs + rect.size.y / 2; - Rect2 remove_rect = Rect2(remove_hpos, icon_start_height - remove->get_height() / 2, remove->get_width(), remove->get_height()); + float icon_start_height = vofs + rect.size.y / 2.0; + Rect2 remove_rect = Rect2(remove_hpos, icon_start_height - remove->get_height() / 2.0, remove->get_width(), remove->get_height()); if (read_only) { draw_texture(remove, remove_rect.position, dc); } else { draw_texture(remove, remove_rect.position); } - Rect2 lock_rect = Rect2(lock_hpos, icon_start_height - lock->get_height() / 2, lock->get_width(), lock->get_height()); + Rect2 lock_rect = Rect2(lock_hpos, icon_start_height - lock->get_height() / 2.0, lock->get_width(), lock->get_height()); if (locked_tracks.has(current_track)) { draw_texture(lock, lock_rect.position); } else { draw_texture(unlock, lock_rect.position); } - Rect2 visible_rect = Rect2(visibility_hpos, icon_start_height - visible->get_height() / 2, visible->get_width(), visible->get_height()); + Rect2 visible_rect = Rect2(visibility_hpos, icon_start_height - visible->get_height() / 2.0, visible->get_width(), visible->get_height()); if (hidden_tracks.has(current_track)) { draw_texture(hidden, visible_rect.position); } else { draw_texture(visible, visible_rect.position); } - Rect2 solo_rect = Rect2(solo_hpos, icon_start_height - solo->get_height() / 2, solo->get_width(), solo->get_height()); + Rect2 solo_rect = Rect2(solo_hpos, icon_start_height - solo->get_height() / 2.0, solo->get_width(), solo->get_height()); draw_texture(solo, solo_rect.position); RBMap<int, Rect2> track_icons; @@ -455,7 +455,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) { bool first = true; int prev_iv = 0; for (int i = font->get_height(font_size); i < get_size().height; i++) { - float ofs = get_size().height / 2 - i; + float ofs = get_size().height / 2.0 - i; ofs *= v_zoom; ofs += v_scroll; @@ -494,7 +494,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) { Vector2 pos((offset - timeline->get_value()) * scale + limit, _bezier_h_to_pixel(value)); if (pos.x >= limit && pos.x <= right_limit) { - draw_texture(point, pos - point->get_size() / 2, E.value); + draw_texture(point, pos - point->get_size() / 2.0, E.value); } } } @@ -546,14 +546,15 @@ void AnimationBezierTrackEdit::_notification(int p_what) { Vector2 pos((offset - timeline->get_value()) * scale + limit, _bezier_h_to_pixel(value)); Vector2 in_vec = animation->bezier_track_get_key_in_handle(i, j); - if (moving_handle != 0 && moving_handle_track == i && moving_handle_key == j) { + + if ((moving_handle == 1 || moving_handle == -1) && moving_handle_track == i && moving_handle_key == j) { in_vec = moving_handle_left; } Vector2 pos_in(((offset + in_vec.x) - timeline->get_value()) * scale + limit, _bezier_h_to_pixel(value + in_vec.y)); Vector2 out_vec = animation->bezier_track_get_key_out_handle(i, j); - if (moving_handle != 0 && moving_handle_track == i && moving_handle_key == j) { + if ((moving_handle == 1 || moving_handle == -1) && moving_handle_track == i && moving_handle_key == j) { out_vec = moving_handle_right; } @@ -568,7 +569,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) { ep.track = i; ep.key = j; if (pos.x >= limit && pos.x <= right_limit) { - ep.point_rect.position = (pos - bezier_icon->get_size() / 2).floor(); + ep.point_rect.position = (pos - bezier_icon->get_size() / 2.0).floor(); ep.point_rect.size = bezier_icon->get_size(); if (selection.has(IntPair(i, j))) { draw_texture(selected_icon, ep.point_rect.position); @@ -583,18 +584,22 @@ void AnimationBezierTrackEdit::_notification(int p_what) { } ep.point_rect = ep.point_rect.grow(ep.point_rect.size.width * 0.5); } + ep.point_rect = ep.point_rect.grow(ep.point_rect.size.width * 0.5); + if (i == selected_track || selection.has(IntPair(i, j))) { - if (pos_in.x >= limit && pos_in.x <= right_limit) { - ep.in_rect.position = (pos_in - bezier_handle_icon->get_size() / 2).floor(); - ep.in_rect.size = bezier_handle_icon->get_size(); - draw_texture(bezier_handle_icon, ep.in_rect.position); - ep.in_rect = ep.in_rect.grow(ep.in_rect.size.width * 0.5); - } - if (pos_out.x >= limit && pos_out.x <= right_limit) { - ep.out_rect.position = (pos_out - bezier_handle_icon->get_size() / 2).floor(); - ep.out_rect.size = bezier_handle_icon->get_size(); - draw_texture(bezier_handle_icon, ep.out_rect.position); - ep.out_rect = ep.out_rect.grow(ep.out_rect.size.width * 0.5); + if (animation->bezier_track_get_key_handle_mode(i, j) != Animation::HANDLE_MODE_LINEAR) { + if (pos_in.x >= limit && pos_in.x <= right_limit) { + ep.in_rect.position = (pos_in - bezier_handle_icon->get_size() / 2.0).floor(); + ep.in_rect.size = bezier_handle_icon->get_size(); + draw_texture(bezier_handle_icon, ep.in_rect.position); + ep.in_rect = ep.in_rect.grow(ep.in_rect.size.width * 0.5); + } + if (pos_out.x >= limit && pos_out.x <= right_limit) { + ep.out_rect.position = (pos_out - bezier_handle_icon->get_size() / 2.0).floor(); + ep.out_rect.size = bezier_handle_icon->get_size(); + draw_texture(bezier_handle_icon, ep.out_rect.position); + ep.out_rect = ep.out_rect.grow(ep.out_rect.size.width * 0.5); + } } } if (!locked_tracks.has(i)) { @@ -663,7 +668,6 @@ void AnimationBezierTrackEdit::set_editor(AnimationTrackEditor *p_editor) { editor = p_editor; connect("clear_selection", Callable(editor, "_clear_selection").bind(false)); connect("select_key", Callable(editor, "_key_selected"), CONNECT_DEFERRED); - connect("deselect_key", Callable(editor, "_key_deselected"), CONNECT_DEFERRED); } void AnimationBezierTrackEdit::_play_position_draw() { @@ -684,7 +688,7 @@ void AnimationBezierTrackEdit::_play_position_draw() { } } -void AnimationBezierTrackEdit::set_play_position(float p_pos) { +void AnimationBezierTrackEdit::set_play_position(real_t p_pos) { play_position_pos = p_pos; play_position->update(); } @@ -785,13 +789,14 @@ void AnimationBezierTrackEdit::_clear_selection() { update(); } -void AnimationBezierTrackEdit::_change_selected_keys_handle_mode(Animation::HandleMode p_mode) { +void AnimationBezierTrackEdit::_change_selected_keys_handle_mode(Animation::HandleMode p_mode, bool p_auto) { undo_redo->create_action(TTR("Update Selected Key Handles")); - double ratio = timeline->get_zoom_scale() * v_zoom; - for (const IntPair &E : selection) { - const IntPair track_key_pair = E; - undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_handle_mode", track_key_pair.first, track_key_pair.second, animation->bezier_track_get_key_handle_mode(track_key_pair.first, track_key_pair.second), ratio); - undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_handle_mode", track_key_pair.first, track_key_pair.second, p_mode, ratio); + for (SelectionSet::Element *E = selection.back(); E; E = E->prev()) { + const IntPair track_key_pair = E->get(); + undo_redo->add_undo_method(editor, "_bezier_track_set_key_handle_mode", animation.ptr(), track_key_pair.first, track_key_pair.second, animation->bezier_track_get_key_handle_mode(track_key_pair.first, track_key_pair.second), Animation::HANDLE_SET_MODE_NONE); + undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_in_handle", track_key_pair.first, track_key_pair.second, animation->bezier_track_get_key_in_handle(track_key_pair.first, track_key_pair.second)); + undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_out_handle", track_key_pair.first, track_key_pair.second, animation->bezier_track_get_key_out_handle(track_key_pair.first, track_key_pair.second)); + undo_redo->add_do_method(editor, "_bezier_track_set_key_handle_mode", animation.ptr(), track_key_pair.first, track_key_pair.second, p_mode, p_auto ? Animation::HANDLE_SET_MODE_AUTO : Animation::HANDLE_SET_MODE_RESET); } undo_redo->commit_action(); } @@ -803,7 +808,7 @@ void AnimationBezierTrackEdit::_clear_selection_for_anim(const Ref<Animation> &p _clear_selection(); } -void AnimationBezierTrackEdit::_select_at_anim(const Ref<Animation> &p_anim, int p_track, float p_pos) { +void AnimationBezierTrackEdit::_select_at_anim(const Ref<Animation> &p_anim, int p_track, real_t p_pos) { if (!(animation == p_anim)) { return; } @@ -812,7 +817,7 @@ void AnimationBezierTrackEdit::_select_at_anim(const Ref<Animation> &p_anim, int ERR_FAIL_COND(idx < 0); selection.insert(IntPair(p_track, idx)); - emit_signal(SNAME("select_key"), p_track, idx, true); + emit_signal(SNAME("select_key"), idx, true, p_track); update(); } @@ -868,16 +873,16 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) { return; } - float minimum_time = INFINITY; - float maximum_time = -INFINITY; - float minimum_value = INFINITY; - float maximum_value = -INFINITY; + real_t minimum_time = INFINITY; + real_t maximum_time = -INFINITY; + real_t minimum_value = INFINITY; + real_t maximum_value = -INFINITY; for (const IntPair &E : selection) { IntPair key_pair = E; - float time = animation->track_get_key_time(key_pair.first, key_pair.second); - float value = animation->bezier_track_get_key_value(key_pair.first, key_pair.second); + real_t time = animation->track_get_key_time(key_pair.first, key_pair.second); + real_t value = animation->bezier_track_get_key_value(key_pair.first, key_pair.second); minimum_time = MIN(time, minimum_time); maximum_time = MAX(time, maximum_time); @@ -887,8 +892,8 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) { float width = get_size().width - timeline->get_name_limit() - timeline->get_buttons_width(); float padding = width * 0.1; - float desired_scale = (width - padding / 2) / (maximum_time - minimum_time); - minimum_time = MAX(0, minimum_time - (padding / 2) / desired_scale); + float desired_scale = (width - padding / 2.0) / (maximum_time - minimum_time); + minimum_time = MAX(0, minimum_time - (padding / 2.0) / desired_scale); float zv = Math::pow(100 / desired_scale, 0.125f); if (zv < 1) { @@ -942,7 +947,12 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) { menu->add_icon_item(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), TTR("Delete Selected Key(s)"), MENU_KEY_DELETE); menu->add_separator(); menu->add_icon_item(get_theme_icon(SNAME("BezierHandlesFree"), SNAME("EditorIcons")), TTR("Make Handles Free"), MENU_KEY_SET_HANDLE_FREE); + menu->add_icon_item(get_theme_icon(SNAME("BezierHandlesLinear"), SNAME("EditorIcons")), TTR("Make Handles Linear"), MENU_KEY_SET_HANDLE_LINEAR); menu->add_icon_item(get_theme_icon(SNAME("BezierHandlesBalanced"), SNAME("EditorIcons")), TTR("Make Handles Balanced"), MENU_KEY_SET_HANDLE_BALANCED); + menu->add_icon_item(get_theme_icon(SNAME("BezierHandlesMirror"), SNAME("EditorIcons")), TTR("Make Handles Mirrored"), MENU_KEY_SET_HANDLE_MIRRORED); + menu->add_separator(); + menu->add_icon_item(get_theme_icon(SNAME("BezierHandlesBalanced"), SNAME("EditorIcons")), TTR("Make Handles Balanced (Auto Tangent)"), MENU_KEY_SET_HANDLE_AUTO_BALANCED); + menu->add_icon_item(get_theme_icon(SNAME("BezierHandlesMirror"), SNAME("EditorIcons")), TTR("Make Handles Mirrored (Auto Tangent)"), MENU_KEY_SET_HANDLE_AUTO_MIRRORED); } if (menu->get_item_count()) { @@ -984,9 +994,10 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) { for (int i = 0; i < animation->track_get_key_count(track); ++i) { undo_redo->add_undo_method( - animation.ptr(), - "bezier_track_insert_key", - track, animation->track_get_key_time(track, i), + this, + "_bezier_track_insert_key", + track, + animation->track_get_key_time(track, i), animation->bezier_track_get_key_value(track, i), animation->bezier_track_get_key_in_handle(track, i), animation->bezier_track_get_key_out_handle(track, i), @@ -1093,6 +1104,9 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) { moving_selection = false; moving_selection_from_key = pair.second; moving_selection_from_track = pair.first; + moving_handle_track = pair.first; + moving_handle_left = animation->bezier_track_get_key_in_handle(pair.first, pair.second); + moving_handle_right = animation->bezier_track_get_key_out_handle(pair.first, pair.second); moving_selection_offset = Vector2(); select_single_attempt = pair; update(); @@ -1102,10 +1116,12 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) { moving_selection_from_key = pair.second; moving_selection_from_track = pair.first; moving_selection_offset = Vector2(); - set_animation_and_track(animation, pair.first, read_only); + moving_handle_track = pair.first; + moving_handle_left = animation->bezier_track_get_key_in_handle(pair.first, pair.second); + moving_handle_right = animation->bezier_track_get_key_out_handle(pair.first, pair.second); selection.clear(); selection.insert(pair); - update(); + set_animation_and_track(animation, pair.first, read_only); } return; } @@ -1137,24 +1153,23 @@ 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_pressed()) { Array new_point; - new_point.resize(6); + new_point.resize(5); - float h = (get_size().height / 2 - mb->get_position().y) * v_zoom + v_scroll; + float h = (get_size().height / 2.0 - mb->get_position().y) * v_zoom + v_scroll; new_point[0] = h; new_point[1] = -0.25; new_point[2] = 0; new_point[3] = 0.25; new_point[4] = 0; - new_point[5] = 0; - float time = ((mb->get_position().x - limit) / timeline->get_zoom_scale()) + timeline->get_value(); + real_t time = ((mb->get_position().x - limit) / timeline->get_zoom_scale()) + timeline->get_value(); while (animation->track_find_key(selected_track, time, true) != -1) { time += 0.001; } undo_redo->create_action(TTR("Add Bezier Point")); - undo_redo->add_do_method(animation.ptr(), "track_insert_key", selected_track, time, new_point); + undo_redo->add_do_method(animation.ptr(), "bezier_track_insert_key", selected_track, time, new_point); undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_time", selected_track, time); undo_redo->commit_action(); @@ -1218,10 +1233,10 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) { //select by clicking on curve int track_count = animation->get_track_count(); - float animation_length = animation->get_length(); + real_t animation_length = animation->get_length(); animation->set_length(real_t(INT_MAX)); //bezier_track_interpolate doesn't find keys if they exist beyond anim length - float time = ((mb->get_position().x - limit) / timeline->get_zoom_scale()) + timeline->get_value(); + real_t time = ((mb->get_position().x - limit) / timeline->get_zoom_scale()) + timeline->get_value(); for (int i = 0; i < track_count; ++i) { if (animation->track_get_type(i) != Animation::TrackType::TYPE_BEZIER || hidden_tracks.has(i) || locked_tracks.has(i)) { @@ -1245,20 +1260,6 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) { update(); } - if (moving_handle != 0 && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) { - if (!read_only) { - undo_redo->create_action(TTR("Move Bezier Points")); - undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_in_handle", selected_track, moving_handle_key, moving_handle_left); - undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_out_handle", selected_track, moving_handle_key, moving_handle_right); - undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_in_handle", selected_track, moving_handle_key, animation->bezier_track_get_key_in_handle(selected_track, moving_handle_key)); - undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_out_handle", selected_track, moving_handle_key, animation->bezier_track_get_key_out_handle(selected_track, moving_handle_key)); - undo_redo->commit_action(); - - moving_handle = 0; - update(); - } - } - if (moving_selection_attempt && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) { if (!read_only) { if (moving_selection) { @@ -1267,13 +1268,14 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) { undo_redo->create_action(TTR("Move Bezier Points")); List<AnimMoveRestore> to_restore; + List<Animation::HandleMode> to_restore_handle_modes; // 1-remove the keys for (SelectionSet::Element *E = selection.back(); E; E = E->prev()) { undo_redo->add_do_method(animation.ptr(), "track_remove_key", E->get().first, E->get().second); } // 2- remove overlapped keys for (SelectionSet::Element *E = selection.back(); E; E = E->prev()) { - float newtime = editor->snap_time(animation->track_get_key_time(E->get().first, E->get().second) + moving_selection_offset.x); + real_t newtime = editor->snap_time(animation->track_get_key_time(E->get().first, E->get().second) + moving_selection_offset.x); int idx = animation->track_find_key(E->get().first, newtime, true); if (idx == -1) { @@ -1292,33 +1294,62 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) { amr.time = newtime; to_restore.push_back(amr); + to_restore_handle_modes.push_back(animation->bezier_track_get_key_handle_mode(E->get().first, idx)); } // 3-move the keys (re insert them) for (SelectionSet::Element *E = selection.back(); E; E = E->prev()) { - float newpos = editor->snap_time(animation->track_get_key_time(E->get().first, E->get().second) + moving_selection_offset.x); + real_t newpos = editor->snap_time(animation->track_get_key_time(E->get().first, E->get().second) + moving_selection_offset.x); Array key = animation->track_get_key_value(E->get().first, E->get().second); - float h = key[0]; + real_t h = key[0]; h += moving_selection_offset.y; key[0] = h; - undo_redo->add_do_method(animation.ptr(), "track_insert_key", E->get().first, newpos, key, 1); + undo_redo->add_do_method( + this, + "_bezier_track_insert_key", + E->get().first, + newpos, + key[0], + Vector2(key[1], key[2]), + Vector2(key[3], key[4]), + animation->bezier_track_get_key_handle_mode(E->get().first, E->get().second)); } // 4-(undo) remove inserted keys for (SelectionSet::Element *E = selection.back(); E; E = E->prev()) { - float newpos = editor->snap_time(animation->track_get_key_time(E->get().first, E->get().second) + moving_selection_offset.x); + real_t newpos = editor->snap_time(animation->track_get_key_time(E->get().first, E->get().second) + moving_selection_offset.x); undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_time", E->get().first, newpos); } // 5-(undo) reinsert keys for (SelectionSet::Element *E = selection.back(); E; E = E->prev()) { - float oldpos = animation->track_get_key_time(E->get().first, E->get().second); - undo_redo->add_undo_method(animation.ptr(), "track_insert_key", E->get().first, oldpos, animation->track_get_key_value(E->get().first, E->get().second), 1); + real_t oldpos = animation->track_get_key_time(E->get().first, E->get().second); + Array key = animation->track_get_key_value(E->get().first, E->get().second); + undo_redo->add_undo_method( + this, + "_bezier_track_insert_key", + E->get().first, + oldpos, + key[0], + Vector2(key[1], key[2]), + Vector2(key[3], key[4]), + animation->bezier_track_get_key_handle_mode(E->get().first, E->get().second)); } // 6-(undo) reinsert overlapped keys - for (const AnimMoveRestore &amr : to_restore) { + for (int i = 0; i < to_restore.size(); i++) { + const AnimMoveRestore &amr = to_restore[i]; + Array key = amr.key; undo_redo->add_undo_method(animation.ptr(), "track_insert_key", amr.track, amr.time, amr.key, 1); + undo_redo->add_undo_method( + this, + "_bezier_track_insert_key", + amr.track, + amr.time, + key[0], + Vector2(key[1], key[2]), + Vector2(key[3], key[4]), + to_restore_handle_modes[i]); } undo_redo->add_do_method(this, "_clear_selection_for_anim", animation); @@ -1327,8 +1358,8 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) { // 7-reselect for (SelectionSet::Element *E = selection.back(); E; E = E->prev()) { - float oldpos = animation->track_get_key_time(E->get().first, E->get().second); - float newpos = editor->snap_time(oldpos + moving_selection_offset.x); + real_t oldpos = animation->track_get_key_time(E->get().first, E->get().second); + real_t newpos = editor->snap_time(oldpos + moving_selection_offset.x); undo_redo->add_do_method(this, "_select_at_anim", animation, E->get().first, newpos); undo_redo->add_undo_method(this, "_select_at_anim", animation, E->get().first, oldpos); @@ -1355,12 +1386,16 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) { select_single_attempt = IntPair(-1, -1); } - float y = (get_size().height / 2 - mm->get_position().y) * v_zoom + v_scroll; + float y = (get_size().height / 2.0 - mm->get_position().y) * v_zoom + v_scroll; float x = editor->snap_time(((mm->get_position().x - limit) / timeline->get_zoom_scale()) + timeline->get_value()); if (!read_only) { moving_selection_offset = Vector2(x - animation->track_get_key_time(moving_selection_from_track, moving_selection_from_key), y - animation->bezier_track_get_key_value(moving_selection_from_track, moving_selection_from_key)); } + + additional_moving_handle_lefts.clear(); + additional_moving_handle_rights.clear(); + update(); } @@ -1379,8 +1414,8 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) { update(); } - if (moving_handle != 0 && mm.is_valid()) { - float y = (get_size().height / 2 - mm->get_position().y) * v_zoom + v_scroll; + if ((moving_handle == 1 || moving_handle == -1) && mm.is_valid()) { + float y = (get_size().height / 2.0 - mm->get_position().y) * v_zoom + v_scroll; float x = editor->snap_time((mm->get_position().x - timeline->get_name_limit()) / timeline->get_zoom_scale()) + timeline->get_value(); Vector2 key_pos = Vector2(animation->track_get_key_time(selected_track, moving_handle_key), animation->bezier_track_get_key_value(selected_track, moving_handle_key)); @@ -1393,8 +1428,10 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) { if (moving_handle == -1) { moving_handle_left = moving_handle_value; - if (animation->bezier_track_get_key_handle_mode(moving_handle_track, moving_handle_key) == Animation::HANDLE_MODE_BALANCED) { - double ratio = timeline->get_zoom_scale() * v_zoom; + Animation::HandleMode handle_mode = animation->bezier_track_get_key_handle_mode(moving_handle_track, moving_handle_key); + + if (handle_mode == Animation::HANDLE_MODE_BALANCED) { + real_t ratio = timeline->get_zoom_scale() * v_zoom; Transform2D xform; xform.set_scale(Vector2(1.0, 1.0 / ratio)); @@ -1402,12 +1439,16 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) { Vector2 vec_in = xform.xform(moving_handle_left); moving_handle_right = xform.affine_inverse().xform(-vec_in.normalized() * vec_out.length()); + } else if (handle_mode == Animation::HANDLE_MODE_MIRRORED) { + moving_handle_right = -moving_handle_left; } } else if (moving_handle == 1) { moving_handle_right = moving_handle_value; - if (animation->bezier_track_get_key_handle_mode(moving_handle_track, moving_handle_key) == Animation::HANDLE_MODE_BALANCED) { - double ratio = timeline->get_zoom_scale() * v_zoom; + Animation::HandleMode handle_mode = animation->bezier_track_get_key_handle_mode(moving_handle_track, moving_handle_key); + + if (handle_mode == Animation::HANDLE_MODE_BALANCED) { + real_t ratio = timeline->get_zoom_scale() * v_zoom; Transform2D xform; xform.set_scale(Vector2(1.0, 1.0 / ratio)); @@ -1415,26 +1456,26 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) { Vector2 vec_out = xform.xform(moving_handle_right); moving_handle_left = xform.affine_inverse().xform(-vec_out.normalized() * vec_in.length()); + } else if (handle_mode == Animation::HANDLE_MODE_MIRRORED) { + moving_handle_left = -moving_handle_right; } } update(); } - bool is_finishing_key_handle_drag = moving_handle != 0 && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT; - if (is_finishing_key_handle_drag) { + if ((moving_handle == -1 || moving_handle == 1) && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) { if (!read_only) { undo_redo->create_action(TTR("Move Bezier Points")); if (moving_handle == -1) { - double ratio = timeline->get_zoom_scale() * v_zoom; + real_t ratio = timeline->get_zoom_scale() * v_zoom; undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_in_handle", moving_handle_track, moving_handle_key, moving_handle_left, ratio); undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_in_handle", moving_handle_track, moving_handle_key, animation->bezier_track_get_key_in_handle(moving_handle_track, moving_handle_key), ratio); } else if (moving_handle == 1) { - double ratio = timeline->get_zoom_scale() * v_zoom; + real_t ratio = timeline->get_zoom_scale() * v_zoom; undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_out_handle", moving_handle_track, moving_handle_key, moving_handle_right, ratio); undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_out_handle", moving_handle_track, moving_handle_key, animation->bezier_track_get_key_out_handle(moving_handle_track, moving_handle_key), ratio); } undo_redo->commit_action(); - moving_handle = 0; update(); } @@ -1468,7 +1509,7 @@ void AnimationBezierTrackEdit::_zoom_callback(Vector2 p_scroll_vec, Vector2 p_or timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() * 1.05); } } - v_scroll = v_scroll + (p_origin.y - get_size().y / 2) * (v_zoom - v_zoom_orig); + v_scroll = v_scroll + (p_origin.y - get_size().y / 2.0) * (v_zoom - v_zoom_orig); update(); } @@ -1477,20 +1518,19 @@ void AnimationBezierTrackEdit::_menu_selected(int p_index) { case MENU_KEY_INSERT: { if (animation->get_track_count() > 0) { Array new_point; - new_point.resize(6); + new_point.resize(5); - float h = (get_size().height / 2 - menu_insert_key.y) * v_zoom + v_scroll; + float h = (get_size().height / 2.0 - menu_insert_key.y) * v_zoom + v_scroll; new_point[0] = h; new_point[1] = -0.25; new_point[2] = 0; new_point[3] = 0.25; new_point[4] = 0; - new_point[5] = Animation::HANDLE_MODE_BALANCED; int limit = timeline->get_name_limit(); - float time = ((menu_insert_key.x - limit) / timeline->get_zoom_scale()) + timeline->get_value(); + real_t time = ((menu_insert_key.x - limit) / timeline->get_zoom_scale()) + timeline->get_value(); while (animation->track_find_key(selected_track, time, true) != -1) { time += 0.001; @@ -1500,8 +1540,8 @@ void AnimationBezierTrackEdit::_menu_selected(int p_index) { undo_redo->add_do_method(animation.ptr(), "track_insert_key", selected_track, time, new_point); undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_time", selected_track, time); undo_redo->commit_action(); + update(); } - } break; case MENU_KEY_DUPLICATE: { duplicate_selection(); @@ -1512,9 +1552,21 @@ void AnimationBezierTrackEdit::_menu_selected(int p_index) { case MENU_KEY_SET_HANDLE_FREE: { _change_selected_keys_handle_mode(Animation::HANDLE_MODE_FREE); } break; + case MENU_KEY_SET_HANDLE_LINEAR: { + _change_selected_keys_handle_mode(Animation::HANDLE_MODE_LINEAR); + } break; case MENU_KEY_SET_HANDLE_BALANCED: { _change_selected_keys_handle_mode(Animation::HANDLE_MODE_BALANCED); } break; + case MENU_KEY_SET_HANDLE_MIRRORED: { + _change_selected_keys_handle_mode(Animation::HANDLE_MODE_MIRRORED); + } break; + case MENU_KEY_SET_HANDLE_AUTO_BALANCED: { + _change_selected_keys_handle_mode(Animation::HANDLE_MODE_BALANCED, true); + } break; + case MENU_KEY_SET_HANDLE_AUTO_MIRRORED: { + _change_selected_keys_handle_mode(Animation::HANDLE_MODE_MIRRORED, true); + } break; } } @@ -1523,9 +1575,9 @@ void AnimationBezierTrackEdit::duplicate_selection() { return; } - float top_time = 1e10; + real_t top_time = 1e10; for (SelectionSet::Element *E = selection.back(); E; E = E->prev()) { - float t = animation->track_get_key_time(E->get().first, E->get().second); + real_t t = animation->track_get_key_time(E->get().first, E->get().second); if (t < top_time) { top_time = t; } @@ -1533,17 +1585,17 @@ void AnimationBezierTrackEdit::duplicate_selection() { undo_redo->create_action(TTR("Anim Duplicate Keys")); - List<Pair<int, float>> new_selection_values; + List<Pair<int, real_t>> new_selection_values; for (SelectionSet::Element *E = selection.back(); E; E = E->prev()) { - float t = animation->track_get_key_time(E->get().first, E->get().second); - float dst_time = t + (timeline->get_play_position() - top_time); + real_t t = animation->track_get_key_time(E->get().first, E->get().second); + real_t dst_time = t + (timeline->get_play_position() - top_time); int existing_idx = animation->track_find_key(E->get().first, dst_time, true); undo_redo->add_do_method(animation.ptr(), "track_insert_key", E->get().first, dst_time, animation->track_get_key_value(E->get().first, E->get().second), animation->track_get_key_transition(E->get().first, E->get().second)); undo_redo->add_undo_method(animation.ptr(), "track_remove_key_at_time", E->get().first, dst_time); - Pair<int, float> p; + Pair<int, real_t> p; p.first = E->get().first; p.second = dst_time; new_selection_values.push_back(p); @@ -1558,9 +1610,9 @@ void AnimationBezierTrackEdit::duplicate_selection() { //reselect duplicated selection.clear(); - for (const Pair<int, float> &E : new_selection_values) { + for (const Pair<int, real_t> &E : new_selection_values) { int track = E.first; - float time = E.second; + real_t time = E.second; int existing_idx = animation->track_find_key(track, time, true); @@ -1590,18 +1642,24 @@ void AnimationBezierTrackEdit::delete_selection() { } } +void AnimationBezierTrackEdit::_bezier_track_insert_key(int p_track, double p_time, real_t p_value, const Vector2 &p_in_handle, const Vector2 &p_out_handle, const Animation::HandleMode p_handle_mode) { + ERR_FAIL_COND(animation.is_null()); + int idx = animation->bezier_track_insert_key(p_track, p_time, p_value, p_in_handle, p_out_handle); + animation->bezier_track_set_key_handle_mode(p_track, idx, p_handle_mode); +} + void AnimationBezierTrackEdit::_bind_methods() { - ClassDB::bind_method("_clear_selection", &AnimationBezierTrackEdit::_clear_selection); - ClassDB::bind_method("_clear_selection_for_anim", &AnimationBezierTrackEdit::_clear_selection_for_anim); - ClassDB::bind_method("_select_at_anim", &AnimationBezierTrackEdit::_select_at_anim); - ClassDB::bind_method("_update_hidden_tracks_after", &AnimationBezierTrackEdit::_update_hidden_tracks_after); - ClassDB::bind_method("_update_locked_tracks_after", &AnimationBezierTrackEdit::_update_locked_tracks_after); + ClassDB::bind_method(D_METHOD("_clear_selection"), &AnimationBezierTrackEdit::_clear_selection); + ClassDB::bind_method(D_METHOD("_clear_selection_for_anim"), &AnimationBezierTrackEdit::_clear_selection_for_anim); + ClassDB::bind_method(D_METHOD("_select_at_anim"), &AnimationBezierTrackEdit::_select_at_anim); + ClassDB::bind_method(D_METHOD("_update_hidden_tracks_after"), &AnimationBezierTrackEdit::_update_hidden_tracks_after); + ClassDB::bind_method(D_METHOD("_update_locked_tracks_after"), &AnimationBezierTrackEdit::_update_locked_tracks_after); + ClassDB::bind_method(D_METHOD("_bezier_track_insert_key"), &AnimationBezierTrackEdit::_bezier_track_insert_key); ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::FLOAT, "position"), PropertyInfo(Variant::BOOL, "drag"))); ADD_SIGNAL(MethodInfo("remove_request", PropertyInfo(Variant::INT, "track"))); ADD_SIGNAL(MethodInfo("insert_key", PropertyInfo(Variant::FLOAT, "offset"))); - ADD_SIGNAL(MethodInfo("select_key", PropertyInfo(Variant::INT, "track"), PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::BOOL, "single"))); - ADD_SIGNAL(MethodInfo("deselect_key", PropertyInfo(Variant::INT, "track"), PropertyInfo(Variant::INT, "index"))); + ADD_SIGNAL(MethodInfo("select_key", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::BOOL, "single"), PropertyInfo(Variant::INT, "track"))); ADD_SIGNAL(MethodInfo("clear_selection")); ADD_SIGNAL(MethodInfo("close_request")); diff --git a/editor/animation_bezier_editor.h b/editor/animation_bezier_editor.h index 070a6589ad..8686325f43 100644 --- a/editor/animation_bezier_editor.h +++ b/editor/animation_bezier_editor.h @@ -32,7 +32,7 @@ #define ANIMATION_BEZIER_EDITOR_H #include "animation_track_editor.h" -#include "core/templates/rb_set.h" +#include "core/templates/hashfuncs.h" class ViewPanner; @@ -44,14 +44,18 @@ class AnimationBezierTrackEdit : public Control { MENU_KEY_DUPLICATE, MENU_KEY_DELETE, MENU_KEY_SET_HANDLE_FREE, + MENU_KEY_SET_HANDLE_LINEAR, MENU_KEY_SET_HANDLE_BALANCED, + MENU_KEY_SET_HANDLE_MIRRORED, + MENU_KEY_SET_HANDLE_AUTO_BALANCED, + MENU_KEY_SET_HANDLE_AUTO_MIRRORED, }; AnimationTimelineEdit *timeline = nullptr; UndoRedo *undo_redo = nullptr; Node *root = nullptr; Control *play_position = nullptr; //separate control used to draw so updates for only position changed are much faster - float play_position_pos = 0; + real_t play_position_pos = 0; Ref<Animation> animation; bool read_only = false; @@ -111,25 +115,37 @@ class AnimationBezierTrackEdit : public Control { Vector2 box_selection_from; Vector2 box_selection_to; - int moving_handle = 0; //0 no move -1 or +1 out + int moving_handle = 0; //0 no move -1 or +1 out, 2 both (drawing only) int moving_handle_key = 0; int moving_handle_track = 0; Vector2 moving_handle_left; Vector2 moving_handle_right; int moving_handle_mode = 0; // value from Animation::HandleMode + struct PairHasher { + static _FORCE_INLINE_ uint32_t hash(const Pair<int, int> &p_value) { + int32_t hash = 23; + hash = hash * 31 * hash_one_uint64(p_value.first); + hash = hash * 31 * hash_one_uint64(p_value.second); + return hash; + } + }; + + HashMap<Pair<int, int>, Vector2, PairHasher> additional_moving_handle_lefts; + HashMap<Pair<int, int>, Vector2, PairHasher> additional_moving_handle_rights; + void _clear_selection(); void _clear_selection_for_anim(const Ref<Animation> &p_anim); - void _select_at_anim(const Ref<Animation> &p_anim, int p_track, float p_pos); - void _change_selected_keys_handle_mode(Animation::HandleMode p_mode); + void _select_at_anim(const Ref<Animation> &p_anim, int p_track, real_t p_pos); + void _change_selected_keys_handle_mode(Animation::HandleMode p_mode, bool p_auto = false); Vector2 menu_insert_key; struct AnimMoveRestore { int track = 0; - float time = 0; + double time = 0; Variant key; - float transition = 0; + real_t transition = 0; }; AnimationTrackEditor *editor = nullptr; @@ -144,7 +160,7 @@ class AnimationBezierTrackEdit : public Control { Vector<EditPoint> edit_points; - struct SelectionCompare { + struct PairCompare { bool operator()(const IntPair &lh, const IntPair &rh) { if (lh.first == rh.first) { return lh.second < rh.second; @@ -154,7 +170,7 @@ class AnimationBezierTrackEdit : public Control { } }; - typedef RBSet<IntPair, SelectionCompare> SelectionSet; + typedef RBSet<IntPair, PairCompare> SelectionSet; SelectionSet selection; @@ -186,12 +202,14 @@ public: void set_root(Node *p_root); void set_filtered(bool p_filtered); - void set_play_position(float p_pos); + void set_play_position(real_t p_pos); void update_play_position(); void duplicate_selection(); void delete_selection(); + void _bezier_track_insert_key(int p_track, double p_time, real_t p_value, const Vector2 &p_in_handle, const Vector2 &p_out_handle, const Animation::HandleMode p_handle_mode); + AnimationBezierTrackEdit(); }; diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 0db82551cb..2184f4ab69 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -63,12 +63,12 @@ public: } static void _bind_methods() { - ClassDB::bind_method("_update_obj", &AnimationTrackKeyEdit::_update_obj); - ClassDB::bind_method("_key_ofs_changed", &AnimationTrackKeyEdit::_key_ofs_changed); - ClassDB::bind_method("_hide_script_from_inspector", &AnimationTrackKeyEdit::_hide_script_from_inspector); - ClassDB::bind_method("get_root_path", &AnimationTrackKeyEdit::get_root_path); - ClassDB::bind_method("_dont_undo_redo", &AnimationTrackKeyEdit::_dont_undo_redo); - ClassDB::bind_method("_read_only", &AnimationTrackKeyEdit::_read_only); + ClassDB::bind_method(D_METHOD("_update_obj"), &AnimationTrackKeyEdit::_update_obj); + ClassDB::bind_method(D_METHOD("_key_ofs_changed"), &AnimationTrackKeyEdit::_key_ofs_changed); + ClassDB::bind_method(D_METHOD("_hide_script_from_inspector"), &AnimationTrackKeyEdit::_hide_script_from_inspector); + ClassDB::bind_method(D_METHOD("get_root_path"), &AnimationTrackKeyEdit::get_root_path); + ClassDB::bind_method(D_METHOD("_dont_undo_redo"), &AnimationTrackKeyEdit::_dont_undo_redo); + ClassDB::bind_method(D_METHOD("_read_only"), &AnimationTrackKeyEdit::_read_only); } void _fix_node_path(Variant &value) { @@ -349,8 +349,8 @@ public: setting = true; undo_redo->create_action(TTR("Anim Change Keyframe Value"), UndoRedo::MERGE_ENDS); int prev = animation->bezier_track_get_key_handle_mode(track, key); - undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_handle_mode", track, key, value); - undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_handle_mode", track, key, prev); + undo_redo->add_do_method(this, "_bezier_track_set_key_handle_mode", animation.ptr(), track, key, value); + undo_redo->add_undo_method(this, "_bezier_track_set_key_handle_mode", animation.ptr(), track, key, prev); undo_redo->add_do_method(this, "_update_obj", animation); undo_redo->add_undo_method(this, "_update_obj", animation); undo_redo->commit_action(); @@ -635,10 +635,16 @@ public: } break; case Animation::TYPE_BEZIER: { + Animation::HandleMode hm = animation->bezier_track_get_key_handle_mode(track, key); p_list->push_back(PropertyInfo(Variant::FLOAT, PNAME("value"))); - p_list->push_back(PropertyInfo(Variant::VECTOR2, PNAME("in_handle"))); - p_list->push_back(PropertyInfo(Variant::VECTOR2, PNAME("out_handle"))); - p_list->push_back(PropertyInfo(Variant::INT, PNAME("handle_mode"), PROPERTY_HINT_ENUM, "Free,Balanced")); + if (hm == Animation::HANDLE_MODE_LINEAR) { + p_list->push_back(PropertyInfo(Variant::VECTOR2, PNAME("in_handle"), PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_READ_ONLY)); + p_list->push_back(PropertyInfo(Variant::VECTOR2, PNAME("out_handle"), PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_READ_ONLY)); + } else { + p_list->push_back(PropertyInfo(Variant::VECTOR2, PNAME("in_handle"))); + p_list->push_back(PropertyInfo(Variant::VECTOR2, PNAME("out_handle"))); + } + p_list->push_back(PropertyInfo(Variant::INT, PNAME("handle_mode"), PROPERTY_HINT_ENUM, "Free,Linear,Balanced,Mirrored")); } break; case Animation::TYPE_AUDIO: { @@ -724,12 +730,12 @@ public: } static void _bind_methods() { - ClassDB::bind_method("_update_obj", &AnimationMultiTrackKeyEdit::_update_obj); - ClassDB::bind_method("_key_ofs_changed", &AnimationMultiTrackKeyEdit::_key_ofs_changed); - ClassDB::bind_method("_hide_script_from_inspector", &AnimationMultiTrackKeyEdit::_hide_script_from_inspector); - ClassDB::bind_method("get_root_path", &AnimationMultiTrackKeyEdit::get_root_path); - ClassDB::bind_method("_dont_undo_redo", &AnimationMultiTrackKeyEdit::_dont_undo_redo); - ClassDB::bind_method("_read_only", &AnimationMultiTrackKeyEdit::_read_only); + ClassDB::bind_method(D_METHOD("_update_obj"), &AnimationMultiTrackKeyEdit::_update_obj); + ClassDB::bind_method(D_METHOD("_key_ofs_changed"), &AnimationMultiTrackKeyEdit::_key_ofs_changed); + ClassDB::bind_method(D_METHOD("_hide_script_from_inspector"), &AnimationMultiTrackKeyEdit::_hide_script_from_inspector); + ClassDB::bind_method(D_METHOD("get_root_path"), &AnimationMultiTrackKeyEdit::get_root_path); + ClassDB::bind_method(D_METHOD("_dont_undo_redo"), &AnimationMultiTrackKeyEdit::_dont_undo_redo); + ClassDB::bind_method(D_METHOD("_read_only"), &AnimationMultiTrackKeyEdit::_read_only); } void _fix_node_path(Variant &value, NodePath &base) { @@ -970,8 +976,8 @@ public: undo_redo->create_action(TTR("Anim Multi Change Keyframe Value"), UndoRedo::MERGE_ENDS); } Vector2 prev = animation->bezier_track_get_key_in_handle(track, key); - undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_in_handle", track, key, value); - undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_in_handle", track, key, prev); + undo_redo->add_do_method(this, "_bezier_track_set_key_in_handle", track, key, value); + undo_redo->add_undo_method(this, "_bezier_track_set_key_in_handle", track, key, prev); update_obj = true; } else if (name == "out_handle") { const Variant &value = p_value; @@ -981,8 +987,8 @@ public: undo_redo->create_action(TTR("Anim Multi Change Keyframe Value"), UndoRedo::MERGE_ENDS); } Vector2 prev = animation->bezier_track_get_key_out_handle(track, key); - undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_out_handle", track, key, value); - undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_out_handle", track, key, prev); + undo_redo->add_do_method(this, "_bezier_track_set_key_out_handle", track, key, value); + undo_redo->add_undo_method(this, "_bezier_track_set_key_out_handle", track, key, prev); update_obj = true; } else if (name == "handle_mode") { const Variant &value = p_value; @@ -992,8 +998,8 @@ public: undo_redo->create_action(TTR("Anim Multi Change Keyframe Value"), UndoRedo::MERGE_ENDS); } int prev = animation->bezier_track_get_key_handle_mode(track, key); - undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_handle_mode", track, key, value); - undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_handle_mode", track, key, prev); + undo_redo->add_do_method(this, "_bezier_track_set_key_handle_mode", animation.ptr(), track, key, value); + undo_redo->add_undo_method(this, "_bezier_track_set_key_handle_mode", animation.ptr(), track, key, prev); update_obj = true; } } break; @@ -1324,7 +1330,7 @@ public: p_list->push_back(PropertyInfo(Variant::FLOAT, "value")); p_list->push_back(PropertyInfo(Variant::VECTOR2, "in_handle")); p_list->push_back(PropertyInfo(Variant::VECTOR2, "out_handle")); - p_list->push_back(PropertyInfo(Variant::INT, "handle_mode", PROPERTY_HINT_ENUM, "Free,Balanced")); + p_list->push_back(PropertyInfo(Variant::INT, "handle_mode", PROPERTY_HINT_ENUM, "Free,Linear,Balanced,Mirrored")); } break; case Animation::TYPE_AUDIO: { p_list->push_back(PropertyInfo(Variant::OBJECT, "stream", PROPERTY_HINT_RESOURCE_TYPE, "AudioStream")); @@ -2720,9 +2726,15 @@ String AnimationTrackEdit::get_tooltip(const Point2 &p_pos) const { case Animation::HANDLE_MODE_FREE: { text += TTR("Handle mode: Free\n"); } break; + case Animation::HANDLE_MODE_LINEAR: { + text += TTR("Handle mode: Linear\n"); + } break; case Animation::HANDLE_MODE_BALANCED: { text += TTR("Handle mode: Balanced\n"); } break; + case Animation::HANDLE_MODE_MIRRORED: { + text += TTR("Handle mode: Mirrored\n"); + } break; } } break; case Animation::TYPE_AUDIO: { @@ -3251,7 +3263,6 @@ void AnimationTrackEdit::_bind_methods() { ADD_SIGNAL(MethodInfo("insert_key", PropertyInfo(Variant::FLOAT, "offset"))); ADD_SIGNAL(MethodInfo("select_key", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::BOOL, "single"))); ADD_SIGNAL(MethodInfo("deselect_key", PropertyInfo(Variant::INT, "index"))); - ADD_SIGNAL(MethodInfo("bezier_edit")); ADD_SIGNAL(MethodInfo("move_selection_begin")); ADD_SIGNAL(MethodInfo("move_selection", PropertyInfo(Variant::FLOAT, "offset"))); @@ -3414,7 +3425,8 @@ void AnimationTrackEditor::set_animation(const Ref<Animation> &p_anim, bool p_re track_edits[_get_track_selected()]->release_focus(); } if (animation.is_valid()) { - animation->disconnect("changed", callable_mp(this, &AnimationTrackEditor::_animation_changed)); + animation->disconnect("tracks_changed", callable_mp(this, &AnimationTrackEditor::_animation_changed)); + animation->disconnect("changed", callable_mp(this, &AnimationTrackEditor::_sync_animation_change)); _clear_selection(); } animation = p_anim; @@ -3425,7 +3437,8 @@ void AnimationTrackEditor::set_animation(const Ref<Animation> &p_anim, bool p_re _update_tracks(); if (animation.is_valid()) { - animation->connect("changed", callable_mp(this, &AnimationTrackEditor::_animation_changed)); + animation->connect("tracks_changed", callable_mp(this, &AnimationTrackEditor::_animation_changed), CONNECT_DEFERRED); + animation->connect("changed", callable_mp(this, &AnimationTrackEditor::_sync_animation_change), CONNECT_DEFERRED); hscroll->show(); edit->set_disabled(read_only); @@ -4340,13 +4353,12 @@ AnimationTrackEditor::TrackIndices AnimationTrackEditor::_confirm_insert(InsertD } break; case Animation::TYPE_BEZIER: { Array array; - array.resize(6); + array.resize(5); array[0] = p_id.value; array[1] = -0.25; array[2] = 0; array[3] = 0.25; array[4] = 0; - array[5] = Animation::HANDLE_MODE_BALANCED; value = array; bezier_edit_icon->set_disabled(false); @@ -4609,11 +4621,19 @@ void AnimationTrackEditor::_update_tracks() { } } +void AnimationTrackEditor::_sync_animation_change() { + bezier_edit->update(); +} + void AnimationTrackEditor::_animation_changed() { if (animation_changing_awaiting_update) { return; // All will be updated, don't bother with anything. } + if (key_edit) { + _update_key_edit(); + } + if (key_edit && key_edit->setting) { // If editing a key, just update the edited track, makes refresh less costly. if (key_edit->track < track_edits.size()) { @@ -5073,13 +5093,12 @@ void AnimationTrackEditor::_insert_key_from_track(float p_ofs, int p_track) { Variant value; _find_hint_for_track(p_track, bp, &value); Array arr; - arr.resize(6); + arr.resize(5); arr[0] = value; arr[1] = -0.25; arr[2] = 0; arr[3] = 0.25; arr[4] = 0; - arr[5] = 0; undo_redo->create_action(TTR("Add Track Key")); undo_redo->add_do_method(animation.ptr(), "track_insert_key", p_track, p_ofs, arr); @@ -5558,6 +5577,13 @@ void AnimationTrackEditor::_bezier_edit(int p_for_track) { // Search everything within the track and curve - edit it. } +void AnimationTrackEditor::_bezier_track_set_key_handle_mode(Animation *p_anim, int p_track, int p_index, Animation::HandleMode p_mode, Animation::HandleSetMode p_set_mode) { + if (!p_anim) { + return; + } + p_anim->bezier_track_set_key_handle_mode(p_track, p_index, p_mode, p_set_mode); +} + void AnimationTrackEditor::_anim_duplicate_keys(bool transpose) { // Duplicait! if (selection.size() && animation.is_valid() && (!transpose || (_get_track_selected() >= 0 && _get_track_selected() < animation->get_track_count()))) { @@ -6218,15 +6244,17 @@ void AnimationTrackEditor::_select_all_tracks_for_copy() { } void AnimationTrackEditor::_bind_methods() { - ClassDB::bind_method("_animation_update", &AnimationTrackEditor::_animation_update); - ClassDB::bind_method("_track_grab_focus", &AnimationTrackEditor::_track_grab_focus); - ClassDB::bind_method("_update_tracks", &AnimationTrackEditor::_update_tracks); - ClassDB::bind_method("_clear_selection_for_anim", &AnimationTrackEditor::_clear_selection_for_anim); - ClassDB::bind_method("_select_at_anim", &AnimationTrackEditor::_select_at_anim); - - ClassDB::bind_method("_key_selected", &AnimationTrackEditor::_key_selected); // Still used by some connect_compat. - ClassDB::bind_method("_key_deselected", &AnimationTrackEditor::_key_deselected); // Still used by some connect_compat. - ClassDB::bind_method("_clear_selection", &AnimationTrackEditor::_clear_selection); // Still used by some connect_compat. + ClassDB::bind_method(D_METHOD("_animation_update"), &AnimationTrackEditor::_animation_update); + ClassDB::bind_method(D_METHOD("_track_grab_focus"), &AnimationTrackEditor::_track_grab_focus); + ClassDB::bind_method(D_METHOD("_update_tracks"), &AnimationTrackEditor::_update_tracks); + ClassDB::bind_method(D_METHOD("_clear_selection_for_anim"), &AnimationTrackEditor::_clear_selection_for_anim); + ClassDB::bind_method(D_METHOD("_select_at_anim"), &AnimationTrackEditor::_select_at_anim); + + ClassDB::bind_method(D_METHOD("_key_selected"), &AnimationTrackEditor::_key_selected); // Still used by some connect_compat. + ClassDB::bind_method(D_METHOD("_key_deselected"), &AnimationTrackEditor::_key_deselected); // Still used by some connect_compat. + ClassDB::bind_method(D_METHOD("_clear_selection"), &AnimationTrackEditor::_clear_selection); // Still used by some connect_compat. + + ClassDB::bind_method(D_METHOD("_bezier_track_set_key_handle_mode", "animation", "track_idx", "key_idx", "key_handle_mode", "key_handle_set_mode"), &AnimationTrackEditor::_bezier_track_set_key_handle_mode, DEFVAL(Animation::HANDLE_SET_MODE_NONE)); ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::FLOAT, "position"), PropertyInfo(Variant::BOOL, "drag"), PropertyInfo(Variant::BOOL, "timeline_only"))); ADD_SIGNAL(MethodInfo("keying_changed")); diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h index b0553c54a5..34ee0934dc 100644 --- a/editor/animation_track_editor.h +++ b/editor/animation_track_editor.h @@ -322,8 +322,9 @@ class AnimationTrackEditor : public VBoxContainer { Vector<AnimationTrackEditGroup *> groups; bool animation_changing_awaiting_update = false; - void _animation_update(); + void _animation_update(); // Updated by AnimationTrackEditor(this) int _get_track_selected(); + void _sync_animation_change(); void _animation_changed(); void _update_tracks(); @@ -447,6 +448,7 @@ class AnimationTrackEditor : public VBoxContainer { void _toggle_bezier_edit(); void _cancel_bezier_edit(); void _bezier_edit(int p_for_track); + void _bezier_track_set_key_handle_mode(Animation *p_anim, int p_track, int p_index, Animation::HandleMode p_mode, Animation::HandleSetMode p_set_mode = Animation::HANDLE_SET_MODE_NONE); ////////////// edit menu stuff diff --git a/editor/icons/BezierHandlesBalanced.svg b/editor/icons/BezierHandlesBalanced.svg index 911029e431..b1778b1a5e 100644 --- a/editor/icons/BezierHandlesBalanced.svg +++ b/editor/icons/BezierHandlesBalanced.svg @@ -1 +1 @@ -<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m1.7627119 13.627119s1.2881355-6.847458 6.5762712-8.1355935c5.0847459.9491522 5.9661009 8.1355925 5.9661009 8.1355925" fill="none" stroke="#5fb2ff" stroke-miterlimit="4.9" stroke-width="1.7"/><ellipse cx="1.898304" cy="13.491526" fill="#e0e0e0" rx="1.267586" ry="1.199789"/><ellipse cx="14.237288" cy="13.491526" fill="#e0e0e0" rx="1.267586" ry="1.199789"/><path d="m7.4559186 5.1473018-4.7355323 1.5541798" fill="none" stroke="#5fb2ff" stroke-width=".618"/><path d="m10.790357 4.2063094-2.5009748.9433136" fill="none" stroke="#5fb2ff" stroke-width=".614897"/><g fill="#e0e0e0"><ellipse cx="8.271187" cy="4.779661" rx="1.267586" ry="1.199789"/><path d="m1.7157324 5.8754878a1.2675855 1.1997888 0 0 0 -1.26757806 1.1992188 1.2675855 1.1997888 0 0 0 1.26757806 1.1992187 1.2675855 1.1997888 0 0 0 1.2675781-1.1992187 1.2675855 1.1997888 0 0 0 -1.2675781-1.1992188zm.00195.4238282a.84677333.80148375 0 0 1 .8476593.8007812.84677333.80148375 0 0 1 -.8476562.8007812.84677333.80148375 0 0 1 -.84765616-.8007812.84677333.80148375 0 0 1 .84765616-.8007812z"/><path d="m11.909414 2.4642073a1.2836218 1.231838 0 0 0 -1.283614 1.2312528 1.2836218 1.231838 0 0 0 1.283614 1.2312527 1.2836218 1.231838 0 0 0 1.283614-1.2312527 1.2836218 1.231838 0 0 0 -1.283614-1.2312528zm.002.4351497a.85748593.82289328 0 0 1 .858383.8221719.85748593.82289328 0 0 1 -.85838.822172.85748593.82289328 0 0 1 -.858379-.822172.85748593.82289328 0 0 1 .858379-.8221719z"/></g></svg> +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m1.7627119 13.627119s1.2881355-6.847458 6.5762712-8.1355935c5.0847459.9491522 5.9661009 8.1355925 5.9661009 8.1355925" fill="none" stroke="#87b1d7" stroke-miterlimit="4.9" stroke-width=".5"/><path d="m2.4962504 7.6963851 10.1811806-3.7166314" fill="none" stroke="#61b2ff" stroke-width="1.5"/><g fill="#e0e0e0"><ellipse cx="1.898304" cy="13.491526" rx="1.267586" ry="1.199789"/><ellipse cx="14.237288" cy="13.491526" rx="1.267586" ry="1.199789"/><ellipse cx="8.338983" cy="5.491526" rx="1.267586" ry="1.199789"/><path d="m1.6910776 6.7273a1.2675855 1.1997888 0 0 0 -1.26757808 1.1992188 1.2675855 1.1997888 0 0 0 1.26757808 1.1992187 1.2675855 1.1997888 0 0 0 1.2675781-1.1992187 1.2675855 1.1997888 0 0 0 -1.2675781-1.1992188zm.00195.4238282a.84677333.80148375 0 0 1 .8476593.8007812.84677333.80148375 0 0 1 -.8476562.8007812.84677333.80148375 0 0 1 -.84765618-.8007812.84677333.80148375 0 0 1 .84765618-.8007812z"/><path d="m13.40948 2.2963899a1.2836218 1.231838 0 0 0 -1.283614 1.2312528 1.2836218 1.231838 0 0 0 1.283614 1.2312526 1.2836218 1.231838 0 0 0 1.283614-1.2312526 1.2836218 1.231838 0 0 0 -1.283614-1.2312528zm.002.4351497a.85748593.82289328 0 0 1 .858383.8221719.85748593.82289328 0 0 1 -.85838.8221719.85748593.82289328 0 0 1 -.858379-.8221719.85748593.82289328 0 0 1 .858379-.8221719z"/></g></svg> diff --git a/editor/icons/BezierHandlesFree.svg b/editor/icons/BezierHandlesFree.svg index 6e91288c79..c7bff530ae 100644 --- a/editor/icons/BezierHandlesFree.svg +++ b/editor/icons/BezierHandlesFree.svg @@ -1 +1 @@ -<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m1.7627119 13.627119s1.2881355-6.847458 6.5762712-8.1355935c5.0847459.9491522 5.9661009 8.1355925 5.9661009 8.1355925" fill="none" stroke="#5fb2ff" stroke-miterlimit="4.9" stroke-width="1.7"/><ellipse cx="1.898304" cy="13.491526" fill="#e0e0e0" rx="1.267586" ry="1.199789"/><ellipse cx="14.237288" cy="13.491526" fill="#e0e0e0" rx="1.267586" ry="1.199789"/><path d="m7.6850253 4.7560401-3.776127.6607599" fill="none" stroke="#5fb2ff" stroke-width=".805138"/><path d="m11.695505 2.3941651-2.999121 2.2935078" fill="none" stroke="#5fb2ff" stroke-width=".730798"/><g fill="#e0e0e0"><ellipse cx="8.271187" cy="4.779661" rx="1.267586" ry="1.199789"/><path d="m2.4961199 4.3976698a1.1997888 1.2675855 80.074672 0 0 -1.0419038 1.3997559 1.1997888 1.2675855 80.074672 0 0 1.4553094.9627848 1.1997888 1.2675855 80.074672 0 0 1.0419037-1.3997558 1.1997888 1.2675855 80.074672 0 0 -1.4553093-.9627849zm.074974.4171488a.80148375.84677333 80.074672 0 1 .9729986.6426896.80148375.84677333 80.074672 0 1 -.6969432.934902.80148375.84677333 80.074672 0 1 -.9729958-.6426902.80148375.84677333 80.074672 0 1 .6969432-.934902z"/><path d="m11.838896.64428913a1.231838 1.2836218 52.593897 0 0 -.271701 1.75779027 1.231838 1.2836218 52.593897 0 0 1.767576.1983008 1.231838 1.2836218 52.593897 0 0 .271701-1.75779027 1.231838 1.2836218 52.593897 0 0 -1.767576-.1983008zm.265925.3444462a.82289328.85748593 52.593897 0 1 1.181294.13165847.82289328.85748593 52.593897 0 1 -.182417 1.1745241.82289328.85748593 52.593897 0 1 -1.181291-.1316609.82289328.85748593 52.593897 0 1 .182417-1.17452347z"/></g></svg> +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m1.7627119 13.627119s1.3064631-5.1979735 6.5945988-6.486109c5.0847463.9491522 5.9477733 6.486108 5.9477733 6.486108" fill="none" stroke="#87b1d7" stroke-miterlimit="4.9" stroke-width=".5"/><path d="m2.3554991 8.5165019 6.0018116-1.3754919 2.0717113-4.6377276" fill="none" stroke="#61b3ff" stroke-width="1.5"/><g fill="#e0e0e0"><ellipse cx="1.898304" cy="13.491526" rx="1.267586" ry="1.199789"/><ellipse cx="14.237288" cy="13.491526" rx="1.267586" ry="1.199789"/><ellipse cx="8.35731" cy="7.14101" rx="1.267586" ry="1.199789"/><path d="m1.3048251 7.4400522a1.1997888 1.2675855 80.074672 0 0 -1.04190379 1.3997559 1.1997888 1.2675855 80.074672 0 0 1.45530939.9627848 1.1997888 1.2675855 80.074672 0 0 1.0419037-1.3997558 1.1997888 1.2675855 80.074672 0 0 -1.4553093-.9627849zm.074974.4171488a.80148375.84677333 80.074672 0 1 .9729986.6426896.80148375.84677333 80.074672 0 1 -.6969432.934902.80148375.84677333 80.074672 0 1 -.97299579-.6426902.80148375.84677333 80.074672 0 1 .69694319-.934902z"/><path d="m10.024463.73592688a1.231838 1.2836218 52.593897 0 0 -.2717015 1.75779042 1.231838 1.2836218 52.593897 0 0 1.7675765.1983008 1.231838 1.2836218 52.593897 0 0 .271701-1.75779042 1.231838 1.2836218 52.593897 0 0 -1.767576-.1983008zm.265925.34444622a.82289328.85748593 52.593897 0 1 1.181294.1316585.82289328.85748593 52.593897 0 1 -.182417 1.1745242.82289328.85748593 52.593897 0 1 -1.181291-.1316609.82289328.85748593 52.593897 0 1 .182417-1.1745236z"/></g></svg> diff --git a/editor/icons/BezierHandlesLinear.svg b/editor/icons/BezierHandlesLinear.svg new file mode 100644 index 0000000000..2667779dcb --- /dev/null +++ b/editor/icons/BezierHandlesLinear.svg @@ -0,0 +1 @@ +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m8.2711868 4.7796612-6.3728828 8.7118648z" fill="none" stroke="#87b1d7" stroke-miterlimit="4.9" stroke-width=".5"/><ellipse cx="1.898304" cy="13.491526" fill="#e0e0e0" rx="1.267586" ry="1.199789"/><path d="m14.237288 13.491526-5.9661012-8.7118648" fill="none" stroke="#87b1d7" stroke-miterlimit="4.9" stroke-width=".5"/><path d="m5.6316733 8.3879317 2.6395135-3.6082705 2.4416832 3.5654122" fill="none" stroke="#61b2ff" stroke-width="1.5"/><g fill="#e0e0e0"><ellipse cx="14.237288" cy="13.491526" rx="1.267586" ry="1.199789"/><ellipse cx="8.271187" cy="4.779661" rx="1.267586" ry="1.199789"/><path d="m5.0847454 7.9363749a1.2675855 1.1997888 0 0 0 -1.2675781 1.1992188 1.2675855 1.1997888 0 0 0 1.2675781 1.1992183 1.2675855 1.1997888 0 0 0 1.2675781-1.1992183 1.2675855 1.1997888 0 0 0 -1.2675781-1.1992188zm.00195.4238282a.84677333.80148375 0 0 1 .8476593.8007812.84677333.80148375 0 0 1 -.8476562.8007812.84677333.80148375 0 0 1 -.8476562-.8007812.84677333.80148375 0 0 1 .8476562-.8007812z"/><path d="m11.254237 7.9043407a1.2836218 1.231838 0 0 0 -1.2836135 1.2312528 1.2836218 1.231838 0 0 0 1.2836135 1.2312525 1.2836218 1.231838 0 0 0 1.283614-1.2312525 1.2836218 1.231838 0 0 0 -1.283614-1.2312528zm.002.4351497a.85748593.82289328 0 0 1 .858383.8221719.85748593.82289328 0 0 1 -.85838.822172.85748593.82289328 0 0 1 -.858379-.822172.85748593.82289328 0 0 1 .858379-.8221719z"/></g></svg> diff --git a/editor/icons/BezierHandlesMirror.svg b/editor/icons/BezierHandlesMirror.svg index 9180e31921..07817f7247 100644 --- a/editor/icons/BezierHandlesMirror.svg +++ b/editor/icons/BezierHandlesMirror.svg @@ -1 +1 @@ -<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m1.7627119 13.627119s1.2881355-6.847458 6.5762712-8.1355935c5.0847459.9491522 5.9661009 8.1355925 5.9661009 8.1355925" fill="none" stroke="#5fb2ff" stroke-miterlimit="4.9" stroke-width="1.7"/><ellipse cx="1.898304" cy="13.491526" fill="#e0e0e0" rx="1.267586" ry="1.199789"/><ellipse cx="14.237288" cy="13.491526" fill="#e0e0e0" rx="1.267586" ry="1.199789"/><path d="m8.2033896 4.6779662h-3.8335021" fill="none" stroke="#5fb2ff" stroke-width=".805138"/><path d="m11.931789 4.6440679h-3.7283994" fill="none" stroke="#5fb2ff" stroke-width=".716709"/><g fill="#e0e0e0"><ellipse cx="8.271187" cy="4.779661" rx="1.267586" ry="1.199789"/><path d="m3.1539157 3.4305762a1.2675855 1.1997888 0 0 0 -1.2675781 1.1992188 1.2675855 1.1997888 0 0 0 1.2675781 1.1992187 1.2675855 1.1997888 0 0 0 1.2675781-1.1992187 1.2675855 1.1997888 0 0 0 -1.2675781-1.1992188zm.00195.4238282a.84677333.80148375 0 0 1 .8476593.8007812.84677333.80148375 0 0 1 -.8476562.8007812.84677333.80148375 0 0 1 -.8476562-.8007812.84677333.80148375 0 0 1 .8476562-.8007812z"/><path d="m13.093969 3.3750567a1.2675855 1.1997888 0 0 0 -1.267578 1.1992188 1.2675855 1.1997888 0 0 0 1.267578 1.1992187 1.2675855 1.1997888 0 0 0 1.267578-1.1992187 1.2675855 1.1997888 0 0 0 -1.267578-1.1992188zm.002.4238282a.84677333.80148375 0 0 1 .847659.8007812.84677333.80148375 0 0 1 -.847656.8007812.84677333.80148375 0 0 1 -.847656-.8007812.84677333.80148375 0 0 1 .847656-.8007812z"/></g></svg> +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m1.7627119 13.627119s1.2881355-6.847458 6.5762712-8.1355935c5.0847459.9491522 5.9661009 8.1355925 5.9661009 8.1355925" fill="none" stroke="#87b1d7" stroke-miterlimit="4.9" stroke-width=".5"/><ellipse cx="1.898304" cy="13.491526" fill="#e0e0e0" rx="1.267586" ry="1.199789"/><ellipse cx="14.237288" cy="13.491526" fill="#e0e0e0" rx="1.267586" ry="1.199789"/><path d="m8.3389831 5.4915255-5.8519685.0395137" fill="none" stroke="#5fb2ff" stroke-width="1.5"/><path d="m13.814033 5.4419288-5.4750499.0156984" fill="none" stroke="#5fb2ff" stroke-width="1.5"/><g fill="#e0e0e0"><ellipse cx="8.40678" cy="5.593221" rx="1.267586" ry="1.199789"/><path d="m1.6400247 4.2441355a1.2675855 1.1997888 0 0 0 -1.26757814 1.1992188 1.2675855 1.1997888 0 0 0 1.26757814 1.1992187 1.2675855 1.1997888 0 0 0 1.2675781-1.1992187 1.2675855 1.1997888 0 0 0 -1.2675781-1.1992188zm.00195.4238282a.84677333.80148375 0 0 1 .8476593.8007812.84677333.80148375 0 0 1 -.8476562.8007812.84677333.80148375 0 0 1 -.84765624-.8007812.84677333.80148375 0 0 1 .84765624-.8007812z"/><path d="m14.659116 4.188616a1.2675855 1.1997888 0 0 0 -1.267578 1.1992188 1.2675855 1.1997888 0 0 0 1.267578 1.1992187 1.2675855 1.1997888 0 0 0 1.267578-1.1992187 1.2675855 1.1997888 0 0 0 -1.267578-1.1992188zm.002.4238282a.84677333.80148375 0 0 1 .847659.8007812.84677333.80148375 0 0 1 -.847656.8007812.84677333.80148375 0 0 1 -.847656-.8007812.84677333.80148375 0 0 1 .847656-.8007812z"/></g></svg> |