Skip to content

Commit

Permalink
[Web] Fix Web Editor plugin being added to SCons multiple times
Browse files Browse the repository at this point in the history
Move the Web Editor plugin files to an editor sub-folder inside the
platform folder.
  • Loading branch information
Faless committed Nov 11, 2024
1 parent e65a237 commit 45493a1
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 3 additions & 1 deletion platform/web/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -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(
[
Expand Down
2 changes: 0 additions & 2 deletions platform/web/api/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -57,6 +55,4 @@ class WebToolsEditorPlugin {
static void initialize() {}
};

#endif // TOOLS_ENABLED && WEB_ENABLED

#endif // WEB_TOOLS_EDITOR_PLUGIN_H
8 changes: 8 additions & 0 deletions platform/web/web_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 45493a1

Please sign in to comment.