Skip to content

Commit

Permalink
HTML5: Always disable Asset Library
Browse files Browse the repository at this point in the history
GitHub doesn't allow CORS so we can't download assets from it.

There'd also be more work needed for the Asset Library plugin to be
usable in the Web editor even if that was supported.

(cherry picked from commit 42b4849)
  • Loading branch information
akien-mga authored and Riordan-DC committed Jan 23, 2023
1 parent ee74f87 commit 4b52be8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6964,11 +6964,15 @@ EditorNode::EditorNode() {
ScriptTextEditor::register_editor(); //register one for text scripts
TextEditor::register_editor();

// Asset Library can't work on Web editor for now as most assets are sourced
// directly from GitHub which does not set CORS.
#ifndef JAVASCRIPT_ENABLED
if (StreamPeerSSL::is_available()) {
add_editor_plugin(memnew(AssetLibraryEditorPlugin(this)));
} else {
WARN_PRINT("Asset Library not available, as it requires SSL to work.");
}
#endif

//add interface before adding plugins

Expand Down
4 changes: 4 additions & 0 deletions editor/project_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2593,6 +2593,9 @@ ProjectManager::ProjectManager() {
about_btn->connect("pressed", this, "_show_about");
tree_vb->add_child(about_btn);

// Asset Library can't work on Web editor for now as most assets are sourced
// directly from GitHub which does not set CORS.
#ifndef JAVASCRIPT_ENABLED
if (StreamPeerSSL::is_available()) {
asset_library = memnew(EditorAssetLibrary(true));
asset_library->set_name(TTR("Asset Library Projects"));
Expand All @@ -2601,6 +2604,7 @@ ProjectManager::ProjectManager() {
} else {
WARN_PRINT("Asset Library not available, as it requires SSL to work.");
}
#endif

HBoxContainer *settings_hb = memnew(HBoxContainer);
settings_hb->set_alignment(BoxContainer::ALIGN_END);
Expand Down

0 comments on commit 4b52be8

Please sign in to comment.