diff --git a/platform/web/SCsub b/platform/web/SCsub index b30bf20f26c1..a85fbcd0f576 100644 --- a/platform/web/SCsub +++ b/platform/web/SCsub @@ -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( [ diff --git a/platform/web/api/api.cpp b/platform/web/api/api.cpp index 40417bde7e7c..f9c1f0fd91c3 100644 --- a/platform/web/api/api.cpp +++ b/platform/web/api/api.cpp @@ -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); diff --git a/platform/web/api/web_tools_editor_plugin.cpp b/platform/web/editor/web_tools_editor_plugin.cpp similarity index 98% rename from platform/web/api/web_tools_editor_plugin.cpp rename to platform/web/editor/web_tools_editor_plugin.cpp index 61801372ba1c..a98d45a49a66 100644 --- a/platform/web/api/web_tools_editor_plugin.cpp +++ b/platform/web/editor/web_tools_editor_plugin.cpp @@ -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 diff --git a/platform/web/api/web_tools_editor_plugin.h b/platform/web/editor/web_tools_editor_plugin.h similarity index 96% rename from platform/web/api/web_tools_editor_plugin.h rename to platform/web/editor/web_tools_editor_plugin.h index 2902f60f2421..70b47ab49cbb 100644 --- a/platform/web/api/web_tools_editor_plugin.h +++ b/platform/web/editor/web_tools_editor_plugin.h @@ -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 @@ class WebToolsEditorPlugin { static void initialize() {} }; -#endif // TOOLS_ENABLED && WEB_ENABLED - #endif // WEB_TOOLS_EDITOR_PLUGIN_H diff --git a/platform/web/web_main.cpp b/platform/web/web_main.cpp index d0c3bd7c0e1e..3487ed2ded6f 100644 --- a/platform/web/web_main.cpp +++ b/platform/web/web_main.cpp @@ -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 #include @@ -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