1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-23 15:16:17 +00:00

Refresh the asset library only once on startup

This avoids unnecessary calls to the API when switching between tabs
in the editor or project manager.
This commit is contained in:
Hugo Locurcio
2019-09-02 19:42:58 +02:00
parent 2beea262be
commit 6f915d386a
2 changed files with 5 additions and 1 deletions

View File

@@ -586,7 +586,7 @@ void EditorAssetLibrary::_notification(int p_what) {
} break; } break;
case NOTIFICATION_VISIBILITY_CHANGED: { case NOTIFICATION_VISIBILITY_CHANGED: {
if (is_visible()) { if (is_visible() && initial_loading) {
_repository_changed(0); // Update when shown for the first time. _repository_changed(0); // Update when shown for the first time.
} }
} break; } break;
@@ -1133,6 +1133,8 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const
} break; } break;
case REQUESTING_SEARCH: { case REQUESTING_SEARCH: {
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
library_loading->hide(); library_loading->hide();
@@ -1328,6 +1330,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
requesting = REQUESTING_NONE; requesting = REQUESTING_NONE;
templates_only = p_templates_only; templates_only = p_templates_only;
initial_loading = true;
VBoxContainer *library_main = memnew(VBoxContainer); VBoxContainer *library_main = memnew(VBoxContainer);

View File

@@ -206,6 +206,7 @@ class EditorAssetLibrary : public PanelContainer {
HTTPRequest *request; HTTPRequest *request;
bool templates_only; bool templates_only;
bool initial_loading;
enum Support { enum Support {
SUPPORT_OFFICIAL, SUPPORT_OFFICIAL,