Skip to content

Commit 0fee272

Browse files
committed
Merge pull request #100751 from YYF233333/force_regex_with_editor
Force build editor with regex module, remove checking code
2 parents 9788b3d + 34d8255 commit 0fee272

33 files changed

+52
-168
lines changed

SConstruct

+1-1
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ methods.sort_module_list(env)
961961

962962
if env.editor_build:
963963
# Add editor-specific dependencies to the dependency graph.
964-
env.module_add_dependencies("editor", ["freetype", "svg"])
964+
env.module_add_dependencies("editor", ["freetype", "regex", "svg"])
965965

966966
# And check if they are met.
967967
if not env.module_check_dependencies("editor"):

core/io/logger.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@
3535
#include "core/os/time.h"
3636

3737
#include "modules/modules_enabled.gen.h" // For regex.
38+
#ifdef MODULE_REGEX_ENABLED
39+
#include "modules/regex/regex.h"
40+
#else
41+
class RegEx : public RefCounted {};
42+
#endif // MODULE_REGEX_ENABLED
3843

3944
#if defined(MINGW_ENABLED) || defined(_MSC_VER)
4045
#define sprintf sprintf_s

core/io/logger.h

+2-6
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,11 @@
3434
#include "core/io/file_access.h"
3535
#include "core/string/ustring.h"
3636
#include "core/templates/vector.h"
37-
#include "modules/modules_enabled.gen.h" // For regex.
38-
#ifdef MODULE_REGEX_ENABLED
39-
#include "modules/regex/regex.h"
40-
#endif // MODULE_REGEX_ENABLED
4137

4238
#include <stdarg.h>
4339

