Skip to content

Commit d788205

Browse files
committed
Merge pull request #97173 from timothyqiu/drag-preview-translation
Set auto translate mode for drag previews
2 parents 6a1ab24 + 14321b8 commit d788205

18 files changed

+22
-1
lines changed

editor/action_map_editor.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ Variant ActionMapEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from
254254
Label *label = memnew(Label(name));
255255
label->set_theme_type_variation("HeaderSmall");
256256
label->set_modulate(Color(1, 1, 1, 1.0f));
257+
label->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
257258
action_tree->set_drag_preview(label);
258259

259260
Dictionary drag_data;

editor/animation_track_editor.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3241,6 +3241,7 @@ Variant AnimationTrackEdit::get_drag_data(const Point2 &p_point) {
32413241
tb->set_flat(true);
32423242
tb->set_text(path_cache);
32433243
tb->set_icon(icon_cache);
3244+
tb->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
32443245
tb->add_theme_constant_override("icon_max_width", get_theme_constant("class_icon_size", EditorStringName(Editor)));
32453246
set_drag_preview(tb);
32463247

editor/create_dialog.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,7 @@ Variant CreateDialog::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
615615
tb->set_flat(true);
616616
tb->set_icon(ti->get_icon(0));
617617
tb->set_text(ti->get_text(0));
618+
tb->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
618619
favorites->set_drag_preview(tb);
619620

620621
return d;

editor/editor_audio_buses.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,7 @@ Variant EditorAudioBus::get_drag_data_fw(const Point2 &p_point, Control *p_from)
657657

658658
Label *l = memnew(Label);
659659
l->set_text(item->get_text(0));
660+
l->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
660661
effects->set_drag_preview(l);
661662

662663
return fxd;
@@ -929,6 +930,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
929930
hb->add_child(scale);
930931

931932
effects = memnew(Tree);
933+
effects->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
932934
effects->set_hide_root(true);
933935
effects->set_custom_minimum_size(Size2(0, 80) * EDSCALE);
934936
effects->set_hide_folding(true);
@@ -954,6 +956,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) {
954956
set_focus_mode(FOCUS_CLICK);
955957

956958
effect_options = memnew(PopupMenu);
959+
effect_options->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); // Don't translate class names.
957960
effect_options->connect("index_pressed", callable_mp(this, &EditorAudioBus::_effect_add));
958961
add_child(effect_options);
959962
List<StringName> effect_list;

editor/editor_autoload_settings.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,7 @@ Variant EditorAutoloadSettings::get_drag_data_fw(const Point2 &p_point, Control
644644
for (int i = 0; i < max_size; i++) {
645645
Label *label = memnew(Label(autoloads[i]));
646646
label->set_self_modulate(Color(1, 1, 1, Math::lerp(1, 0, float(i) / PREVIEW_LIST_MAX_SIZE)));
647+
label->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
647648

648649
preview->add_child(label);
649650
}

editor/editor_inspector.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,7 @@ Variant EditorProperty::get_drag_data(const Point2 &p_point) {
893893

894894
Label *drag_label = memnew(Label);
895895
drag_label->set_text(property);
896+
drag_label->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); // Don't translate raw property name.
896897
set_drag_preview(drag_label);
897898
return dp;
898899
}

editor/editor_node.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5663,6 +5663,7 @@ Dictionary EditorNode::drag_resource(const Ref<Resource> &p_res, Control *p_from
56635663
Control *drag_control = memnew(Control);
56645664
TextureRect *drag_preview = memnew(TextureRect);
56655665
Label *label = memnew(Label);
5666+
label->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
56665667

56675668
Ref<Texture2D> preview;
56685669

@@ -5715,6 +5716,7 @@ Dictionary EditorNode::drag_files_and_dirs(const Vector<String> &p_paths, Contro
57155716
HBoxContainer *hbox = memnew(HBoxContainer);
57165717
TextureRect *icon = memnew(TextureRect);
57175718
Label *label = memnew(Label);
5719+
label->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
57185720

57195721
if (p_paths[i].ends_with("/")) {
57205722
label->set_text(p_paths[i].substr(0, p_paths[i].length() - 1).get_file());

editor/editor_settings_dialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ Variant EditorSettingsDialog::get_drag_data_fw(const Point2 &p_point, Control *p
697697
return Variant();
698698
}
699699

700-
String label_text = "Event " + itos(selected->get_meta("event_index"));
700+
String label_text = vformat(TTRC("Event %d"), selected->get_meta("event_index"));
701701
Label *label = memnew(Label(label_text));
702702
label->set_modulate(Color(1, 1, 1, 1.0f));
703703
shortcuts->set_drag_preview(label);

editor/export/project_export.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,7 @@ Variant ProjectExportDialog::get_drag_data_fw(const Point2 &p_point, Control *p_
713713
drag->add_child(tr);
714714
Label *label = memnew(Label);
715715
label->set_text(presets->get_item_text(pos));
716+
label->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); // Don't translate user input.
716717
drag->add_child(label);
717718

718719
presets->set_drag_preview(drag);

editor/gui/scene_tree_editor.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,6 +1361,7 @@ Variant SceneTreeEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from
13611361
tf->set_texture(icons[i]);
13621362
hb->add_child(tf);
13631363
Label *label = memnew(Label(selected_nodes[i]->get_name()));
1364+
label->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
13641365
hb->add_child(label);
13651366
vb->add_child(hb);
13661367
hb->set_modulate(Color(1, 1, 1, opacity_item));

0 commit comments

Comments
 (0)