summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-06-19 20:04:54 +0200
committerGitHub <noreply@github.com>2019-06-19 20:04:54 +0200
commitbf7a6f9c46fcd0dcd11745b60684d20a26c48890 (patch)
treedab99af9d103fb374fc30635d15f21ecdfa6d344 /editor
parent1abfd61f6ea125032d277d90b004841b877be3b7 (diff)
parentbe7bd97cb098e0af0fd844172f64c44a27c81af3 (diff)
Merge pull request #29899 from Chaosus/select_all_tracks
Added button to select all tracks in track copy dialog
Diffstat (limited to 'editor')
-rw-r--r--editor/animation_track_editor.cpp31
-rw-r--r--editor/animation_track_editor.h6
2 files changed, 35 insertions, 2 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index 67e42dfb8c..6e47fadb20 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -4569,7 +4569,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: {
@@ -4963,6 +4963,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);
@@ -5003,6 +5016,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"));
@@ -5285,9 +5299,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 54e0675ab7..0f1363b34f 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;