From c9b75431f313fae16e9f4c9e60d7f5eaed0aaec0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 28 Mar 2022 15:48:38 +0200 Subject: [PATCH] Refactor GDScript/C# script templates logic to be editor-only Not a full refactor as it still goes through ScriptLanguage so it's hacky, but at least it can now compile without this. --- modules/gdscript/SCsub | 5 +++-- .../CharacterBody2D/basic_movement.gd | 0 .../CharacterBody3D/basic_movement.gd | 0 .../script_templates}/EditorPlugin/plugin.gd | 0 .../EditorScript/basic_editor_script.gd | 0 .../script_templates}/Node/default.gd | 0 .../script_templates}/Object/empty.gd | 0 .../script_templates}/SCsub | 0 .../VisualShaderNodeCustom/basic.gd | 0 modules/gdscript/gdscript_editor.cpp | 19 +++++++------------ modules/mono/SCsub | 3 +-- modules/mono/csharp_script.cpp | 6 ++++-- .../CharacterBody2D/basic_movement.cs | 0 .../CharacterBody3D/basic_movement.cs | 0 .../script_templates}/EditorPlugin/plugin.cs | 0 .../EditorScript/basic_editor_script.cs | 0 .../script_templates}/Node/default.cs | 0 .../script_templates}/Object/empty.cs | 0 .../script_templates}/SCsub | 0 .../VisualShaderNodeCustom/basic.cs | 0 20 files changed, 15 insertions(+), 18 deletions(-) rename modules/gdscript/{editor_templates => editor/script_templates}/CharacterBody2D/basic_movement.gd (100%) rename modules/gdscript/{editor_templates => editor/script_templates}/CharacterBody3D/basic_movement.gd (100%) rename modules/gdscript/{editor_templates => editor/script_templates}/EditorPlugin/plugin.gd (100%) rename modules/gdscript/{editor_templates => editor/script_templates}/EditorScript/basic_editor_script.gd (100%) rename modules/gdscript/{editor_templates => editor/script_templates}/Node/default.gd (100%) rename modules/gdscript/{editor_templates => editor/script_templates}/Object/empty.gd (100%) rename modules/gdscript/{editor_templates => editor/script_templates}/SCsub (100%) rename modules/gdscript/{editor_templates => editor/script_templates}/VisualShaderNodeCustom/basic.gd (100%) rename modules/mono/{editor_templates => editor/script_templates}/CharacterBody2D/basic_movement.cs (100%) rename modules/mono/{editor_templates => editor/script_templates}/CharacterBody3D/basic_movement.cs (100%) rename modules/mono/{editor_templates => editor/script_templates}/EditorPlugin/plugin.cs (100%) rename modules/mono/{editor_templates => editor/script_templates}/EditorScript/basic_editor_script.cs (100%) rename modules/mono/{editor_templates => editor/script_templates}/Node/default.cs (100%) rename modules/mono/{editor_templates => editor/script_templates}/Object/empty.cs (100%) rename modules/mono/{editor_templates => editor/script_templates}/SCsub (100%) rename modules/mono/{editor_templates => editor/script_templates}/VisualShaderNodeCustom/basic.cs (100%) diff --git a/modules/gdscript/SCsub b/modules/gdscript/SCsub index c6121ec7fe8..2f507db5487 100644 --- a/modules/gdscript/SCsub +++ b/modules/gdscript/SCsub @@ -10,6 +10,8 @@ env_gdscript.add_source_files(env.modules_sources, "*.cpp") if env["tools"]: env_gdscript.add_source_files(env.modules_sources, "./editor/*.cpp") + SConscript("editor/script_templates/SCsub") + # Those two modules are required for the language server protocol if env["module_jsonrpc_enabled"] and env["module_websocket_enabled"]: env_gdscript.add_source_files(env.modules_sources, "./language_server/*.cpp") @@ -18,8 +20,7 @@ if env["tools"]: # in regular builds where all modules are enabled. env_gdscript.Append(CPPDEFINES=["GDSCRIPT_NO_LSP"]) + if env["tests"]: env_gdscript.Append(CPPDEFINES=["TESTS_ENABLED"]) env_gdscript.add_source_files(env.modules_sources, "./tests/*.cpp") - -SConscript("editor_templates/SCsub") diff --git a/modules/gdscript/editor_templates/CharacterBody2D/basic_movement.gd b/modules/gdscript/editor/script_templates/CharacterBody2D/basic_movement.gd similarity index 100% rename from modules/gdscript/editor_templates/CharacterBody2D/basic_movement.gd rename to modules/gdscript/editor/script_templates/CharacterBody2D/basic_movement.gd diff --git a/modules/gdscript/editor_templates/CharacterBody3D/basic_movement.gd b/modules/gdscript/editor/script_templates/CharacterBody3D/basic_movement.gd similarity index 100% rename from modules/gdscript/editor_templates/CharacterBody3D/basic_movement.gd rename to modules/gdscript/editor/script_templates/CharacterBody3D/basic_movement.gd diff --git a/modules/gdscript/editor_templates/EditorPlugin/plugin.gd b/modules/gdscript/editor/script_templates/EditorPlugin/plugin.gd similarity index 100% rename from modules/gdscript/editor_templates/EditorPlugin/plugin.gd rename to modules/gdscript/editor/script_templates/EditorPlugin/plugin.gd diff --git a/modules/gdscript/editor_templates/EditorScript/basic_editor_script.gd b/modules/gdscript/editor/script_templates/EditorScript/basic_editor_script.gd similarity index 100% rename from modules/gdscript/editor_templates/EditorScript/basic_editor_script.gd rename to modules/gdscript/editor/script_templates/EditorScript/basic_editor_script.gd diff --git a/modules/gdscript/editor_templates/Node/default.gd b/modules/gdscript/editor/script_templates/Node/default.gd similarity index 100% rename from modules/gdscript/editor_templates/Node/default.gd rename to modules/gdscript/editor/script_templates/Node/default.gd diff --git a/modules/gdscript/editor_templates/Object/empty.gd b/modules/gdscript/editor/script_templates/Object/empty.gd similarity index 100% rename from modules/gdscript/editor_templates/Object/empty.gd rename to modules/gdscript/editor/script_templates/Object/empty.gd diff --git a/modules/gdscript/editor_templates/SCsub b/modules/gdscript/editor/script_templates/SCsub similarity index 100% rename from modules/gdscript/editor_templates/SCsub rename to modules/gdscript/editor/script_templates/SCsub diff --git a/modules/gdscript/editor_templates/VisualShaderNodeCustom/basic.gd b/modules/gdscript/editor/script_templates/VisualShaderNodeCustom/basic.gd similarity index 100% rename from modules/gdscript/editor_templates/VisualShaderNodeCustom/basic.gd rename to modules/gdscript/editor/script_templates/VisualShaderNodeCustom/basic.gd diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 4a6e1eb4971..fd8fcea7b35 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -33,7 +33,6 @@ #include "core/config/engine.h" #include "core/core_constants.h" #include "core/io/file_access.h" -#include "editor_templates/templates.gen.h" #include "gdscript_analyzer.h" #include "gdscript_compiler.h" #include "gdscript_parser.h" @@ -44,6 +43,7 @@ #include "core/config/project_settings.h" #include "editor/editor_file_system.h" #include "editor/editor_settings.h" +#include "editor/script_templates/templates.gen.h" #endif void GDScriptLanguage::get_comment_delimiters(List *p_delimiters) const { @@ -64,8 +64,11 @@ Ref