summaryrefslogtreecommitdiff
path: root/editor/plugins/asset_library_editor_plugin.cpp
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2022-06-29 19:27:27 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2022-06-30 01:26:08 +0200
commit0e504e4191d4d535ff296befb3c281c44ae95d88 (patch)
treeda5a546d2d070006debe427b6bd8da8b485d7c2e /editor/plugins/asset_library_editor_plugin.cpp
parent44516d1a5c858ce0425f2c278a5a0a941dca44be (diff)
[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.
Diffstat (limited to 'editor/plugins/asset_library_editor_plugin.cpp')
-rw-r--r--editor/plugins/asset_library_editor_plugin.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp
index 249b3a6d6a..e9435faae1 100644
--- a/editor/plugins/asset_library_editor_plugin.cpp
+++ b/editor/plugins/asset_library_editor_plugin.cpp
@@ -32,6 +32,7 @@
#include "core/input/input.h"
#include "core/io/json.h"
+#include "core/io/stream_peer_ssl.h"
#include "core/os/keyboard.h"
#include "core/version.h"
#include "editor/editor_file_dialog.h"
@@ -1588,6 +1589,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();