summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-10-26 09:12:29 +0200
committerGitHub <noreply@github.com>2019-10-26 09:12:29 +0200
commita8e007f055c69483c77945739f2c3218de5e5c44 (patch)
treecb1cc44d635ac9070e5de673b3517afaacb70e1e /editor/plugins
parent8cef880c39fb1b4062d75e9cd241288a2ea68f2e (diff)
parent41c89880f815d1a5d8be94a4624b33aa3ab661d3 (diff)
Merge pull request #33078 from Calinou/assetlib-no-results-message
Display a message if no results are found in the asset library
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/asset_library_editor_plugin.cpp15
-rw-r--r--editor/plugins/asset_library_editor_plugin.h1
2 files changed, 15 insertions, 1 deletions
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp
index d5b1f46333..95767a96d8 100644
--- a/editor/plugins/asset_library_editor_plugin.cpp
+++ b/editor/plugins/asset_library_editor_plugin.cpp
@@ -1137,9 +1137,12 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const
initial_loading = false;
- // The loading text only needs to be displayed before the first page is loaded
+ // The loading text only needs to be displayed before the first page is loaded.
+ // Therefore, we don't need to show it again.
library_loading->hide();
+ library_error->hide();
+
if (asset_items) {
memdelete(asset_items);
}
@@ -1187,6 +1190,11 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const
asset_bottom_page = _make_pages(page, pages, page_len, total_items, result.size());
library_vb->add_child(asset_bottom_page);
+ if (result.empty()) {
+ library_error->set_text(vformat(TTR("No results for \"%s\"."), filter->get_text()));
+ library_error->show();
+ }
+
for (int i = 0; i < result.size(); i++) {
Dictionary r = result[i];
@@ -1453,6 +1461,11 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
library_loading->set_align(Label::ALIGN_CENTER);
library_vb->add_child(library_loading);
+ library_error = memnew(Label);
+ library_error->set_align(Label::ALIGN_CENTER);
+ library_error->hide();
+ library_vb->add_child(library_error);
+
asset_top_page = memnew(HBoxContainer);
library_vb->add_child(asset_top_page);
diff --git a/editor/plugins/asset_library_editor_plugin.h b/editor/plugins/asset_library_editor_plugin.h
index 94289f3b49..70ffbd9eed 100644
--- a/editor/plugins/asset_library_editor_plugin.h
+++ b/editor/plugins/asset_library_editor_plugin.h
@@ -184,6 +184,7 @@ class EditorAssetLibrary : public PanelContainer {
ScrollContainer *library_scroll;
VBoxContainer *library_vb;
Label *library_loading;
+ Label *library_error;
LineEdit *filter;
OptionButton *categories;
OptionButton *repository;