Skip to content

Commit 28e8a4c

Browse files
committed
Replace empty list dialog with an integrated panel
1 parent 068c0d2 commit 28e8a4c

5 files changed

Lines changed: 236 additions & 164 deletions

File tree

editor/plugins/asset_library_editor_plugin.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int
10431043

10441044
Button *first = memnew(Button);
10451045
first->set_text(TTR("First", "Pagination"));
1046+
first->set_theme_type_variation("PanelBackgroundButton");
10461047
if (p_page != 0) {
10471048
first->connect("pressed", callable_mp(this, &EditorAssetLibrary::_search).bind(0));
10481049
} else {
@@ -1053,6 +1054,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int
10531054

10541055
Button *prev = memnew(Button);
10551056
prev->set_text(TTR("Previous", "Pagination"));
1057+
prev->set_theme_type_variation("PanelBackgroundButton");
10561058
if (p_page > 0) {
10571059
prev->connect("pressed", callable_mp(this, &EditorAssetLibrary::_search).bind(p_page - 1));
10581060
} else {
@@ -1063,26 +1065,22 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int
10631065
hbc->add_child(memnew(VSeparator));
10641066

10651067
for (int i = from; i < to; i++) {
1068+
Button *current = memnew(Button);
1069+
// Add padding to make page number buttons easier to click.
1070+
current->set_text(vformat(" %d ", i + 1));
1071+
current->set_theme_type_variation("PanelBackgroundButton");
10661072
if (i == p_page) {
1067-
Button *current = memnew(Button);
1068-
// Keep the extended padding for the currently active page (see below).
1069-
current->set_text(vformat(" %d ", i + 1));
10701073
current->set_disabled(true);
10711074
current->set_focus_mode(Control::FOCUS_NONE);
1072-
1073-
hbc->add_child(current);
10741075
} else {
1075-
Button *current = memnew(Button);
1076-
// Add padding to make page number buttons easier to click.
1077-
current->set_text(vformat(" %d ", i + 1));
10781076
current->connect("pressed", callable_mp(this, &EditorAssetLibrary::_search).bind(i));
1079-
1080-
hbc->add_child(current);
10811077
}
1078+
hbc->add_child(current);
10821079
}
10831080

10841081
Button *next = memnew(Button);
10851082
next->set_text(TTR("Next", "Pagination"));
1083+
next->set_theme_type_variation("PanelBackgroundButton");
10861084
if (p_page < p_page_count - 1) {
10871085
next->connect("pressed", callable_mp(this, &EditorAssetLibrary::_search).bind(p_page + 1));
10881086
} else {
@@ -1094,6 +1092,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int
10941092

10951093
Button *last = memnew(Button);
10961094
last->set_text(TTR("Last", "Pagination"));
1095+
last->set_theme_type_variation("PanelBackgroundButton");
10971096
if (p_page != p_page_count - 1) {
10981097
last->connect("pressed", callable_mp(this, &EditorAssetLibrary::_search).bind(p_page_count - 1));
10991098
} else {
@@ -1619,6 +1618,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
16191618

16201619
library_message_button = memnew(Button);
16211620
library_message_button->set_h_size_flags(SIZE_SHRINK_CENTER);
1621+
library_message_button->set_theme_type_variation("PanelBackgroundButton");
16221622
library_message_box->add_child(library_message_button);
16231623

16241624
asset_top_page = memnew(HBoxContainer);

0 commit comments

Comments
 (0)