diff options
author | Chaosus <chaosus89@gmail.com> | 2019-06-19 14:00:15 +0300 |
---|---|---|
committer | Chaosus <chaosus89@gmail.com> | 2019-06-19 15:10:48 +0300 |
commit | be7bd97cb098e0af0fd844172f64c44a27c81af3 (patch) | |
tree | 1202c9dac7a79a926d87fb5160908937b4f4c827 | |
parent | 7fa941bfd8a1d81fc5c27c21635e60846efc52f4 (diff) |
Added button to select all tracks in track copy dialog
-rw-r--r-- | editor/animation_track_editor.cpp | 31 | ||||
-rw-r--r-- | editor/animation_track_editor.h | 6 |
2 files changed, 35 insertions, 2 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 3295753bda..25dee14d38 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -4568,7 +4568,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) { it->set_metadata(0, md); } - track_copy_dialog->popup_centered_minsize(Size2(300, 500) * EDSCALE); + track_copy_dialog->popup_centered_minsize(Size2(350, 500) * EDSCALE); } break; case EDIT_COPY_TRACKS_CONFIRM: { @@ -4962,6 +4962,19 @@ void AnimationTrackEditor::_show_imported_anim_warning() const { TTR("Warning: Editing imported animation")); } +void AnimationTrackEditor::_select_all_tracks_for_copy() { + TreeItem *track = track_copy_select->get_root()->get_children(); + while (track) { + track->set_checked(0, selected_all_tracks); + track = track->get_next(); + } + selected_all_tracks = !selected_all_tracks; + if (selected_all_tracks) + select_all_button->set_text(TTR("Select All")); + else + select_all_button->set_text(TTR("Select None")); +} + void AnimationTrackEditor::_bind_methods() { ClassDB::bind_method("_animation_changed", &AnimationTrackEditor::_animation_changed); @@ -5002,6 +5015,7 @@ void AnimationTrackEditor::_bind_methods() { ClassDB::bind_method("_selection_changed", &AnimationTrackEditor::_selection_changed); ClassDB::bind_method("_snap_mode_changed", &AnimationTrackEditor::_snap_mode_changed); ClassDB::bind_method("_show_imported_anim_warning", &AnimationTrackEditor::_show_imported_anim_warning); + ClassDB::bind_method("_select_all_tracks_for_copy", &AnimationTrackEditor::_select_all_tracks_for_copy); ADD_SIGNAL(MethodInfo("timeline_changed", PropertyInfo(Variant::REAL, "position"), PropertyInfo(Variant::BOOL, "drag"))); ADD_SIGNAL(MethodInfo("keying_changed")); @@ -5284,9 +5298,22 @@ AnimationTrackEditor::AnimationTrackEditor() { track_copy_dialog->set_title(TTR("Select tracks to copy:")); track_copy_dialog->get_ok()->set_text(TTR("Copy")); + VBoxContainer *track_vbox = memnew(VBoxContainer); + track_copy_dialog->add_child(track_vbox); + + selected_all_tracks = true; + track_copy_select = memnew(Tree); + track_copy_select->set_h_size_flags(SIZE_EXPAND_FILL); + track_copy_select->set_v_size_flags(SIZE_EXPAND_FILL); track_copy_select->set_hide_root(true); - track_copy_dialog->add_child(track_copy_select); + track_vbox->add_child(track_copy_select); + track_copy_options = memnew(HBoxContainer); + track_vbox->add_child(track_copy_options); + select_all_button = memnew(Button); + select_all_button->set_text(TTR("Select All")); + select_all_button->connect("pressed", this, "_select_all_tracks_for_copy"); + track_copy_options->add_child(select_all_button); track_copy_dialog->connect("confirmed", this, "_edit_menu_pressed", varray(EDIT_COPY_TRACKS_CONFIRM)); animation_changing_awaiting_update = false; } diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h index c64f663b3b..f0aadd214d 100644 --- a/editor/animation_track_editor.h +++ b/editor/animation_track_editor.h @@ -445,6 +445,8 @@ class AnimationTrackEditor : public VBoxContainer { ConfirmationDialog *scale_dialog; SpinBox *scale; + void _select_all_tracks_for_copy(); + void _edit_menu_pressed(int p_option); int last_menu_track_opt; @@ -458,8 +460,12 @@ class AnimationTrackEditor : public VBoxContainer { void _selection_changed(); + bool selected_all_tracks; ConfirmationDialog *track_copy_dialog; Tree *track_copy_select; + HBoxContainer *track_copy_options; + Button *select_all_button; + struct TrackClipboard { NodePath full_path; NodePath base_path; |