diff options
Diffstat (limited to 'editor/animation_bezier_editor.cpp')
-rw-r--r-- | editor/animation_bezier_editor.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index e524dffd43..1283956ae6 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -275,8 +275,6 @@ void AnimationBezierTrackEdit::_notification(int p_what) { int margin = 0; { - int ofs = 0; - NodePath path = animation->track_get_path(track); Node *node = NULL; @@ -290,6 +288,8 @@ void AnimationBezierTrackEdit::_notification(int p_what) { int h = font->get_height(); if (node) { + int ofs = 0; + Ref<Texture> icon = EditorNode::get_singleton()->get_object_icon(node, "Node"); h = MAX(h, icon->get_height()); @@ -354,10 +354,12 @@ void AnimationBezierTrackEdit::_notification(int p_what) { { //guides float min_left_scale = font->get_height() + vsep; - float scale = 1; + float scale = (min_left_scale * 2) * v_zoom; + float step = Math::pow(10.0, Math::round(Math::log(scale / 5.0) / Math::log(10.0))) * 5.0; + scale = Math::stepify(scale, step); while (scale / v_zoom < min_left_scale * 2) { - scale *= 5; + scale += step; } bool first = true; @@ -378,7 +380,7 @@ void AnimationBezierTrackEdit::_notification(int p_what) { draw_line(Point2(limit, i), Point2(right_limit, i), lc); Color c = color; c.a *= 0.5; - draw_string(font, Point2(limit + 8, i - 2), itos((iv + 1) * scale), c); + draw_string(font, Point2(limit + 8, i - 2), rtos(Math::stepify((iv + 1) * scale, step)), c); } first = false; @@ -544,7 +546,7 @@ void AnimationBezierTrackEdit::set_timeline(AnimationTimelineEdit *p_timeline) { } void AnimationBezierTrackEdit::set_editor(AnimationTrackEditor *p_editor) { editor = p_editor; - connect("clear_selection", editor, "_clear_selection"); + connect("clear_selection", editor, "_clear_selection", varray(false)); } void AnimationBezierTrackEdit::_play_position_draw() { @@ -628,24 +630,28 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { Ref<InputEventMouseButton> mb = p_event; if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_DOWN) { + float v_zoom_orig = v_zoom; if (mb->get_command()) { timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() * 1.05); } else { - if (v_zoom < 1000) { + if (v_zoom < 100000) { v_zoom *= 1.2; } } + v_scroll = v_scroll + (mb->get_position().y - get_size().y / 2) * (v_zoom - v_zoom_orig); update(); } if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_UP) { + float v_zoom_orig = v_zoom; if (mb->get_command()) { timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() / 1.05); } else { - if (v_zoom > 0.01) { + if (v_zoom > 0.000001) { v_zoom /= 1.2; } } + v_scroll = v_scroll + (mb->get_position().y - get_size().y / 2) * (v_zoom - v_zoom_orig); update(); } @@ -923,13 +929,6 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { undo_redo->add_undo_method(animation.ptr(), "track_insert_key", amr.track, amr.time, amr.key, 1); } - // 6-(undo) reinsert overlapped keys - for (List<AnimMoveRestore>::Element *E = to_restore.front(); E; E = E->next()) { - - AnimMoveRestore &amr = E->get(); - undo_redo->add_undo_method(animation.ptr(), "track_insert_key", amr.track, amr.time, amr.key, 1); - } - undo_redo->add_do_method(this, "_clear_selection_for_anim", animation); undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation); |