40+
class RegEx;
41+
4442
class Logger {
4543
protected:
4644
bool should_log(bool p_err);
@@ -90,9 +88,7 @@ class RotatedFileLogger : public Logger {
9088
void clear_old_backups();
9189
void rotate_file();
9290

93-
#ifdef MODULE_REGEX_ENABLED
9491
Ref<RegEx> strip_ansi_regex;
95-
#endif // MODULE_REGEX_ENABLED
9692

9793
public:
9894
explicit RotatedFileLogger(const String &p_base_path, int p_max_files = 10);

editor/editor_node.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,10 @@
164164
#include "editor/themes/editor_theme_manager.h"
165165
#include "editor/window_wrapper.h"
166166

167-
#include <stdlib.h>
168-
169167
#include "modules/modules_enabled.gen.h" // For gdscript, mono.
170168

169+
#include <stdlib.h>
170+
171171
EditorNode *EditorNode::singleton = nullptr;
172172

173173
static const String EDITOR_NODE_CONFIG_SECTION = "EditorNode";

editor/export/codesign.cpp

+3-10
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,15 @@
3232

3333
#include "core/crypto/crypto_core.h"
3434
#include "core/io/dir_access.h"
35-
#include "lipo.h"
36-
#include "macho.h"
37-
3835
#include "core/io/plist.h"
3936
#include "editor/editor_paths.h"
37+
#include "lipo.h"
38+
#include "macho.h"
4039

41-
#include "modules/modules_enabled.gen.h" // For regex.
40+
#include "modules/regex/regex.h"
4241

4342
#include <ctime>
4443

45-
#ifdef MODULE_REGEX_ENABLED
46-
47-
#include "modules/regex/regex.h"
48-
4944
/*************************************************************************/
5045
/* CodeSignCodeResources */
5146
/*************************************************************************/
@@ -1571,5 +1566,3 @@ Error CodeSign::codesign(bool p_use_hardened_runtime, bool p_force, const String
15711566
ERR_FAIL_V_MSG(FAILED, "CodeSign: Unknown object type.");
15721567
}
15731568
}
1574-
1575-
#endif // MODULE_REGEX_ENABLED

editor/export/codesign.h

-6
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@
4444
#include "core/io/file_access.h"
4545
#include "core/object/ref_counted.h"
4646

47-
#include "modules/modules_enabled.gen.h" // For regex.
48-
49-
#ifdef MODULE_REGEX_ENABLED
50-
5147
/*************************************************************************/
5248
/* CodeSignCodeResources */
5349
/*************************************************************************/
@@ -356,6 +352,4 @@ class CodeSign {
356352
static Error codesign(bool p_use_hardened_runtime, bool p_force, const String &p_path, const String &p_ent_path, String &r_error_msg);
357353
};
358354

359-
#endif // MODULE_REGEX_ENABLED
360-
361355
#endif // CODESIGN_H

editor/import/resource_importer_dynamic_font.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636
#include "scene/resources/font.h"
3737
#include "servers/text_server.h"
3838

39-
#include "modules/modules_enabled.gen.h" // For freetype.
40-
4139
String ResourceImporterDynamicFont::get_importer_name() const {
4240
return "font_data_dynamic";
4341
}
@@ -48,7 +46,6 @@ String ResourceImporterDynamicFont::get_visible_name() const {
4846

4947
void ResourceImporterDynamicFont::get_recognized_extensions(List<String> *p_extensions) const {
5048
if (p_extensions) {
51-
#ifdef MODULE_FREETYPE_ENABLED
5249
p_extensions->push_back("ttf");
5350
p_extensions->push_back("ttc");
5451
p_extensions->push_back("otf");
@@ -57,7 +54,6 @@ void ResourceImporterDynamicFont::get_recognized_extensions(List<String> *p_exte
5754
p_extensions->push_back("woff2");
5855
p_extensions->push_back("pfb");
5956
p_extensions->push_back("pfm");
60-
#endif
6157
}
6258
}
6359

editor/plugins/bone_map_editor_plugin.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
#include "scene/gui/separator.h"
4242
#include "scene/gui/texture_rect.h"
4343

44+
#include "modules/regex/regex.h"
45+
4446
void BoneMapperButton::fetch_textures() {
4547
if (selected) {
4648
set_texture_normal(get_editor_theme_icon(SNAME("BoneMapperHandleSelected")));
@@ -531,7 +533,6 @@ void BoneMapper::_clear_mapping_current_group() {
531533
}
532534
}
533535

534-
#ifdef MODULE_REGEX_ENABLED
535536
bool BoneMapper::is_match_with_bone_name(const String &p_bone_name, const String &p_word) {
536537
RegEx re = RegEx(p_word);
537538
return re.search(p_bone_name.to_lower()).is_valid();
@@ -1352,7 +1353,6 @@ void BoneMapper::auto_mapping_process(Ref<BoneMap> &p_bone_map) {
13521353

13531354
WARN_PRINT("Finish auto mapping.");
13541355
}
1355-
#endif // MODULE_REGEX_ENABLED
13561356

13571357
void BoneMapper::_value_changed(const String &p_property, const Variant &p_value, const String &p_name, bool p_changing) {
13581358
set(p_property, p_value);
@@ -1367,9 +1367,7 @@ void BoneMapper::_profile_changed(const String &p_property, const Variant &p_val
13671367
if (profile.is_valid()) {
13681368
SkeletonProfileHumanoid *hmn = Object::cast_to<SkeletonProfileHumanoid>(profile.ptr());
13691369
if (hmn) {
1370-
#ifdef MODULE_REGEX_ENABLED
13711370
_run_auto_mapping();
1372-
#endif // MODULE_REGEX_ENABLED
13731371
}
13741372
}
13751373
}

editor/plugins/bone_map_editor_plugin.h

-7
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@
3535
#include "editor/editor_properties.h"
3636
#include "editor/plugins/editor_plugin.h"
3737

38-
#include "modules/modules_enabled.gen.h" // For regex.
39-
#ifdef MODULE_REGEX_ENABLED
40-
#include "modules/regex/regex.h"
41-
#endif
42-
4338
#include "scene/3d/skeleton_3d.h"
4439
#include "scene/gui/box_container.h"
4540
#include "scene/gui/color_rect.h"
@@ -170,7 +165,6 @@ class BoneMapper : public VBoxContainer {
170165
void _apply_picker_selection();
171166
void _clear_mapping_current_group();
172167

173-
#ifdef MODULE_REGEX_ENABLED
174168
/* For auto mapping */
175169
enum BoneSegregation {
176170
BONE_SEGREGATION_NONE,
@@ -182,7 +176,6 @@ class BoneMapper : public VBoxContainer {
182176
BoneSegregation guess_bone_segregation(const String &p_bone_name);
183177
void auto_mapping_process(Ref<BoneMap> &p_bone_map);
184178
void _run_auto_mapping();
185-
#endif // MODULE_REGEX_ENABLED
186179

187180
protected:
188181
void _notification(int p_what);

editor/project_converter_3_to_4.cpp

+1-6
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,14 @@
3232

3333
#ifndef DISABLE_DEPRECATED
3434

35-
#include "modules/modules_enabled.gen.h" // For regex.
36-
37-
#ifdef MODULE_REGEX_ENABLED
38-
3935
#include "core/error/error_macros.h"
4036
#include "core/io/dir_access.h"
4137
#include "core/io/file_access.h"
4238
#include "core/object/ref_counted.h"
4339
#include "core/os/time.h"
4440
#include "core/templates/list.h"
4541
#include "editor/renames_map_3_to_4.h"
42+
4643
#include "modules/regex/regex.h"
4744

4845
// Find "OS.set_property(x)", capturing x into $1.
@@ -2957,6 +2954,4 @@ String ProjectConverter3To4::collect_string_from_vector(Vector<SourceLine> &vect
29572954
return string;
29582955
}
29592956

2960-
#endif // MODULE_REGEX_ENABLED
2961-
29622957
#endif // DISABLE_DEPRECATED

editor/project_converter_3_to_4.h

-23
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,6 @@
3333

3434
#ifndef DISABLE_DEPRECATED
3535

36-
#include "modules/modules_enabled.gen.h" // For regex.
37-
38-
#ifndef MODULE_REGEX_ENABLED
39-
40-
#include "core/error/error_macros.h"
41-
42-
class ProjectConverter3To4 {
43-
public:
44-
ProjectConverter3To4(int, int) {}
45-
46-
bool validate_conversion() {
47-
ERR_FAIL_V_MSG(false, "Can't validate conversion for Godot 3.x projects, because RegEx module is disabled.");
48-
}
49-
50-
bool convert() {
51-
ERR_FAIL_V_MSG(false, "Can't run converter for Godot 3.x projects, because RegEx module is disabled.");
52-
}
53-
};
54-
55-
#else // Has regex.
56-
5736
#include "core/string/ustring.h"
5837
#include "core/templates/local_vector.h"
5938
#include "core/templates/vector.h"
@@ -134,8 +113,6 @@ class ProjectConverter3To4 {
134113
bool convert();
135114
};
136115

137-
#endif // MODULE_REGEX_ENABLED
138-
139116
#endif // DISABLE_DEPRECATED
140117

141118
#endif // PROJECT_CONVERTER_3_TO_4_H

editor/rename_dialog.cpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,10 @@
3030

3131
#include "rename_dialog.h"
3232

33-
#include "modules/modules_enabled.gen.h" // For regex.
34-
#ifdef MODULE_REGEX_ENABLED
35-
3633
#include "editor/editor_node.h"
3734
#include "editor/editor_string_names.h"
3835
#include "editor/editor_undo_redo_manager.h"
3936
#include "editor/plugins/script_editor_plugin.h"
40-
#include "modules/regex/regex.h"
4137
#include "scene/gui/check_box.h"
4238
#include "scene/gui/check_button.h"
4339
#include "scene/gui/control.h"
@@ -48,6 +44,8 @@
4844
#include "scene/gui/spin_box.h"
4945
#include "scene/gui/tab_container.h"
5046

47+
#include "modules/regex/regex.h"
48+
5149
RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor) {
5250
scene_tree_editor = p_scene_tree_editor;
5351
preview_node = nullptr;
@@ -656,5 +654,3 @@ void RenameDialog::_features_toggled(bool pressed) {
656654
new_size.y = 0;
657655
set_size(new_size);
658656
}
659-
660-
#endif // MODULE_REGEX_ENABLED

editor/rename_dialog.h

-5
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@
3131
#ifndef RENAME_DIALOG_H
3232
#define RENAME_DIALOG_H
3333

34-
#include "modules/modules_enabled.gen.h" // For regex.
35-
#ifdef MODULE_REGEX_ENABLED
36-
3734
#include "editor/gui/scene_tree_editor.h"
3835
#include "scene/gui/dialogs.h"
3936
#include "scene/gui/line_edit.h"
@@ -114,6 +111,4 @@ class RenameDialog : public ConfirmationDialog {
114111
RenameDialog(SceneTreeEditor *p_scene_tree_editor);
115112
};
116113

117-
#endif // MODULE_REGEX_ENABLED
118-
119114
#endif // RENAME_DIALOG_H

editor/scene_tree_dock.cpp

+1-13
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
#include "editor/plugins/editor_context_menu_plugin.h"
5656
#include "editor/plugins/node_3d_editor_plugin.h"
5757
#include "editor/plugins/script_editor_plugin.h"
58+
#include "editor/rename_dialog.h"
5859
#include "editor/reparent_dialog.h"
5960
#include "editor/shader_create_dialog.h"
6061
#include "editor/themes/editor_scale.h"
@@ -66,11 +67,6 @@
6667
#include "scene/resources/packed_scene.h"
6768
#include "servers/display_server.h"
6869

69-
#include "modules/modules_enabled.gen.h" // For regex.
70-
#ifdef MODULE_REGEX_ENABLED
71-
#include "editor/rename_dialog.h"
72-
#endif // MODULE_REGEX_ENABLED
73-
7470
void SceneTreeDock::_nodes_drag_begin() {
7571
pending_click_select = nullptr;
7672
}
@@ -178,10 +174,8 @@ void SceneTreeDock::shortcut_input(const Ref<InputEvent> &p_event) {
178174
return;
179175
}
180176
_tool_selected(TOOL_RENAME);
181-
#ifdef MODULE_REGEX_ENABLED
182177
} else if (ED_IS_SHORTCUT("scene_tree/batch_rename", p_event)) {
183178
_tool_selected(TOOL_BATCH_RENAME);
184-
#endif // MODULE_REGEX_ENABLED
185179
} else if (ED_IS_SHORTCUT("scene_tree/add_child_node", p_event)) {
186180
_tool_selected(TOOL_NEW);
187181
} else if (ED_IS_SHORTCUT("scene_tree/instantiate_scene", p_event)) {
@@ -551,7 +545,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
551545
current_option = p_tool;
552546

553547
switch (p_tool) {
554-
#ifdef MODULE_REGEX_ENABLED
555548
case TOOL_BATCH_RENAME: {
556549
if (!profile_allow_editing) {
557550
break;
@@ -563,7 +556,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
563556
rename_dialog->popup_centered();
564557
}
565558
} break;
566-
#endif // MODULE_REGEX_ENABLED
567559
case TOOL_RENAME: {
568560
if (!profile_allow_editing) {
569561
break;
@@ -3925,13 +3917,11 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
39253917
}
39263918
}
39273919

3928-
#ifdef MODULE_REGEX_ENABLED
39293920
if (profile_allow_editing && selection.size() > 1) {
39303921
//this is not a commonly used action, it makes no sense for it to be where it was nor always present.
39313922
menu->add_separator();
39323923
menu->add_icon_shortcut(get_editor_theme_icon(SNAME("Rename")), ED_GET_SHORTCUT("scene_tree/batch_rename"), TOOL_BATCH_RENAME);
39333924
}
3934-
#endif // MODULE_REGEX_ENABLED
39353925
menu->add_separator();
39363926

39373927
if (full_selection.size() == 1 && !selection.front()->get()->get_scene_file_path().is_empty()) {
@@ -4795,10 +4785,8 @@ SceneTreeDock::SceneTreeDock(Node *p_scene_root, EditorSelection *p_editor_selec
47954785
create_dialog->connect("create", callable_mp(this, &SceneTreeDock::_create));
47964786
create_dialog->connect("favorites_updated", callable_mp(this, &SceneTreeDock::_update_create_root_dialog).bind(false));
47974787

4798-
#ifdef MODULE_REGEX_ENABLED
47994788
rename_dialog = memnew(RenameDialog(scene_tree));
48004789
add_child(rename_dialog);
4801-
#endif // MODULE_REGEX_ENABLED
48024790

48034791
script_create_dialog = memnew(ScriptCreateDialog);
48044792
script_create_dialog->set_inheritance_base_type("Node");

0 commit comments

Comments
 (0)