summaryrefslogtreecommitdiffstats
path: root/editor/rename_dialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/rename_dialog.cpp')
-rw-r--r--editor/rename_dialog.cpp47
1 files changed, 24 insertions, 23 deletions
diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp
index e63b90c0ac..edefaa61a8 100644
--- a/editor/rename_dialog.cpp
+++ b/editor/rename_dialog.cpp
@@ -145,7 +145,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor) {
but_insert_name->set_text("NAME");
but_insert_name->set_tooltip_text(String("${NAME}\n") + TTR("Node name."));
but_insert_name->set_focus_mode(Control::FOCUS_NONE);
- but_insert_name->connect("pressed", callable_mp(this, &RenameDialog::_insert_text).bind("${NAME}"));
+ but_insert_name->connect(SceneStringName(pressed), callable_mp(this, &RenameDialog::_insert_text).bind("${NAME}"));
but_insert_name->set_h_size_flags(Control::SIZE_EXPAND_FILL);
grd_substitute->add_child(but_insert_name);
@@ -155,7 +155,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor) {
but_insert_parent->set_text("PARENT");
but_insert_parent->set_tooltip_text(String("${PARENT}\n") + TTR("Node's parent name, if available."));
but_insert_parent->set_focus_mode(Control::FOCUS_NONE);
- but_insert_parent->connect("pressed", callable_mp(this, &RenameDialog::_insert_text).bind("${PARENT}"));
+ but_insert_parent->connect(SceneStringName(pressed), callable_mp(this, &RenameDialog::_insert_text).bind("${PARENT}"));
but_insert_parent->set_h_size_flags(Control::SIZE_EXPAND_FILL);
grd_substitute->add_child(but_insert_parent);
@@ -165,7 +165,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor) {
but_insert_type->set_text("TYPE");
but_insert_type->set_tooltip_text(String("${TYPE}\n") + TTR("Node type."));
but_insert_type->set_focus_mode(Control::FOCUS_NONE);
- but_insert_type->connect("pressed", callable_mp(this, &RenameDialog::_insert_text).bind("${TYPE}"));
+ but_insert_type->connect(SceneStringName(pressed), callable_mp(this, &RenameDialog::_insert_text).bind("${TYPE}"));
but_insert_type->set_h_size_flags(Control::SIZE_EXPAND_FILL);
grd_substitute->add_child(but_insert_type);
@@ -175,7 +175,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor) {
but_insert_scene->set_text("SCENE");
but_insert_scene->set_tooltip_text(String("${SCENE}\n") + TTR("Current scene name."));
but_insert_scene->set_focus_mode(Control::FOCUS_NONE);
- but_insert_scene->connect("pressed", callable_mp(this, &RenameDialog::_insert_text).bind("${SCENE}"));
+ but_insert_scene->connect(SceneStringName(pressed), callable_mp(this, &RenameDialog::_insert_text).bind("${SCENE}"));
but_insert_scene->set_h_size_flags(Control::SIZE_EXPAND_FILL);
grd_substitute->add_child(but_insert_scene);
@@ -185,7 +185,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor) {
but_insert_root->set_text("ROOT");
but_insert_root->set_tooltip_text(String("${ROOT}\n") + TTR("Root node name."));
but_insert_root->set_focus_mode(Control::FOCUS_NONE);
- but_insert_root->connect("pressed", callable_mp(this, &RenameDialog::_insert_text).bind("${ROOT}"));
+ but_insert_root->connect(SceneStringName(pressed), callable_mp(this, &RenameDialog::_insert_text).bind("${ROOT}"));
but_insert_root->set_h_size_flags(Control::SIZE_EXPAND_FILL);
grd_substitute->add_child(but_insert_root);
@@ -195,7 +195,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor) {
but_insert_count->set_text("COUNTER");
but_insert_count->set_tooltip_text(String("${COUNTER}\n") + TTR("Sequential integer counter.\nCompare counter options."));
but_insert_count->set_focus_mode(Control::FOCUS_NONE);
- but_insert_count->connect("pressed", callable_mp(this, &RenameDialog::_insert_text).bind("${COUNTER}"));
+ but_insert_count->connect(SceneStringName(pressed), callable_mp(this, &RenameDialog::_insert_text).bind("${COUNTER}"));
but_insert_count->set_h_size_flags(Control::SIZE_EXPAND_FILL);
grd_substitute->add_child(but_insert_count);
@@ -289,6 +289,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor) {
vbc->add_child(lbl_preview_title);
lbl_preview = memnew(Label);
+ lbl_preview->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
lbl_preview->set_autowrap_mode(TextServer::AUTOWRAP_WORD_SMART);
vbc->add_child(lbl_preview);
@@ -307,14 +308,14 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor) {
// Substitute Buttons
- lne_search->connect("focus_entered", callable_mp(this, &RenameDialog::_update_substitute));
- lne_search->connect("focus_exited", callable_mp(this, &RenameDialog::_update_substitute));
- lne_replace->connect("focus_entered", callable_mp(this, &RenameDialog::_update_substitute));
- lne_replace->connect("focus_exited", callable_mp(this, &RenameDialog::_update_substitute));
- lne_prefix->connect("focus_entered", callable_mp(this, &RenameDialog::_update_substitute));
- lne_prefix->connect("focus_exited", callable_mp(this, &RenameDialog::_update_substitute));
- lne_suffix->connect("focus_entered", callable_mp(this, &RenameDialog::_update_substitute));
- lne_suffix->connect("focus_exited", callable_mp(this, &RenameDialog::_update_substitute));
+ lne_search->connect(SceneStringName(focus_entered), callable_mp(this, &RenameDialog::_update_substitute));
+ lne_search->connect(SceneStringName(focus_exited), callable_mp(this, &RenameDialog::_update_substitute));
+ lne_replace->connect(SceneStringName(focus_entered), callable_mp(this, &RenameDialog::_update_substitute));
+ lne_replace->connect(SceneStringName(focus_exited), callable_mp(this, &RenameDialog::_update_substitute));
+ lne_prefix->connect(SceneStringName(focus_entered), callable_mp(this, &RenameDialog::_update_substitute));
+ lne_prefix->connect(SceneStringName(focus_exited), callable_mp(this, &RenameDialog::_update_substitute));
+ lne_suffix->connect(SceneStringName(focus_entered), callable_mp(this, &RenameDialog::_update_substitute));
+ lne_suffix->connect(SceneStringName(focus_exited), callable_mp(this, &RenameDialog::_update_substitute));
// Preview
@@ -327,11 +328,11 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor) {
spn_count_padding->connect("value_changed", callable_mp(this, &RenameDialog::_update_preview_int));
opt_style->connect("item_selected", callable_mp(this, &RenameDialog::_update_preview_int));
opt_case->connect("item_selected", callable_mp(this, &RenameDialog::_update_preview_int));
- cbut_substitute->connect("pressed", callable_mp(this, &RenameDialog::_update_preview).bind(""));
- cbut_regex->connect("pressed", callable_mp(this, &RenameDialog::_update_preview).bind(""));
- cbut_process->connect("pressed", callable_mp(this, &RenameDialog::_update_preview).bind(""));
+ cbut_substitute->connect(SceneStringName(pressed), callable_mp(this, &RenameDialog::_update_preview).bind(""));
+ cbut_regex->connect(SceneStringName(pressed), callable_mp(this, &RenameDialog::_update_preview).bind(""));
+ cbut_process->connect(SceneStringName(pressed), callable_mp(this, &RenameDialog::_update_preview).bind(""));
- but_reset->connect("pressed", callable_mp(this, &RenameDialog::reset));
+ but_reset->connect(SceneStringName(pressed), callable_mp(this, &RenameDialog::reset));
reset();
_features_toggled(false);
@@ -473,7 +474,7 @@ void RenameDialog::_error_handler(void *p_self, const char *p_func, const char *
String source_file = String::utf8(p_file);
// Only show first error that is related to "regex"
- if (self->has_errors || source_file.find("regex") < 0) {
+ if (self->has_errors || !source_file.contains("regex")) {
return;
}
@@ -591,12 +592,12 @@ void RenameDialog::rename() {
undo_redo->create_action(TTR("Batch Rename"), UndoRedo::MERGE_DISABLE, root_node, true);
// Make sure to iterate reversed so that child nodes will find parents.
- for (int i = to_rename.size() - 1; i >= 0; --i) {
- Node *n = root_node->get_node(to_rename[i].first);
- const String &new_name = to_rename[i].second;
+ for (List<Pair<NodePath, String>>::Element *E = to_rename.back(); E; E = E->prev()) {
+ Node *n = root_node->get_node(E->get().first);
+ const String &new_name = E->get().second;
if (!n) {
- ERR_PRINT("Skipping missing node: " + to_rename[i].first.get_concatenated_subnames());
+ ERR_PRINT("Skipping missing node: " + E->get().first.get_concatenated_subnames());
continue;
}
scene_tree_editor->rename_node(n, new_name);