1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-22 15:06:45 +00:00

[AssetLib] Fix crash in Web editor.

Add EditorAssetLibrary::is_available which always returns false in the
Web editor and use it in EditorNode for detection.

(cherry picked from commit 0e504e4191)
This commit is contained in:
Fabio Alessandrelli
2022-06-29 19:27:27 +02:00
committed by Rémi Verschelde
parent f05cecdc43
commit ad5fdcc0f3
4 changed files with 19 additions and 12 deletions

View File

@@ -31,6 +31,7 @@
#include "asset_library_editor_plugin.h"
#include "core/io/json.h"
#include "core/io/stream_peer_ssl.h"
#include "core/version.h"
#include "editor/editor_node.h"
#include "editor/editor_scale.h"
@@ -1582,6 +1583,16 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
///////
bool AssetLibraryEditorPlugin::is_available() {
#ifdef JAVASCRIPT_ENABLED
// Asset Library can't work on Web editor for now as most assets are sourced
// directly from GitHub which does not set CORS.
return false;
#else
return StreamPeerSSL::is_available();
#endif
}
void AssetLibraryEditorPlugin::make_visible(bool p_visible) {
if (p_visible) {
addon_library->show();