Allow disabling the RegEx module in the editor
This commit is contained in:
parent
520462e98c
commit
4fc639916c
|
@ -683,7 +683,7 @@ if selected_platform in platform_list:
|
||||||
if env["minizip"]:
|
if env["minizip"]:
|
||||||
env.Append(CPPDEFINES=["MINIZIP_ENABLED"])
|
env.Append(CPPDEFINES=["MINIZIP_ENABLED"])
|
||||||
|
|
||||||
editor_module_list = ["freetype", "regex"]
|
editor_module_list = ["freetype"]
|
||||||
if env["tools"] and not env.module_check_dependencies("tools", editor_module_list):
|
if env["tools"] and not env.module_check_dependencies("tools", editor_module_list):
|
||||||
print(
|
print(
|
||||||
"Build option 'module_"
|
"Build option 'module_"
|
||||||
|
|
|
@ -30,23 +30,19 @@
|
||||||
|
|
||||||
#include "rename_dialog.h"
|
#include "rename_dialog.h"
|
||||||
|
|
||||||
|
#ifdef MODULE_REGEX_ENABLED
|
||||||
|
|
||||||
#include "core/string/print_string.h"
|
#include "core/string/print_string.h"
|
||||||
#include "editor_node.h"
|
#include "editor_node.h"
|
||||||
#include "editor_scale.h"
|
#include "editor_scale.h"
|
||||||
#include "editor_settings.h"
|
#include "editor_settings.h"
|
||||||
#include "editor_themes.h"
|
#include "editor_themes.h"
|
||||||
|
#include "modules/regex/regex.h"
|
||||||
#include "plugins/script_editor_plugin.h"
|
#include "plugins/script_editor_plugin.h"
|
||||||
#include "scene/gui/control.h"
|
#include "scene/gui/control.h"
|
||||||
#include "scene/gui/label.h"
|
#include "scene/gui/label.h"
|
||||||
#include "scene/gui/tab_container.h"
|
#include "scene/gui/tab_container.h"
|
||||||
|
|
||||||
#include "modules/modules_enabled.gen.h"
|
|
||||||
#ifdef MODULE_REGEX_ENABLED
|
|
||||||
#include "modules/regex/regex.h"
|
|
||||||
#else
|
|
||||||
#error "Can't build editor rename dialog without RegEx module."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_undo_redo) {
|
RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_undo_redo) {
|
||||||
scene_tree_editor = p_scene_tree_editor;
|
scene_tree_editor = p_scene_tree_editor;
|
||||||
undo_redo = p_undo_redo;
|
undo_redo = p_undo_redo;
|
||||||
|
@ -655,3 +651,5 @@ void RenameDialog::_features_toggled(bool pressed) {
|
||||||
size.y = 0;
|
size.y = 0;
|
||||||
set_size(size);
|
set_size(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // MODULE_REGEX_ENABLED
|
||||||
|
|
|
@ -31,6 +31,9 @@
|
||||||
#ifndef RENAME_DIALOG_H
|
#ifndef RENAME_DIALOG_H
|
||||||
#define RENAME_DIALOG_H
|
#define RENAME_DIALOG_H
|
||||||
|
|
||||||
|
#include "modules/modules_enabled.gen.h"
|
||||||
|
#ifdef MODULE_REGEX_ENABLED
|
||||||
|
|
||||||
#include "scene/gui/check_box.h"
|
#include "scene/gui/check_box.h"
|
||||||
#include "scene/gui/dialogs.h"
|
#include "scene/gui/dialogs.h"
|
||||||
#include "scene/gui/option_button.h"
|
#include "scene/gui/option_button.h"
|
||||||
|
@ -113,4 +116,6 @@ public:
|
||||||
~RenameDialog() {}
|
~RenameDialog() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // MODULE_REGEX_ENABLED
|
||||||
|
|
||||||
|
#endif // RENAME_DIALOG_H
|
||||||
|
|
|
@ -83,10 +83,12 @@ void SceneTreeDock::unhandled_key_input(const Ref<InputEvent> &p_event) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ED_IS_SHORTCUT("scene_tree/batch_rename", p_event)) {
|
if (ED_IS_SHORTCUT("scene_tree/rename", p_event)) {
|
||||||
_tool_selected(TOOL_BATCH_RENAME);
|
|
||||||
} else if (ED_IS_SHORTCUT("scene_tree/rename", p_event)) {
|
|
||||||
_tool_selected(TOOL_RENAME);
|
_tool_selected(TOOL_RENAME);
|
||||||
|
#ifdef MODULE_REGEX_ENABLED
|
||||||
|
} else if (ED_IS_SHORTCUT("scene_tree/batch_rename", p_event)) {
|
||||||
|
_tool_selected(TOOL_BATCH_RENAME);
|
||||||
|
#endif // MODULE_REGEX_ENABLED
|
||||||
} else if (ED_IS_SHORTCUT("scene_tree/add_child_node", p_event)) {
|
} else if (ED_IS_SHORTCUT("scene_tree/add_child_node", p_event)) {
|
||||||
_tool_selected(TOOL_NEW);
|
_tool_selected(TOOL_NEW);
|
||||||
} else if (ED_IS_SHORTCUT("scene_tree/instance_scene", p_event)) {
|
} else if (ED_IS_SHORTCUT("scene_tree/instance_scene", p_event)) {
|
||||||
|
@ -336,6 +338,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||||
current_option = p_tool;
|
current_option = p_tool;
|
||||||
|
|
||||||
switch (p_tool) {
|
switch (p_tool) {
|
||||||
|
#ifdef MODULE_REGEX_ENABLED
|
||||||
case TOOL_BATCH_RENAME: {
|
case TOOL_BATCH_RENAME: {
|
||||||
if (!profile_allow_editing) {
|
if (!profile_allow_editing) {
|
||||||
break;
|
break;
|
||||||
|
@ -344,6 +347,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||||
rename_dialog->popup_centered();
|
rename_dialog->popup_centered();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
#endif // MODULE_REGEX_ENABLED
|
||||||
case TOOL_RENAME: {
|
case TOOL_RENAME: {
|
||||||
if (!profile_allow_editing) {
|
if (!profile_allow_editing) {
|
||||||
break;
|
break;
|
||||||
|
@ -2807,11 +2811,13 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MODULE_REGEX_ENABLED
|
||||||
if (profile_allow_editing && selection.size() > 1) {
|
if (profile_allow_editing && selection.size() > 1) {
|
||||||
//this is not a commonly used action, it makes no sense for it to be where it was nor always present.
|
//this is not a commonly used action, it makes no sense for it to be where it was nor always present.
|
||||||
menu->add_separator();
|
menu->add_separator();
|
||||||
menu->add_icon_shortcut(get_theme_icon(SNAME("Rename"), SNAME("EditorIcons")), ED_GET_SHORTCUT("scene_tree/batch_rename"), TOOL_BATCH_RENAME);
|
menu->add_icon_shortcut(get_theme_icon(SNAME("Rename"), SNAME("EditorIcons")), ED_GET_SHORTCUT("scene_tree/batch_rename"), TOOL_BATCH_RENAME);
|
||||||
}
|
}
|
||||||
|
#endif // MODULE_REGEX_ENABLED
|
||||||
menu->add_separator();
|
menu->add_separator();
|
||||||
menu->add_icon_item(get_theme_icon(SNAME("Help"), SNAME("EditorIcons")), TTR("Open Documentation"), TOOL_OPEN_DOCUMENTATION);
|
menu->add_icon_item(get_theme_icon(SNAME("Help"), SNAME("EditorIcons")), TTR("Open Documentation"), TOOL_OPEN_DOCUMENTATION);
|
||||||
|
|
||||||
|
@ -3321,8 +3327,10 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
|
||||||
create_dialog->connect("create", callable_mp(this, &SceneTreeDock::_create));
|
create_dialog->connect("create", callable_mp(this, &SceneTreeDock::_create));
|
||||||
create_dialog->connect("favorites_updated", callable_mp(this, &SceneTreeDock::_update_create_root_dialog));
|
create_dialog->connect("favorites_updated", callable_mp(this, &SceneTreeDock::_update_create_root_dialog));
|
||||||
|
|
||||||
|
#ifdef MODULE_REGEX_ENABLED
|
||||||
rename_dialog = memnew(RenameDialog(scene_tree, &editor_data->get_undo_redo()));
|
rename_dialog = memnew(RenameDialog(scene_tree, &editor_data->get_undo_redo()));
|
||||||
add_child(rename_dialog);
|
add_child(rename_dialog);
|
||||||
|
#endif // MODULE_REGEX_ENABLED
|
||||||
|
|
||||||
script_create_dialog = memnew(ScriptCreateDialog);
|
script_create_dialog = memnew(ScriptCreateDialog);
|
||||||
script_create_dialog->set_inheritance_base_type("Node");
|
script_create_dialog->set_inheritance_base_type("Node");
|
||||||
|
|
|
@ -62,7 +62,9 @@ class SceneTreeDock : public VBoxContainer {
|
||||||
TOOL_COPY,
|
TOOL_COPY,
|
||||||
TOOL_PASTE,
|
TOOL_PASTE,
|
||||||
TOOL_RENAME,
|
TOOL_RENAME,
|
||||||
|
#ifdef MODULE_REGEX_ENABLED
|
||||||
TOOL_BATCH_RENAME,
|
TOOL_BATCH_RENAME,
|
||||||
|
#endif // MODULE_REGEX_ENABLED
|
||||||
TOOL_REPLACE,
|
TOOL_REPLACE,
|
||||||
TOOL_EXTEND_SCRIPT,
|
TOOL_EXTEND_SCRIPT,
|
||||||
TOOL_ATTACH_SCRIPT,
|
TOOL_ATTACH_SCRIPT,
|
||||||
|
@ -105,7 +107,9 @@ class SceneTreeDock : public VBoxContainer {
|
||||||
|
|
||||||
int current_option;
|
int current_option;
|
||||||
CreateDialog *create_dialog;
|
CreateDialog *create_dialog;
|
||||||
|
#ifdef MODULE_REGEX_ENABLED
|
||||||
RenameDialog *rename_dialog;
|
RenameDialog *rename_dialog;
|
||||||
|
#endif // MODULE_REGEX_ENABLED
|
||||||
|
|
||||||
Button *button_add;
|
Button *button_add;
|
||||||
Button *button_instance;
|
Button *button_instance;
|
||||||
|
|
Loading…
Reference in New Issue