Merge pull request #29899 from Chaosus/select_all_tracks
Added button to select all tracks in track copy dialog
This commit is contained in:
commit
bf7a6f9c46
2 changed files with 35 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue