summaryrefslogtreecommitdiffstats
path: root/editor
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-09-19 17:13:50 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-09-19 17:13:50 +0200
commitd788205826d23f5afb0cd8fea17069784b68bc2e (patch)
tree6d843752865903287003d0df85fcf34539676b52 /editor
parent6a1ab24a34f85b2017e5b379bfb9b0dedfbc7417 (diff)
parent14321b8ed5e151987c0e2a0dd28d7a4e2483faba (diff)
downloadredot-engine-d788205826d23f5afb0cd8fea17069784b68bc2e.tar.gz
Merge pull request #97173 from timothyqiu/drag-preview-translation
Set auto translate mode for drag previews
Diffstat (limited to 'editor')
-rw-r--r--editor/action_map_editor.cpp1
-rw-r--r--editor/animation_track_editor.cpp1
-rw-r--r--editor/create_dialog.cpp1
-rw-r--r--editor/editor_audio_buses.cpp3
-rw-r--r--editor/editor_autoload_settings.cpp1
-rw-r--r--editor/editor_inspector.cpp1
-rw-r--r--editor/editor_node.cpp2
-rw-r--r--editor/editor_settings_dialog.cpp2
-rw-r--r--editor/export/project_export.cpp1
-rw-r--r--editor/gui/scene_tree_editor.cpp1
-rw-r--r--editor/plugins/script_editor_plugin.cpp1
-rw-r--r--editor/plugins/shader_editor_plugin.cpp1
-rw-r--r--editor/plugins/skeleton_3d_editor_plugin.cpp1
-rw-r--r--editor/plugins/visual_shader_editor_plugin.cpp2
14 files changed, 18 insertions, 1 deletions
diff --git a/editor/action_map_editor.cpp b/editor/action_map_editor.cpp
index 16423fb111..d648dab298 100644
--- a/editor/action_map_editor.cpp
+++ b/editor/action_map_editor.cpp
@@ -254,6 +254,7 @@ Variant ActionMapEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from
Label *label = memnew(Label(name));
label->set_theme_type_variation("HeaderSmall");
label->set_modulate(Color(1, 1, 1, 1.0f));
+ label->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
action_tree->set_drag_preview(label);
Dictionary drag_data;
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index 07b7c34a10..d277ba2f6d 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -3241,6 +3241,7 @@ Variant AnimationTrackEdit::get_drag_data(const Point2 &p_point) {
tb->set_flat(true);
tb->set_text(path_cache);
tb->set_icon(icon_cache);
+ tb->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
tb->add_theme_constant_override("icon_max_width", get_theme_constant("class_icon_size", EditorStringName(Editor)));
set_drag_preview(tb);
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index 42346a0c0b..330ac3b437 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -615,6 +615,7 @@ Variant CreateDialog::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
tb->set_flat(true);
tb->set_icon(ti->get_icon(0));
tb->set_text(ti->get_text(0));
+ tb->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
favorites->set_drag_preview(tb);
return d;
diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp
index de4e9240f6..24fc7a9c2b 100644
--- a/editor/editor_audio_buses.cpp
+++ b/editor/editor_audio_buses.cpp
@@ -657,6 +657,7 @@ Variant EditorAudioBus::get_drag_data_fw(const Point2 &p_point, Control *p_from)
Label *l = memnew(Label);
l->set_text(item->get_text(0));
+ l->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
effects->set_drag_preview(l);
return fxd;
@@ -929,6 +930,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
hb->add_child(scale);
effects = memnew(Tree);
+ effects->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
effects->set_hide_root(true);
effects->set_custom_minimum_size(Size2(0, 80) * EDSCALE);
effects->set_hide_folding(true);
@@ -954,6 +956,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
set_focus_mode(FOCUS_CLICK);
effect_options = memnew(PopupMenu);
+ effect_options->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); // Don't translate class names.
effect_options->connect("index_pressed", callable_mp(this, &EditorAudioBus::_effect_add));
add_child(effect_options);
List<StringName> effect_list;
diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp
index fb007aee28..0eabe53360 100644
--- a/editor/editor_autoload_settings.cpp
+++ b/editor/editor_autoload_settings.cpp
@@ -644,6 +644,7 @@ Variant EditorAutoloadSettings::get_drag_data_fw(const Point2 &p_point, Control
for (int i = 0; i < max_size; i++) {
Label *label = memnew(Label(autoloads[i]));
label->set_self_modulate(Color(1, 1, 1, Math::lerp(1, 0, float(i) / PREVIEW_LIST_MAX_SIZE)));
+ label->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
preview->add_child(label);
}
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp
index 4cd0761691..a215662f16 100644
--- a/editor/editor_inspector.cpp
+++ b/editor/editor_inspector.cpp
@@ -893,6 +893,7 @@ Variant EditorProperty::get_drag_data(const Point2 &p_point) {
Label *drag_label = memnew(Label);
drag_label->set_text(property);
+ drag_label->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); // Don't translate raw property name.
set_drag_preview(drag_label);
return dp;
}
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 0c21f3c2cd..081478fc1d 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -5663,6 +5663,7 @@ Dictionary EditorNode::drag_resource(const Ref<Resource> &p_res, Control *p_from
Control *drag_control = memnew(Control);
TextureRect *drag_preview = memnew(TextureRect);
Label *label = memnew(Label);
+ label->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
Ref<Texture2D> preview;
@@ -5715,6 +5716,7 @@ Dictionary EditorNode::drag_files_and_dirs(const Vector<String> &p_paths, Contro
HBoxContainer *hbox = memnew(HBoxContainer);
TextureRect *icon = memnew(TextureRect);
Label *label = memnew(Label);
+ label->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
if (p_paths[i].ends_with("/")) {
label->set_text(p_paths[i].substr(0, p_paths[i].length() - 1).get_file());
diff --git a/editor/editor_settings_dialog.cpp b/editor/editor_settings_dialog.cpp
index 81bc9c8fbe..b133847823 100644
--- a/editor/editor_settings_dialog.cpp
+++ b/editor/editor_settings_dialog.cpp
@@ -697,7 +697,7 @@ Variant EditorSettingsDialog::get_drag_data_fw(const Point2 &p_point, Control *p
return Variant();
}
- String label_text = "Event " + itos(selected->get_meta("event_index"));
+ String label_text = vformat(TTRC("Event %d"), selected->get_meta("event_index"));
Label *label = memnew(Label(label_text));
label->set_modulate(Color(1, 1, 1, 1.0f));
shortcuts->set_drag_preview(label);
diff --git a/editor/export/project_export.cpp b/editor/export/project_export.cpp
index 3ad8ab0b19..be9e0f78ec 100644
--- a/editor/export/project_export.cpp
+++ b/editor/export/project_export.cpp
@@ -713,6 +713,7 @@ Variant ProjectExportDialog::get_drag_data_fw(const Point2 &p_point, Control *p_
drag->add_child(tr);
Label *label = memnew(Label);
label->set_text(presets->get_item_text(pos));
+ label->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); // Don't translate user input.
drag->add_child(label);
presets->set_drag_preview(drag);
diff --git a/editor/gui/scene_tree_editor.cpp b/editor/gui/scene_tree_editor.cpp
index 6695abb70a..2e36b66025 100644
--- a/editor/gui/scene_tree_editor.cpp
+++ b/editor/gui/scene_tree_editor.cpp
@@ -1361,6 +1361,7 @@ Variant SceneTreeEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from
tf->set_texture(icons[i]);
hb->add_child(tf);
Label *label = memnew(Label(selected_nodes[i]->get_name()));
+ label->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
hb->add_child(label);
vb->add_child(hb);
hb->set_modulate(Color(1, 1, 1, opacity_item));
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index af401ee6a3..9579388d46 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -3101,6 +3101,7 @@ Variant ScriptEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
drag_preview->add_child(tf);
}
Label *label = memnew(Label(preview_name));
+ label->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); // Don't translate script names and class names.
drag_preview->add_child(label);
set_drag_preview(drag_preview);
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index 6bfe78c216..6b00a2c9c5 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -614,6 +614,7 @@ Variant ShaderEditorPlugin::get_drag_data_fw(const Point2 &p_point, Control *p_f
drag_preview->add_child(tf);
}
Label *label = memnew(Label(preview_name));
+ label->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); // Don't translate script names.
drag_preview->add_child(label);
main_split->set_drag_preview(drag_preview);
diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp
index 64b9522864..81beaf6f91 100644
--- a/editor/plugins/skeleton_3d_editor_plugin.cpp
+++ b/editor/plugins/skeleton_3d_editor_plugin.cpp
@@ -689,6 +689,7 @@ Variant Skeleton3DEditor::get_drag_data_fw(const Point2 &p_point, Control *p_fro
tf->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED);
hb->add_child(tf);
Label *label = memnew(Label(selected->get_text(0)));
+ label->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
hb->add_child(label);
vb->add_child(hb);
hb->set_modulate(Color(1, 1, 1, 1));
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp
index 412d58cf45..c378bf315b 100644
--- a/editor/plugins/visual_shader_editor_plugin.cpp
+++ b/editor/plugins/visual_shader_editor_plugin.cpp
@@ -5994,6 +5994,7 @@ Variant VisualShaderEditor::get_drag_data_fw(const Point2 &p_point, Control *p_f
Label *label = memnew(Label);
label->set_text(it->get_text(0));
+ label->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
set_drag_preview(label);
return d;
}
@@ -6560,6 +6561,7 @@ VisualShaderEditor::VisualShaderEditor() {
parameters->set_hide_folding(false);
parameters->set_h_size_flags(SIZE_EXPAND_FILL);
parameters->set_v_size_flags(SIZE_EXPAND_FILL);
+ parameters->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
parameters->connect(SceneStringName(item_selected), callable_mp(this, &VisualShaderEditor::_param_selected));
parameters->connect("nothing_selected", callable_mp(this, &VisualShaderEditor::_param_unselected));
sc->add_child(parameters);