You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 19:11:41 +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.
This commit is contained in:
@@ -460,7 +460,7 @@ void EditorNode::shortcut_input(const Ref<InputEvent> &p_event) {
|
||||
_editor_select(EDITOR_SCRIPT);
|
||||
} else if (ED_IS_SHORTCUT("editor/editor_help", p_event)) {
|
||||
emit_signal(SNAME("request_help_search"), "");
|
||||
} else if (ED_IS_SHORTCUT("editor/editor_assetlib", p_event) && StreamPeerSSL::is_available()) {
|
||||
} else if (ED_IS_SHORTCUT("editor/editor_assetlib", p_event) && AssetLibraryEditorPlugin::is_available()) {
|
||||
_editor_select(EDITOR_ASSETLIB);
|
||||
} else if (ED_IS_SHORTCUT("editor/editor_next", p_event)) {
|
||||
_editor_select_next();
|
||||
@@ -5752,12 +5752,12 @@ void EditorNode::_feature_profile_changed() {
|
||||
|
||||
main_editor_buttons[EDITOR_3D]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D));
|
||||
main_editor_buttons[EDITOR_SCRIPT]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT));
|
||||
if (StreamPeerSSL::is_available()) {
|
||||
if (AssetLibraryEditorPlugin::is_available()) {
|
||||
main_editor_buttons[EDITOR_ASSETLIB]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_ASSET_LIB));
|
||||
}
|
||||
if ((profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D) && singleton->main_editor_buttons[EDITOR_3D]->is_pressed()) ||
|
||||
(profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT) && singleton->main_editor_buttons[EDITOR_SCRIPT]->is_pressed()) ||
|
||||
(StreamPeerSSL::is_available() && profile->is_feature_disabled(EditorFeatureProfile::FEATURE_ASSET_LIB) && singleton->main_editor_buttons[EDITOR_ASSETLIB]->is_pressed())) {
|
||||
(AssetLibraryEditorPlugin::is_available() && profile->is_feature_disabled(EditorFeatureProfile::FEATURE_ASSET_LIB) && singleton->main_editor_buttons[EDITOR_ASSETLIB]->is_pressed())) {
|
||||
_editor_select(EDITOR_2D);
|
||||
}
|
||||
} else {
|
||||
@@ -5769,7 +5769,7 @@ void EditorNode::_feature_profile_changed() {
|
||||
FileSystemDock::get_singleton()->set_visible(true);
|
||||
main_editor_buttons[EDITOR_3D]->set_visible(true);
|
||||
main_editor_buttons[EDITOR_SCRIPT]->set_visible(true);
|
||||
if (StreamPeerSSL::is_available()) {
|
||||
if (AssetLibraryEditorPlugin::is_available()) {
|
||||
main_editor_buttons[EDITOR_ASSETLIB]->set_visible(true);
|
||||
}
|
||||
}
|
||||
@@ -7073,13 +7073,11 @@ EditorNode::EditorNode() {
|
||||
|
||||
// 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()) {
|
||||
if (AssetLibraryEditorPlugin::is_available()) {
|
||||
add_editor_plugin(memnew(AssetLibraryEditorPlugin));
|
||||
} else {
|
||||
WARN_PRINT("Asset Library not available, as it requires SSL to work.");
|
||||
}
|
||||
#endif
|
||||
|
||||
// Add interface before adding plugins.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user