Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add icon, tooltip, rename button in AnimationLibraryEditor for clarity. #86736

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions editor/plugins/animation_library_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,15 @@ void AnimationLibraryEditor::show_dialog() {
popup_centered_ratio(0.5);
}

void AnimationLibraryEditor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_THEME_CHANGED: {
new_library_button->set_icon(get_editor_theme_icon(SNAME("Add")));
load_library_button->set_icon(get_editor_theme_icon(SNAME("Load")));
}
}
}

void AnimationLibraryEditor::_update_editor(Object *p_mixer) {
emit_signal("update_editor", p_mixer);
}
Expand Down Expand Up @@ -800,12 +809,14 @@ AnimationLibraryEditor::AnimationLibraryEditor() {
VBoxContainer *vb = memnew(VBoxContainer);
HBoxContainer *hb = memnew(HBoxContainer);
hb->add_spacer(true);
Button *b = memnew(Button(TTR("Add Library")));
b->connect("pressed", callable_mp(this, &AnimationLibraryEditor::_add_library));
hb->add_child(b);
b = memnew(Button(TTR("Load Library")));
b->connect("pressed", callable_mp(this, &AnimationLibraryEditor::_load_library));
hb->add_child(b);
new_library_button = memnew(Button(TTR("New Library")));
new_library_button->set_tooltip_text(TTR("Create new empty animation library."));
new_library_button->connect("pressed", callable_mp(this, &AnimationLibraryEditor::_add_library));
hb->add_child(new_library_button);
load_library_button = memnew(Button(TTR("Load Library")));
load_library_button->set_tooltip_text(TTR("Load animation library from disk."));
load_library_button->connect("pressed", callable_mp(this, &AnimationLibraryEditor::_load_library));
hb->add_child(load_library_button);
vb->add_child(hb);
tree = memnew(Tree);
vb->add_child(tree);
Expand Down
4 changes: 4 additions & 0 deletions editor/plugins/animation_library_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ class AnimationLibraryEditor : public AcceptDialog {
StringName file_dialog_animation;
StringName file_dialog_library;

Button *new_library_button = nullptr;
Button *load_library_button = nullptr;

AcceptDialog *error_dialog = nullptr;
bool adding_animation = false;
StringName adding_animation_to_library;
Expand Down Expand Up @@ -108,6 +111,7 @@ class AnimationLibraryEditor : public AcceptDialog {
bool updating = false;

protected:
void _notification(int p_what);
void _update_editor(Object *p_mixer);
static void _bind_methods();

Expand Down
Loading