[Web] Fix Web Editor plugin being added to SCons multiple times

Move the Web Editor plugin files to an editor sub-folder inside the
platform folder.
This commit is contained in:
Fabio Alessandrelli 2024-11-11 11:30:41 +01:00
parent fd4c29a189
commit b4f8135d46
5 changed files with 11 additions and 11 deletions

View file

@ -27,9 +27,11 @@ web_files = [
"javascript_bridge_singleton.cpp",
"web_main.cpp",
"os_web.cpp",
"api/web_tools_editor_plugin.cpp",
]
if env["target"] == "editor":
env.add_source_files(web_files, "editor/*.cpp")
sys_env = env.Clone()
sys_env.AddJSLibraries(
[

View file

@ -31,14 +31,12 @@
#include "api.h"
#include "javascript_bridge_singleton.h"
#include "web_tools_editor_plugin.h"
#include "core/config/engine.h"
static JavaScriptBridge *javascript_bridge_singleton;
void register_web_api() {
WebToolsEditorPlugin::initialize();
GDREGISTER_ABSTRACT_CLASS(JavaScriptObject);
GDREGISTER_ABSTRACT_CLASS(JavaScriptBridge);
javascript_bridge_singleton = memnew(JavaScriptBridge);

View file

@ -30,8 +30,6 @@
#include "web_tools_editor_plugin.h"
#if defined(TOOLS_ENABLED) && defined(WEB_ENABLED)
#include "core/config/engine.h"
#include "core/config/project_settings.h"
#include "core/io/dir_access.h"
@ -155,5 +153,3 @@ void WebToolsEditorPlugin::_zip_recursive(String p_path, String p_base_path, zip
cur = dir->get_next();
}
}
#endif // TOOLS_ENABLED && WEB_ENABLED

View file

@ -31,8 +31,6 @@
#ifndef WEB_TOOLS_EDITOR_PLUGIN_H
#define WEB_TOOLS_EDITOR_PLUGIN_H
#if defined(TOOLS_ENABLED) && defined(WEB_ENABLED)
#include "core/io/zip_io.h"
#include "editor/plugins/editor_plugin.h"
@ -57,6 +55,4 @@ public:
static void initialize() {}
};
#endif // TOOLS_ENABLED && WEB_ENABLED
#endif // WEB_TOOLS_EDITOR_PLUGIN_H

View file

@ -38,6 +38,10 @@
#include "scene/main/scene_tree.h"
#include "scene/main/window.h" // SceneTree only forward declares it.
#ifdef TOOLS_ENABLED
#include "editor/web_tools_editor_plugin.h"
#endif
#include <emscripten/emscripten.h>
#include <stdlib.h>
@ -104,6 +108,10 @@ void main_loop_callback() {
extern EMSCRIPTEN_KEEPALIVE int godot_web_main(int argc, char *argv[]) {
os = new OS_Web();
#ifdef TOOLS_ENABLED
WebToolsEditorPlugin::initialize();
#endif
// We must override main when testing is enabled
TEST_MAIN_OVERRIDE