diff options
Diffstat (limited to 'editor/animation_track_editor.h')
-rw-r--r-- | editor/animation_track_editor.h | 57 |
1 files changed, 35 insertions, 22 deletions
diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h index 2bdc1d4107..1baebc469e 100644 --- a/editor/animation_track_editor.h +++ b/editor/animation_track_editor.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -37,7 +37,6 @@ #include "editor/property_selector.h" #include "scene/gui/control.h" -#include "scene/gui/file_dialog.h" #include "scene/gui/menu_button.h" #include "scene/gui/scroll_bar.h" #include "scene/gui/slider.h" @@ -48,8 +47,8 @@ #include "scene_tree_editor.h" class AnimationPlayer; - class AnimationTrackEdit; +class ViewPanner; class AnimationTimelineEdit : public Range { GDCLASS(AnimationTimelineEdit, Range); @@ -78,14 +77,16 @@ class AnimationTimelineEdit : public Range { UndoRedo *undo_redo; Rect2 hsize_rect; - bool editing; - bool use_fps; + bool editing = false; + bool use_fps = false; + + Ref<ViewPanner> panner; + void _scroll_callback(Vector2 p_scroll_vec, bool p_alt); + void _pan_callback(Vector2 p_scroll_vec); + void _zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt); - bool panning_timeline; - float panning_timeline_from; - float panning_timeline_at; - bool dragging_timeline; - bool dragging_hsize; + bool dragging_timeline = false; + bool dragging_hsize = false; float dragging_hsize_from; float dragging_hsize_at; @@ -120,6 +121,8 @@ public: void set_hscroll(HScrollBar *p_hscroll); + virtual CursorShape get_cursor_shape(const Point2 &p_pos) const override; + AnimationTimelineEdit(); }; @@ -140,6 +143,7 @@ class AnimationTrackEdit : public Control { MENU_LOOP_CLAMP, MENU_KEY_INSERT, MENU_KEY_DUPLICATE, + MENU_KEY_ADD_RESET, MENU_KEY_DELETE }; AnimationTimelineEdit *timeline; @@ -161,14 +165,13 @@ class AnimationTrackEdit : public Control { Rect2 interp_mode_rect; Rect2 loop_wrap_rect; Rect2 remove_rect; - Rect2 bezier_edit_rect; Ref<Texture2D> type_icon; Ref<Texture2D> selected_icon; PopupMenu *menu; - bool clicking_on_name; + bool clicking_on_name = false; void _zoom_changed(); @@ -181,14 +184,16 @@ class AnimationTrackEdit : public Control { void _play_position_draw(); bool _is_value_key_valid(const Variant &p_key_value, Variant::Type &r_valid_type) const; + Ref<Texture2D> _get_key_type_icon() const; + mutable int dropping_at; float insert_at_pos; - bool moving_selection_attempt; + bool moving_selection_attempt = false; int select_single_attempt; - bool moving_selection; + bool moving_selection = false; float moving_selection_from_ofs; - bool in_group; + bool in_group = false; AnimationTrackEditor *editor; protected: @@ -297,6 +302,7 @@ class AnimationTrackEditor : public VBoxContainer { EditorSpinSlider *step; TextureRect *zoom_icon; Button *snap; + Button *bezier_edit_icon; OptionButton *snap_mode; Button *imported_anim_warning; @@ -306,14 +312,14 @@ class AnimationTrackEditor : public VBoxContainer { Vector<AnimationTrackEdit *> track_edits; Vector<AnimationTrackEditGroup *> groups; - bool animation_changing_awaiting_update; + bool animation_changing_awaiting_update = false; void _animation_update(); int _get_track_selected(); void _animation_changed(); void _update_tracks(); void _name_limit_changed(); - void _timeline_changed(float p_new_pos, bool p_drag, bool p_timeline_only = false); + void _timeline_changed(float p_new_pos, bool p_drag, bool p_timeline_only); void _track_remove_request(int p_track); void _track_grab_focus(int p_track); @@ -336,7 +342,7 @@ class AnimationTrackEditor : public VBoxContainer { int adding_track_type; NodePath adding_track_path; - bool keying; + bool keying = false; struct InsertData { Animation::TrackType type; @@ -351,7 +357,7 @@ class AnimationTrackEditor : public VBoxContainer { CheckBox *insert_confirm_bezier; CheckBox *insert_confirm_reset; ConfirmationDialog *insert_confirm; - bool insert_queue; + bool insert_queue = false; List<InsertData> insert_data; void _query_insert(const InsertData &p_id); @@ -373,6 +379,11 @@ class AnimationTrackEditor : public VBoxContainer { PropertyInfo _find_hint_for_track(int p_idx, NodePath &r_base_path, Variant *r_current_val = nullptr); + Ref<ViewPanner> panner; + void _scroll_callback(Vector2 p_scroll_vec, bool p_alt); + void _pan_callback(Vector2 p_scroll_vec); + void _zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt); + void _timeline_value_changed(double); float insert_key_from_track_call_ofs; @@ -401,7 +412,7 @@ class AnimationTrackEditor : public VBoxContainer { void _key_selected(int p_key, bool p_single, int p_track); void _key_deselected(int p_key, int p_track); - bool moving_selection; + bool moving_selection = false; float moving_selection_offset; void _move_selection_begin(); void _move_selection(float p_offset); @@ -416,13 +427,14 @@ class AnimationTrackEditor : public VBoxContainer { Control *box_selection; void _box_selection_draw(); - bool box_selecting; + bool box_selecting = false; Vector2 box_selecting_from; Rect2 box_select_rect; void _scroll_input(const Ref<InputEvent> &p_event); Vector<Ref<AnimationTrackEditPlugin>> track_edit_plugins; + void _toggle_bezier_edit(); void _cancel_bezier_edit(); void _bezier_edit(int p_for_track); @@ -500,6 +512,7 @@ public: EDIT_SCALE_CONFIRM, EDIT_DUPLICATE_SELECTION, EDIT_DUPLICATE_TRANSPOSED, + EDIT_ADD_RESET_KEY, EDIT_DELETE_SELECTION, EDIT_GOTO_NEXT_STEP, EDIT_GOTO_PREV_STEP, |