Skip to content

Commit b4f8135

Browse files
committed
[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.
1 parent fd4c29a commit b4f8135

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

platform/web/SCsub

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ web_files = [
2727
"javascript_bridge_singleton.cpp",
2828
"web_main.cpp",
2929
"os_web.cpp",
30-
"api/web_tools_editor_plugin.cpp",
3130
]
3231

32+
if env["target"] == "editor":
33+
env.add_source_files(web_files, "editor/*.cpp")
34+
3335
sys_env = env.Clone()
3436
sys_env.AddJSLibraries(
3537
[

platform/web/api/api.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,12 @@
3131
#include "api.h"
3232

3333
#include "javascript_bridge_singleton.h"
34-
#include "web_tools_editor_plugin.h"
3534

3635
#include "core/config/engine.h"
3736

3837
static JavaScriptBridge *javascript_bridge_singleton;
3938

4039
void register_web_api() {
41-
WebToolsEditorPlugin::initialize();
4240
GDREGISTER_ABSTRACT_CLASS(JavaScriptObject);
4341
GDREGISTER_ABSTRACT_CLASS(JavaScriptBridge);
4442
javascript_bridge_singleton = memnew(JavaScriptBridge);

platform/web/api/web_tools_editor_plugin.cpp renamed to platform/web/editor/web_tools_editor_plugin.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030

3131
#include "web_tools_editor_plugin.h"
3232

33-
#if defined(TOOLS_ENABLED) && defined(WEB_ENABLED)
34-
3533
#include "core/config/engine.h"
3634
#include "core/config/project_settings.h"
3735
#include "core/io/dir_access.h"
@@ -155,5 +153,3 @@ void WebToolsEditorPlugin::_zip_recursive(String p_path, String p_base_path, zip
155153
cur = dir->get_next();
156154
}
157155
}
158-
159-
#endif // TOOLS_ENABLED && WEB_ENABLED

platform/web/api/web_tools_editor_plugin.h renamed to platform/web/editor/web_tools_editor_plugin.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
#ifndef WEB_TOOLS_EDITOR_PLUGIN_H
3232
#define WEB_TOOLS_EDITOR_PLUGIN_H
3333

34-
#if defined(TOOLS_ENABLED) && defined(WEB_ENABLED)
35-
3634
#include "core/io/zip_io.h"
3735
#include "editor/plugins/editor_plugin.h"
3836

@@ -57,6 +55,4 @@ class WebToolsEditorPlugin {
5755
static void initialize() {}
5856
};
5957

60-
#endif // TOOLS_ENABLED && WEB_ENABLED
61-
6258
#endif // WEB_TOOLS_EDITOR_PLUGIN_H

platform/web/web_main.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
#include "scene/main/scene_tree.h"
3939
#include "scene/main/window.h" // SceneTree only forward declares it.
4040

41+
#ifdef TOOLS_ENABLED
42+
#include "editor/web_tools_editor_plugin.h"
43+
#endif
44+
4145
#include <emscripten/emscripten.h>
4246
#include <stdlib.h>
4347

@@ -104,6 +108,10 @@ void main_loop_callback() {
104108
extern EMSCRIPTEN_KEEPALIVE int godot_web_main(int argc, char *argv[]) {
105109
os = new OS_Web();
106110

111+
#ifdef TOOLS_ENABLED
112+
WebToolsEditorPlugin::initialize();
113+
#endif
114+
107115
// We must override main when testing is enabled
108116
TEST_MAIN_OVERRIDE
109117

0 commit comments

Comments
 (0)