1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-04 17:04:49 +00:00

Improve auto-translation of Debugger

This commit is contained in:
kobewi
2025-07-09 23:21:30 +02:00
parent 68410acc61
commit 448a605cec
8 changed files with 171 additions and 121 deletions

View File

@@ -165,19 +165,19 @@ EditorExpressionEvaluator::EditorExpressionEvaluator() {
clear_on_run_checkbox = memnew(CheckBox); clear_on_run_checkbox = memnew(CheckBox);
clear_on_run_checkbox->set_h_size_flags(Control::SIZE_SHRINK_CENTER); clear_on_run_checkbox->set_h_size_flags(Control::SIZE_SHRINK_CENTER);
clear_on_run_checkbox->set_text(TTR("Clear on Run")); clear_on_run_checkbox->set_text(TTRC("Clear on Run"));
clear_on_run_checkbox->set_pressed(true); clear_on_run_checkbox->set_pressed(true);
hb->add_child(clear_on_run_checkbox); hb->add_child(clear_on_run_checkbox);
evaluate_btn = memnew(Button); evaluate_btn = memnew(Button);
evaluate_btn->set_h_size_flags(Control::SIZE_SHRINK_CENTER); evaluate_btn->set_h_size_flags(Control::SIZE_SHRINK_CENTER);
evaluate_btn->set_text(TTR("Evaluate")); evaluate_btn->set_text(TTRC("Evaluate"));
evaluate_btn->connect(SceneStringName(pressed), callable_mp(this, &EditorExpressionEvaluator::_evaluate)); evaluate_btn->connect(SceneStringName(pressed), callable_mp(this, &EditorExpressionEvaluator::_evaluate));
hb->add_child(evaluate_btn); hb->add_child(evaluate_btn);
clear_btn = memnew(Button); clear_btn = memnew(Button);
clear_btn->set_h_size_flags(Control::SIZE_SHRINK_CENTER); clear_btn->set_h_size_flags(Control::SIZE_SHRINK_CENTER);
clear_btn->set_text(TTR("Clear")); clear_btn->set_text(TTRC("Clear"));
clear_btn->connect(SceneStringName(pressed), callable_mp(this, &EditorExpressionEvaluator::_clear)); clear_btn->connect(SceneStringName(pressed), callable_mp(this, &EditorExpressionEvaluator::_clear));
hb->add_child(clear_btn); hb->add_child(clear_btn);

View File

@@ -242,6 +242,7 @@ TreeItem *EditorPerformanceProfiler::_get_monitor_base(const StringName &p_base_
TreeItem *base = monitor_tree->create_item(monitor_tree->get_root()); TreeItem *base = monitor_tree->create_item(monitor_tree->get_root());
base->set_text(0, EditorPropertyNameProcessor::get_singleton()->process_name(p_base_name, EditorPropertyNameProcessor::get_settings_style())); base->set_text(0, EditorPropertyNameProcessor::get_singleton()->process_name(p_base_name, EditorPropertyNameProcessor::get_settings_style()));
base->set_auto_translate_mode(0, AUTO_TRANSLATE_MODE_DISABLED);
base->set_editable(0, false); base->set_editable(0, false);
base->set_selectable(0, false); base->set_selectable(0, false);
base->set_expand_right(0, true); base->set_expand_right(0, true);
@@ -386,6 +387,15 @@ List<float> *EditorPerformanceProfiler::get_monitor_data(const StringName &p_nam
void EditorPerformanceProfiler::_notification(int p_what) { void EditorPerformanceProfiler::_notification(int p_what) {
switch (p_what) { switch (p_what) {
case NOTIFICATION_TRANSLATION_CHANGED: {
if (is_ready()) {
_build_monitor_tree();
if (monitor_draw->is_visible_in_tree()) {
monitor_draw->queue_redraw();
}
}
} break;
case NOTIFICATION_THEME_CHANGED: { case NOTIFICATION_THEME_CHANGED: {
for (KeyValue<StringName, TreeItem *> &E : base_map) { for (KeyValue<StringName, TreeItem *> &E : base_map) {
E.value->set_custom_font(0, get_theme_font(SNAME("bold"), EditorStringName(EditorFonts))); E.value->set_custom_font(0, get_theme_font(SNAME("bold"), EditorStringName(EditorFonts)));
@@ -401,16 +411,15 @@ void EditorPerformanceProfiler::_notification(int p_what) {
} }
EditorPerformanceProfiler::EditorPerformanceProfiler() { EditorPerformanceProfiler::EditorPerformanceProfiler() {
set_name(TTR("Monitors")); set_name(TTRC("Monitors"));
set_split_offset(340 * EDSCALE); set_split_offset(340 * EDSCALE);
monitor_tree = memnew(Tree); monitor_tree = memnew(Tree);
monitor_tree->set_custom_minimum_size(Size2(300, 0) * EDSCALE); monitor_tree->set_custom_minimum_size(Size2(300, 0) * EDSCALE);
monitor_tree->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
monitor_tree->set_columns(2); monitor_tree->set_columns(2);
monitor_tree->set_column_title(0, TTR("Monitor")); monitor_tree->set_column_title(0, TTRC("Monitor"));
monitor_tree->set_column_expand(0, true); monitor_tree->set_column_expand(0, true);
monitor_tree->set_column_title(1, TTR("Value")); monitor_tree->set_column_title(1, TTRC("Value"));
monitor_tree->set_column_custom_minimum_width(1, 100 * EDSCALE); monitor_tree->set_column_custom_minimum_width(1, 100 * EDSCALE);
monitor_tree->set_column_expand(1, false); monitor_tree->set_column_expand(1, false);
monitor_tree->set_column_titles_visible(true); monitor_tree->set_column_titles_visible(true);
@@ -429,7 +438,7 @@ EditorPerformanceProfiler::EditorPerformanceProfiler() {
info_message = memnew(Label); info_message = memnew(Label);
info_message->set_focus_mode(FOCUS_ACCESSIBILITY); info_message->set_focus_mode(FOCUS_ACCESSIBILITY);
info_message->set_text(TTR("Pick one or more items from the list to display the graph.")); info_message->set_text(TTRC("Pick one or more items from the list to display the graph."));
info_message->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER); info_message->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
info_message->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER); info_message->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
info_message->set_autowrap_mode(TextServer::AUTOWRAP_WORD_SMART); info_message->set_autowrap_mode(TextServer::AUTOWRAP_WORD_SMART);

View File

@@ -359,6 +359,7 @@ void EditorProfiler::_update_frame() {
category->set_editable(0, true); category->set_editable(0, true);
category->set_metadata(0, m.categories[i].signature); category->set_metadata(0, m.categories[i].signature);
category->set_text(0, String(m.categories[i].name)); category->set_text(0, String(m.categories[i].name));
category->set_auto_translate_mode(0, AUTO_TRANSLATE_MODE_DISABLED);
category->set_text(1, _get_time_as_text(m, m.categories[i].total_time, 1)); category->set_text(1, _get_time_as_text(m, m.categories[i].total_time, 1));
if (plot_sigs.has(m.categories[i].signature)) { if (plot_sigs.has(m.categories[i].signature)) {
@@ -376,6 +377,7 @@ void EditorProfiler::_update_frame() {
item->set_cell_mode(0, TreeItem::CELL_MODE_CHECK); item->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
item->set_editable(0, true); item->set_editable(0, true);
item->set_text(0, it.name); item->set_text(0, it.name);
item->set_auto_translate_mode(0, AUTO_TRANSLATE_MODE_DISABLED);
item->set_metadata(0, it.signature); item->set_metadata(0, it.signature);
item->set_metadata(1, it.script); item->set_metadata(1, it.script);
item->set_metadata(2, it.line); item->set_metadata(2, it.line);
@@ -404,10 +406,10 @@ void EditorProfiler::_update_frame() {
void EditorProfiler::_update_button_text() { void EditorProfiler::_update_button_text() {
if (activate->is_pressed()) { if (activate->is_pressed()) {
activate->set_button_icon(get_editor_theme_icon(SNAME("Stop"))); activate->set_button_icon(get_editor_theme_icon(SNAME("Stop")));
activate->set_text(TTR("Stop")); activate->set_text(TTRC("Stop"));
} else { } else {
activate->set_button_icon(get_editor_theme_icon(SNAME("Play"))); activate->set_button_icon(get_editor_theme_icon(SNAME("Play")));
activate->set_text(TTR("Start")); activate->set_text(TTRC("Start"));
} }
} }
@@ -438,9 +440,14 @@ void EditorProfiler::_autostart_toggled(bool p_toggled_on) {
void EditorProfiler::_notification(int p_what) { void EditorProfiler::_notification(int p_what) {
switch (p_what) { switch (p_what) {
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
case NOTIFICATION_THEME_CHANGED:
case NOTIFICATION_TRANSLATION_CHANGED: { case NOTIFICATION_TRANSLATION_CHANGED: {
if (is_ready()) {
_update_frame();
}
[[fallthrough]];
}
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
case NOTIFICATION_THEME_CHANGED: {
activate->set_button_icon(get_editor_theme_icon(SNAME("Play"))); activate->set_button_icon(get_editor_theme_icon(SNAME("Play")));
clear_button->set_button_icon(get_editor_theme_icon(SNAME("Clear"))); clear_button->set_button_icon(get_editor_theme_icon(SNAME("Clear")));
@@ -673,18 +680,18 @@ EditorProfiler::EditorProfiler() {
activate = memnew(Button); activate = memnew(Button);
activate->set_toggle_mode(true); activate->set_toggle_mode(true);
activate->set_disabled(true); activate->set_disabled(true);
activate->set_text(TTR("Start")); activate->set_text(TTRC("Start"));
activate->connect(SceneStringName(pressed), callable_mp(this, &EditorProfiler::_activate_pressed)); activate->connect(SceneStringName(pressed), callable_mp(this, &EditorProfiler::_activate_pressed));
container->add_child(activate); container->add_child(activate);
clear_button = memnew(Button); clear_button = memnew(Button);
clear_button->set_text(TTR("Clear")); clear_button->set_text(TTRC("Clear"));
clear_button->connect(SceneStringName(pressed), callable_mp(this, &EditorProfiler::_clear_pressed)); clear_button->connect(SceneStringName(pressed), callable_mp(this, &EditorProfiler::_clear_pressed));
clear_button->set_disabled(true); clear_button->set_disabled(true);
container->add_child(clear_button); container->add_child(clear_button);
CheckBox *autostart_checkbox = memnew(CheckBox); CheckBox *autostart_checkbox = memnew(CheckBox);
autostart_checkbox->set_text(TTR("Autostart")); autostart_checkbox->set_text(TTRC("Autostart"));
autostart_checkbox->set_pressed(EditorSettings::get_singleton()->get_project_metadata("debug_options", "autostart_profiler", false)); autostart_checkbox->set_pressed(EditorSettings::get_singleton()->get_project_metadata("debug_options", "autostart_profiler", false));
autostart_checkbox->connect(SceneStringName(toggled), callable_mp(this, &EditorProfiler::_autostart_toggled)); autostart_checkbox->connect(SceneStringName(toggled), callable_mp(this, &EditorProfiler::_autostart_toggled));
container->add_child(autostart_checkbox); container->add_child(autostart_checkbox);
@@ -693,14 +700,14 @@ EditorProfiler::EditorProfiler() {
hb_measure->add_theme_constant_override(SNAME("separation"), 2 * EDSCALE); hb_measure->add_theme_constant_override(SNAME("separation"), 2 * EDSCALE);
container->add_child(hb_measure); container->add_child(hb_measure);
hb_measure->add_child(memnew(Label(TTR("Measure:")))); hb_measure->add_child(memnew(Label(TTRC("Measure:"))));
display_mode = memnew(OptionButton); display_mode = memnew(OptionButton);
display_mode->set_accessibility_name(TTRC("Measure:")); display_mode->set_accessibility_name(TTRC("Measure:"));
display_mode->add_item(TTR("Frame Time (ms)")); display_mode->add_item(TTRC("Frame Time (ms)"));
display_mode->add_item(TTR("Average Time (ms)")); display_mode->add_item(TTRC("Average Time (ms)"));
display_mode->add_item(TTR("Frame %")); display_mode->add_item(TTRC("Frame %"));
display_mode->add_item(TTR("Physics Frame %")); display_mode->add_item(TTRC("Physics Frame %"));
display_mode->connect(SceneStringName(item_selected), callable_mp(this, &EditorProfiler::_combo_changed)); display_mode->connect(SceneStringName(item_selected), callable_mp(this, &EditorProfiler::_combo_changed));
hb_measure->add_child(display_mode); hb_measure->add_child(display_mode);
@@ -709,19 +716,19 @@ EditorProfiler::EditorProfiler() {
hb_time->add_theme_constant_override(SNAME("separation"), 2 * EDSCALE); hb_time->add_theme_constant_override(SNAME("separation"), 2 * EDSCALE);
container->add_child(hb_time); container->add_child(hb_time);
hb_time->add_child(memnew(Label(TTR("Time:")))); hb_time->add_child(memnew(Label(TTRC("Time:"))));
display_time = memnew(OptionButton); display_time = memnew(OptionButton);
display_time->set_accessibility_name(TTRC("Time:")); display_time->set_accessibility_name(TTRC("Time:"));
// TRANSLATORS: This is an option in the profiler to display the time spent in a function, including the time spent in other functions called by that function. // TRANSLATORS: This is an option in the profiler to display the time spent in a function, including the time spent in other functions called by that function.
display_time->add_item(TTR("Inclusive")); display_time->add_item(TTRC("Inclusive"));
// TRANSLATORS: This is an option in the profiler to display the time spent in a function, exincluding the time spent in other functions called by that function. // TRANSLATORS: This is an option in the profiler to display the time spent in a function, exincluding the time spent in other functions called by that function.
display_time->add_item(TTR("Self")); display_time->add_item(TTRC("Self"));
display_time->set_tooltip_text(TTR("Inclusive: Includes time from other functions called by this function.\nUse this to spot bottlenecks.\n\nSelf: Only count the time spent in the function itself, not in other functions called by that function.\nUse this to find individual functions to optimize.")); display_time->set_tooltip_text(TTRC("Inclusive: Includes time from other functions called by this function.\nUse this to spot bottlenecks.\n\nSelf: Only count the time spent in the function itself, not in other functions called by that function.\nUse this to find individual functions to optimize."));
display_time->connect(SceneStringName(item_selected), callable_mp(this, &EditorProfiler::_combo_changed)); display_time->connect(SceneStringName(item_selected), callable_mp(this, &EditorProfiler::_combo_changed));
hb_time->add_child(display_time); hb_time->add_child(display_time);
display_internal_profiles = memnew(CheckButton(TTR("Display internal functions"))); display_internal_profiles = memnew(CheckButton(TTRC("Display internal functions")));
display_internal_profiles->set_visible(EDITOR_GET("debugger/profile_native_calls")); display_internal_profiles->set_visible(EDITOR_GET("debugger/profile_native_calls"));
display_internal_profiles->set_pressed(false); display_internal_profiles->set_pressed(false);
display_internal_profiles->connect(SceneStringName(pressed), callable_mp(this, &EditorProfiler::_internal_profiles_pressed)); display_internal_profiles->connect(SceneStringName(pressed), callable_mp(this, &EditorProfiler::_internal_profiles_pressed));
@@ -732,7 +739,7 @@ EditorProfiler::EditorProfiler() {
hb_frame->set_v_size_flags(SIZE_SHRINK_BEGIN); hb_frame->set_v_size_flags(SIZE_SHRINK_BEGIN);
hb->add_child(hb_frame); hb->add_child(hb_frame);
hb_frame->add_child(memnew(Label(TTR("Frame #:")))); hb_frame->add_child(memnew(Label(TTRC("Frame #:"))));
cursor_metric_edit = memnew(SpinBox); cursor_metric_edit = memnew(SpinBox);
cursor_metric_edit->set_accessibility_name(TTRC("Frame #:")); cursor_metric_edit->set_accessibility_name(TTRC("Frame #:"));
@@ -747,22 +754,21 @@ EditorProfiler::EditorProfiler() {
h_split->set_v_size_flags(SIZE_EXPAND_FILL); h_split->set_v_size_flags(SIZE_EXPAND_FILL);
variables = memnew(Tree); variables = memnew(Tree);
variables->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
variables->set_custom_minimum_size(Size2(320, 0) * EDSCALE); variables->set_custom_minimum_size(Size2(320, 0) * EDSCALE);
variables->set_hide_folding(true); variables->set_hide_folding(true);
h_split->add_child(variables); h_split->add_child(variables);
variables->set_hide_root(true); variables->set_hide_root(true);
variables->set_columns(3); variables->set_columns(3);
variables->set_column_titles_visible(true); variables->set_column_titles_visible(true);
variables->set_column_title(0, TTR("Name")); variables->set_column_title(0, TTRC("Name"));
variables->set_column_expand(0, true); variables->set_column_expand(0, true);
variables->set_column_clip_content(0, true); variables->set_column_clip_content(0, true);
variables->set_column_custom_minimum_width(0, 60); variables->set_column_custom_minimum_width(0, 60);
variables->set_column_title(1, TTR("Time")); variables->set_column_title(1, TTRC("Time"));
variables->set_column_expand(1, false); variables->set_column_expand(1, false);
variables->set_column_clip_content(1, true); variables->set_column_clip_content(1, true);
variables->set_column_custom_minimum_width(1, 75 * EDSCALE); variables->set_column_custom_minimum_width(1, 75 * EDSCALE);
variables->set_column_title(2, TTR("Calls")); variables->set_column_title(2, TTRC("Calls"));
variables->set_column_expand(2, false); variables->set_column_expand(2, false);
variables->set_column_clip_content(2, true); variables->set_column_clip_content(2, true);
variables->set_column_custom_minimum_width(2, 50 * EDSCALE); variables->set_column_custom_minimum_width(2, 50 * EDSCALE);

View File

@@ -422,12 +422,12 @@ void EditorVisualProfiler::_update_frame(bool p_focus_selected) {
void EditorVisualProfiler::_activate_pressed() { void EditorVisualProfiler::_activate_pressed() {
if (activate->is_pressed()) { if (activate->is_pressed()) {
activate->set_button_icon(get_editor_theme_icon(SNAME("Stop"))); activate->set_button_icon(get_editor_theme_icon(SNAME("Stop")));
activate->set_text(TTR("Stop")); activate->set_text(TTRC("Stop"));
_clear_pressed(); //always clear on start _clear_pressed(); //always clear on start
clear_button->set_disabled(false); clear_button->set_disabled(false);
} else { } else {
activate->set_button_icon(get_editor_theme_icon(SNAME("Play"))); activate->set_button_icon(get_editor_theme_icon(SNAME("Play")));
activate->set_text(TTR("Start")); activate->set_text(TTRC("Start"));
} }
emit_signal(SNAME("enable_profiling"), activate->is_pressed()); emit_signal(SNAME("enable_profiling"), activate->is_pressed());
} }
@@ -445,9 +445,14 @@ void EditorVisualProfiler::_autostart_toggled(bool p_toggled_on) {
void EditorVisualProfiler::_notification(int p_what) { void EditorVisualProfiler::_notification(int p_what) {
switch (p_what) { switch (p_what) {
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
case NOTIFICATION_THEME_CHANGED:
case NOTIFICATION_TRANSLATION_CHANGED: { case NOTIFICATION_TRANSLATION_CHANGED: {
if (is_ready()) {
_update_frame();
}
[[fallthrough]];
}
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
case NOTIFICATION_THEME_CHANGED: {
activate->set_button_icon(get_editor_theme_icon(SNAME("Play"))); activate->set_button_icon(get_editor_theme_icon(SNAME("Play")));
clear_button->set_button_icon(get_editor_theme_icon(SNAME("Clear"))); clear_button->set_button_icon(get_editor_theme_icon(SNAME("Clear")));
} break; } break;
@@ -668,10 +673,10 @@ void EditorVisualProfiler::_bind_methods() {
void EditorVisualProfiler::_update_button_text() { void EditorVisualProfiler::_update_button_text() {
if (activate->is_pressed()) { if (activate->is_pressed()) {
activate->set_button_icon(get_editor_theme_icon(SNAME("Stop"))); activate->set_button_icon(get_editor_theme_icon(SNAME("Stop")));
activate->set_text(TTR("Stop")); activate->set_text(TTRC("Stop"));
} else { } else {
activate->set_button_icon(get_editor_theme_icon(SNAME("Play"))); activate->set_button_icon(get_editor_theme_icon(SNAME("Play")));
activate->set_text(TTR("Start")); activate->set_text(TTRC("Start"));
} }
} }
@@ -757,18 +762,18 @@ EditorVisualProfiler::EditorVisualProfiler() {
activate = memnew(Button); activate = memnew(Button);
activate->set_toggle_mode(true); activate->set_toggle_mode(true);
activate->set_disabled(true); activate->set_disabled(true);
activate->set_text(TTR("Start")); activate->set_text(TTRC("Start"));
activate->connect(SceneStringName(pressed), callable_mp(this, &EditorVisualProfiler::_activate_pressed)); activate->connect(SceneStringName(pressed), callable_mp(this, &EditorVisualProfiler::_activate_pressed));
container->add_child(activate); container->add_child(activate);
clear_button = memnew(Button); clear_button = memnew(Button);
clear_button->set_text(TTR("Clear")); clear_button->set_text(TTRC("Clear"));
clear_button->set_disabled(true); clear_button->set_disabled(true);
clear_button->connect(SceneStringName(pressed), callable_mp(this, &EditorVisualProfiler::_clear_pressed)); clear_button->connect(SceneStringName(pressed), callable_mp(this, &EditorVisualProfiler::_clear_pressed));
container->add_child(clear_button); container->add_child(clear_button);
CheckBox *autostart_checkbox = memnew(CheckBox); CheckBox *autostart_checkbox = memnew(CheckBox);
autostart_checkbox->set_text(TTR("Autostart")); autostart_checkbox->set_text(TTRC("Autostart"));
autostart_checkbox->set_pressed(EditorSettings::get_singleton()->get_project_metadata("debug_options", "autostart_visual_profiler", false)); autostart_checkbox->set_pressed(EditorSettings::get_singleton()->get_project_metadata("debug_options", "autostart_visual_profiler", false));
autostart_checkbox->connect(SceneStringName(toggled), callable_mp(this, &EditorVisualProfiler::_autostart_toggled)); autostart_checkbox->connect(SceneStringName(toggled), callable_mp(this, &EditorVisualProfiler::_autostart_toggled));
container->add_child(autostart_checkbox); container->add_child(autostart_checkbox);
@@ -777,21 +782,21 @@ EditorVisualProfiler::EditorVisualProfiler() {
hb_measure->add_theme_constant_override(SNAME("separation"), 2 * EDSCALE); hb_measure->add_theme_constant_override(SNAME("separation"), 2 * EDSCALE);
container->add_child(hb_measure); container->add_child(hb_measure);
hb_measure->add_child(memnew(Label(TTR("Measure:")))); hb_measure->add_child(memnew(Label(TTRC("Measure:"))));
display_mode = memnew(OptionButton); display_mode = memnew(OptionButton);
display_mode->set_accessibility_name(TTRC("Measure:")); display_mode->set_accessibility_name(TTRC("Measure:"));
display_mode->add_item(TTR("Frame Time (ms)")); display_mode->add_item(TTRC("Frame Time (ms)"));
display_mode->add_item(TTR("Frame %")); display_mode->add_item(TTRC("Frame %"));
display_mode->connect(SceneStringName(item_selected), callable_mp(this, &EditorVisualProfiler::_combo_changed)); display_mode->connect(SceneStringName(item_selected), callable_mp(this, &EditorVisualProfiler::_combo_changed));
hb_measure->add_child(display_mode); hb_measure->add_child(display_mode);
frame_relative = memnew(CheckBox(TTR("Fit to Frame"))); frame_relative = memnew(CheckBox(TTRC("Fit to Frame")));
frame_relative->set_pressed(true); frame_relative->set_pressed(true);
container->add_child(frame_relative); container->add_child(frame_relative);
frame_relative->connect(SceneStringName(pressed), callable_mp(this, &EditorVisualProfiler::_update_plot)); frame_relative->connect(SceneStringName(pressed), callable_mp(this, &EditorVisualProfiler::_update_plot));
linked = memnew(CheckBox(TTR("Linked"))); linked = memnew(CheckBox(TTRC("Linked")));
linked->set_pressed(true); linked->set_pressed(true);
container->add_child(linked); container->add_child(linked);
linked->connect(SceneStringName(pressed), callable_mp(this, &EditorVisualProfiler::_update_plot)); linked->connect(SceneStringName(pressed), callable_mp(this, &EditorVisualProfiler::_update_plot));
@@ -801,7 +806,7 @@ EditorVisualProfiler::EditorVisualProfiler() {
hb_frame->set_v_size_flags(SIZE_SHRINK_BEGIN); hb_frame->set_v_size_flags(SIZE_SHRINK_BEGIN);
hb->add_child(hb_frame); hb->add_child(hb_frame);
hb_frame->add_child(memnew(Label(TTR("Frame #:")))); hb_frame->add_child(memnew(Label(TTRC("Frame #:"))));
cursor_metric_edit = memnew(SpinBox); cursor_metric_edit = memnew(SpinBox);
cursor_metric_edit->set_accessibility_name(TTRC("Frame #:")); cursor_metric_edit->set_accessibility_name(TTRC("Frame #:"));
@@ -820,15 +825,15 @@ EditorVisualProfiler::EditorVisualProfiler() {
variables->set_hide_root(true); variables->set_hide_root(true);
variables->set_columns(3); variables->set_columns(3);
variables->set_column_titles_visible(true); variables->set_column_titles_visible(true);
variables->set_column_title(0, TTR("Name")); variables->set_column_title(0, TTRC("Name"));
variables->set_column_expand(0, true); variables->set_column_expand(0, true);
variables->set_column_clip_content(0, true); variables->set_column_clip_content(0, true);
variables->set_column_custom_minimum_width(0, 60); variables->set_column_custom_minimum_width(0, 60);
variables->set_column_title(1, TTR("CPU")); variables->set_column_title(1, TTRC("CPU"));
variables->set_column_expand(1, false); variables->set_column_expand(1, false);
variables->set_column_clip_content(1, true); variables->set_column_clip_content(1, true);
variables->set_column_custom_minimum_width(1, 75 * EDSCALE); variables->set_column_custom_minimum_width(1, 75 * EDSCALE);
variables->set_column_title(2, TTR("GPU")); variables->set_column_title(2, TTRC("GPU"));
variables->set_column_expand(2, false); variables->set_column_expand(2, false);
variables->set_column_clip_content(2, true); variables->set_column_clip_content(2, true);
variables->set_column_custom_minimum_width(2, 75 * EDSCALE); variables->set_column_custom_minimum_width(2, 75 * EDSCALE);

View File

@@ -155,7 +155,7 @@ void ScriptEditorDebugger::debug_continue() {
void ScriptEditorDebugger::update_tabs() { void ScriptEditorDebugger::update_tabs() {
if (error_count == 0 && warning_count == 0) { if (error_count == 0 && warning_count == 0) {
errors_tab->set_name(TTR("Errors")); errors_tab->set_name(TTRC("Errors"));
tabs->set_tab_icon(tabs->get_tab_idx_from_control(errors_tab), Ref<Texture2D>()); tabs->set_tab_icon(tabs->get_tab_idx_from_control(errors_tab), Ref<Texture2D>());
} else { } else {
errors_tab->set_name(TTR("Errors") + " (" + itos(error_count + warning_count) + ")"); errors_tab->set_name(TTR("Errors") + " (" + itos(error_count + warning_count) + ")");
@@ -402,7 +402,7 @@ void ScriptEditorDebugger::_msg_debug_exit(uint64_t p_thread_id, const Array &p_
visual_profiler->set_enabled(true); visual_profiler->set_enabled(true);
_set_reason_text(TTR("Execution resumed."), MESSAGE_SUCCESS); _set_reason_text(TTRC("Execution resumed."), MESSAGE_SUCCESS);
emit_signal(SNAME("breaked"), false, false, "", false); emit_signal(SNAME("breaked"), false, false, "", false);
_mute_audio_on_break(false); _mute_audio_on_break(false);
@@ -636,7 +636,7 @@ void ScriptEditorDebugger::_msg_error(uint64_t p_thread_id, const Array &p_data)
// Also provide the relevant details as tooltip to quickly check without // Also provide the relevant details as tooltip to quickly check without
// uncollapsing the tree. // uncollapsing the tree.
String tooltip = oe.warning ? TTR("Warning:") : TTR("Error:"); String tooltip = oe.warning ? TTRC("Warning:") : TTRC("Error:");
TreeItem *error = error_tree->create_item(r); TreeItem *error = error_tree->create_item(r);
if (oe.warning) { if (oe.warning) {
@@ -1079,6 +1079,18 @@ void ScriptEditorDebugger::_notification(int p_what) {
connect("started", callable_mp(expression_evaluator, &EditorExpressionEvaluator::on_start)); connect("started", callable_mp(expression_evaluator, &EditorExpressionEvaluator::on_start));
} break; } break;
case NOTIFICATION_TRANSLATION_CHANGED: {
if (is_ready()) {
for (TreeItem *file_item = breakpoints_tree->get_root()->get_first_child(); file_item; file_item = file_item->get_next()) {
for (TreeItem *breakpoint_item = file_item->get_first_child(); breakpoint_item; breakpoint_item = breakpoint_item->get_next()) {
int line = breakpoint_item->get_meta("line");
breakpoint_item->set_text(0, vformat(TTR("Line %d"), line));
}
}
update_tabs();
}
} break;
case NOTIFICATION_THEME_CHANGED: { case NOTIFICATION_THEME_CHANGED: {
tabs->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SNAME("DebuggerPanel"), EditorStringName(EditorStyles))); tabs->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SNAME("DebuggerPanel"), EditorStringName(EditorStyles)));
@@ -1243,7 +1255,7 @@ void ScriptEditorDebugger::start(Ref<RemoteDebuggerPeer> p_peer) {
set_process(true); set_process(true);
camera_override = CameraOverride::OVERRIDE_NONE; camera_override = CameraOverride::OVERRIDE_NONE;
_set_reason_text(TTR("Debug session started."), MESSAGE_SUCCESS); _set_reason_text(TTRC("Debug session started."), MESSAGE_SUCCESS);
_update_buttons_state(); _update_buttons_state();
Array quit_keys = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("editor/stop_running_project")); Array quit_keys = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("editor/stop_running_project"));
@@ -1298,7 +1310,7 @@ void ScriptEditorDebugger::_update_buttons_state() {
void ScriptEditorDebugger::_stop_and_notify() { void ScriptEditorDebugger::_stop_and_notify() {
stop(); stop();
emit_signal(SNAME("stopped")); emit_signal(SNAME("stopped"));
_set_reason_text(TTR("Debug session closed."), MESSAGE_WARNING); _set_reason_text(TTRC("Debug session closed."), MESSAGE_WARNING);
} }
void ScriptEditorDebugger::stop() { void ScriptEditorDebugger::stop() {
@@ -1842,11 +1854,12 @@ void ScriptEditorDebugger::_breakpoints_item_rmb_selected(const Vector2 &p_pos,
const TreeItem *selected = breakpoints_tree->get_selected(); const TreeItem *selected = breakpoints_tree->get_selected();
String file = selected->get_text(0); String file = selected->get_text(0);
if (selected->has_meta("line")) { if (selected->has_meta("line")) {
breakpoints_menu->add_icon_item(get_editor_theme_icon(SNAME("Remove")), TTR("Delete Breakpoint"), ACTION_DELETE_BREAKPOINT); breakpoints_menu->add_icon_item(get_editor_theme_icon(SNAME("Remove")), TTRC("Delete Breakpoint"), ACTION_DELETE_BREAKPOINT);
file = selected->get_parent()->get_text(0); file = selected->get_parent()->get_text(0);
} }
breakpoints_menu->add_icon_item(get_editor_theme_icon(SNAME("Remove")), TTR("Delete All Breakpoints in:") + " " + file, ACTION_DELETE_BREAKPOINTS_IN_FILE); breakpoints_menu->add_icon_item(get_editor_theme_icon(SNAME("Remove")), TTR("Delete All Breakpoints in:") + " " + file, ACTION_DELETE_BREAKPOINTS_IN_FILE);
breakpoints_menu->add_icon_item(get_editor_theme_icon(SNAME("Remove")), TTR("Delete All Breakpoints"), ACTION_DELETE_ALL_BREAKPOINTS); breakpoints_menu->set_item_auto_translate_mode(-1, AUTO_TRANSLATE_MODE_DISABLED);
breakpoints_menu->add_icon_item(get_editor_theme_icon(SNAME("Remove")), TTRC("Delete All Breakpoints"), ACTION_DELETE_ALL_BREAKPOINTS);
breakpoints_menu->set_position(get_screen_position() + get_local_mouse_position()); breakpoints_menu->set_position(get_screen_position() + get_local_mouse_position());
breakpoints_menu->popup(); breakpoints_menu->popup();
@@ -1862,8 +1875,8 @@ void ScriptEditorDebugger::_error_tree_item_rmb_selected(const Vector2 &p_pos, M
item_menu->reset_size(); item_menu->reset_size();
if (error_tree->is_anything_selected()) { if (error_tree->is_anything_selected()) {
item_menu->add_icon_item(get_editor_theme_icon(SNAME("ActionCopy")), TTR("Copy Error"), ACTION_COPY_ERROR); item_menu->add_icon_item(get_editor_theme_icon(SNAME("ActionCopy")), TTRC("Copy Error"), ACTION_COPY_ERROR);
item_menu->add_icon_item(get_editor_theme_icon(SNAME("ExternalLink")), TTR("Open C++ Source on GitHub"), ACTION_OPEN_SOURCE); item_menu->add_icon_item(get_editor_theme_icon(SNAME("ExternalLink")), TTRC("Open C++ Source on GitHub"), ACTION_OPEN_SOURCE);
} }
if (item_menu->get_item_count() > 0) { if (item_menu->get_item_count() > 0) {
@@ -1962,7 +1975,7 @@ void ScriptEditorDebugger::_item_menu_id_pressed(int p_option) {
} }
void ScriptEditorDebugger::_tab_changed(int p_tab) { void ScriptEditorDebugger::_tab_changed(int p_tab) {
if (tabs->get_tab_title(p_tab) == TTR("Video RAM")) { if (tabs->get_tab_title(p_tab) == "Video RAM") {
// "Video RAM" tab was clicked, refresh the data it's displaying when entering the tab. // "Video RAM" tab was clicked, refresh the data it's displaying when entering the tab.
_video_mem_request(); _video_mem_request();
} }
@@ -2044,9 +2057,9 @@ ScriptEditorDebugger::ScriptEditorDebugger() {
InspectorDock::get_inspector_singleton()->connect("object_id_selected", callable_mp(this, &ScriptEditorDebugger::_remote_object_selected)); InspectorDock::get_inspector_singleton()->connect("object_id_selected", callable_mp(this, &ScriptEditorDebugger::_remote_object_selected));
EditorFileSystem::get_singleton()->connect("resources_reimported", callable_mp(this, &ScriptEditorDebugger::_resources_reimported)); EditorFileSystem::get_singleton()->connect("resources_reimported", callable_mp(this, &ScriptEditorDebugger::_resources_reimported));
{ //debugger { // Debugger.
VBoxContainer *vbc = memnew(VBoxContainer); VBoxContainer *vbc = memnew(VBoxContainer);
vbc->set_name(TTR("Stack Trace")); vbc->set_name(TTRC("Stack Trace"));
Control *dbg = vbc; Control *dbg = vbc;
HBoxContainer *hbc = memnew(HBoxContainer); HBoxContainer *hbc = memnew(HBoxContainer);
@@ -2066,12 +2079,12 @@ ScriptEditorDebugger::ScriptEditorDebugger() {
skip_breakpoints = memnew(Button); skip_breakpoints = memnew(Button);
skip_breakpoints->set_theme_type_variation(SceneStringName(FlatButton)); skip_breakpoints->set_theme_type_variation(SceneStringName(FlatButton));
hbc->add_child(skip_breakpoints); hbc->add_child(skip_breakpoints);
skip_breakpoints->set_tooltip_text(TTR("Skip Breakpoints")); skip_breakpoints->set_tooltip_text(TTRC("Skip Breakpoints"));
skip_breakpoints->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::debug_skip_breakpoints)); skip_breakpoints->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::debug_skip_breakpoints));
ignore_error_breaks = memnew(Button); ignore_error_breaks = memnew(Button);
ignore_error_breaks->set_theme_type_variation(SceneStringName(FlatButton)); ignore_error_breaks->set_theme_type_variation(SceneStringName(FlatButton));
ignore_error_breaks->set_tooltip_text(TTR("Ignore Error Breaks")); ignore_error_breaks->set_tooltip_text(TTRC("Ignore Error Breaks"));
hbc->add_child(ignore_error_breaks); hbc->add_child(ignore_error_breaks);
ignore_error_breaks->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::debug_ignore_error_breaks)); ignore_error_breaks->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::debug_ignore_error_breaks));
@@ -2080,7 +2093,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() {
copy = memnew(Button); copy = memnew(Button);
copy->set_theme_type_variation(SceneStringName(FlatButton)); copy->set_theme_type_variation(SceneStringName(FlatButton));
hbc->add_child(copy); hbc->add_child(copy);
copy->set_tooltip_text(TTR("Copy Error")); copy->set_tooltip_text(TTRC("Copy Error"));
copy->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::debug_copy)); copy->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::debug_copy));
hbc->add_child(memnew(VSeparator)); hbc->add_child(memnew(VSeparator));
@@ -2088,14 +2101,14 @@ ScriptEditorDebugger::ScriptEditorDebugger() {
step = memnew(Button); step = memnew(Button);
step->set_theme_type_variation(SceneStringName(FlatButton)); step->set_theme_type_variation(SceneStringName(FlatButton));
hbc->add_child(step); hbc->add_child(step);
step->set_tooltip_text(TTR("Step Into")); step->set_tooltip_text(TTRC("Step Into"));
step->set_shortcut(ED_GET_SHORTCUT("debugger/step_into")); step->set_shortcut(ED_GET_SHORTCUT("debugger/step_into"));
step->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::debug_step)); step->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::debug_step));
next = memnew(Button); next = memnew(Button);
next->set_theme_type_variation(SceneStringName(FlatButton)); next->set_theme_type_variation(SceneStringName(FlatButton));
hbc->add_child(next); hbc->add_child(next);
next->set_tooltip_text(TTR("Step Over")); next->set_tooltip_text(TTRC("Step Over"));
next->set_shortcut(ED_GET_SHORTCUT("debugger/step_over")); next->set_shortcut(ED_GET_SHORTCUT("debugger/step_over"));
next->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::debug_next)); next->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::debug_next));
@@ -2111,14 +2124,14 @@ ScriptEditorDebugger::ScriptEditorDebugger() {
dobreak = memnew(Button); dobreak = memnew(Button);
dobreak->set_theme_type_variation(SceneStringName(FlatButton)); dobreak->set_theme_type_variation(SceneStringName(FlatButton));
hbc->add_child(dobreak); hbc->add_child(dobreak);
dobreak->set_tooltip_text(TTR("Break")); dobreak->set_tooltip_text(TTRC("Break"));
dobreak->set_shortcut(ED_GET_SHORTCUT("debugger/break")); dobreak->set_shortcut(ED_GET_SHORTCUT("debugger/break"));
dobreak->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::debug_break)); dobreak->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::debug_break));
docontinue = memnew(Button); docontinue = memnew(Button);
docontinue->set_theme_type_variation(SceneStringName(FlatButton)); docontinue->set_theme_type_variation(SceneStringName(FlatButton));
hbc->add_child(docontinue); hbc->add_child(docontinue);
docontinue->set_tooltip_text(TTR("Continue")); docontinue->set_tooltip_text(TTRC("Continue"));
docontinue->set_shortcut(ED_GET_SHORTCUT("debugger/continue")); docontinue->set_shortcut(ED_GET_SHORTCUT("debugger/continue"));
docontinue->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::debug_continue)); docontinue->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::debug_continue));
@@ -2137,7 +2150,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() {
sc->add_child(stack_vb); sc->add_child(stack_vb);
HBoxContainer *thread_hb = memnew(HBoxContainer); HBoxContainer *thread_hb = memnew(HBoxContainer);
stack_vb->add_child(thread_hb); stack_vb->add_child(thread_hb);
thread_hb->add_child(memnew(Label(TTR("Thread:")))); thread_hb->add_child(memnew(Label(TTRC("Thread:"))));
threads = memnew(OptionButton); threads = memnew(OptionButton);
thread_hb->add_child(threads); thread_hb->add_child(threads);
threads->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); threads->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
@@ -2149,7 +2162,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() {
stack_dump->set_allow_reselect(true); stack_dump->set_allow_reselect(true);
stack_dump->set_columns(1); stack_dump->set_columns(1);
stack_dump->set_column_titles_visible(true); stack_dump->set_column_titles_visible(true);
stack_dump->set_column_title(0, TTR("Stack Frames")); stack_dump->set_column_title(0, TTRC("Stack Frames"));
stack_dump->set_hide_root(true); stack_dump->set_hide_root(true);
stack_dump->set_v_size_flags(SIZE_EXPAND_FILL); stack_dump->set_v_size_flags(SIZE_EXPAND_FILL);
stack_dump->set_theme_type_variation("TreeSecondary"); stack_dump->set_theme_type_variation("TreeSecondary");
@@ -2166,7 +2179,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() {
search = memnew(LineEdit); search = memnew(LineEdit);
search->set_h_size_flags(Control::SIZE_EXPAND_FILL); search->set_h_size_flags(Control::SIZE_EXPAND_FILL);
search->set_placeholder(TTR("Filter Stack Variables")); search->set_placeholder(TTRC("Filter Stack Variables"));
search->set_accessibility_name(TTRC("Filter Stack Variables")); search->set_accessibility_name(TTRC("Filter Stack Variables"));
search->set_clear_button_enabled(true); search->set_clear_button_enabled(true);
tools_hb->add_child(search); tools_hb->add_child(search);
@@ -2187,7 +2200,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() {
breakpoints_tree->set_custom_minimum_size(Size2(100, 0) * EDSCALE); breakpoints_tree->set_custom_minimum_size(Size2(100, 0) * EDSCALE);
breakpoints_tree->set_h_size_flags(SIZE_EXPAND_FILL); breakpoints_tree->set_h_size_flags(SIZE_EXPAND_FILL);
breakpoints_tree->set_column_titles_visible(true); breakpoints_tree->set_column_titles_visible(true);
breakpoints_tree->set_column_title(0, TTR("Breakpoints")); breakpoints_tree->set_column_title(0, TTRC("Breakpoints"));
breakpoints_tree->set_allow_reselect(true); breakpoints_tree->set_allow_reselect(true);
breakpoints_tree->set_allow_rmb_select(true); breakpoints_tree->set_allow_rmb_select(true);
breakpoints_tree->set_hide_root(true); breakpoints_tree->set_hide_root(true);
@@ -2203,21 +2216,21 @@ ScriptEditorDebugger::ScriptEditorDebugger() {
breakpoints_tree->add_child(breakpoints_menu); breakpoints_tree->add_child(breakpoints_menu);
} }
{ //errors { // Errors.
errors_tab = memnew(VBoxContainer); errors_tab = memnew(VBoxContainer);
errors_tab->set_name(TTR("Errors")); errors_tab->set_name(TTRC("Errors"));
HBoxContainer *error_hbox = memnew(HBoxContainer); HBoxContainer *error_hbox = memnew(HBoxContainer);
errors_tab->add_child(error_hbox); errors_tab->add_child(error_hbox);
expand_all_button = memnew(Button); expand_all_button = memnew(Button);
expand_all_button->set_text(TTR("Expand All")); expand_all_button->set_text(TTRC("Expand All"));
expand_all_button->set_disabled(true); expand_all_button->set_disabled(true);
expand_all_button->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::_expand_errors_list)); expand_all_button->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::_expand_errors_list));
error_hbox->add_child(expand_all_button); error_hbox->add_child(expand_all_button);
collapse_all_button = memnew(Button); collapse_all_button = memnew(Button);
collapse_all_button->set_text(TTR("Collapse All")); collapse_all_button->set_text(TTRC("Collapse All"));
collapse_all_button->set_disabled(true); collapse_all_button->set_disabled(true);
collapse_all_button->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::_collapse_errors_list)); collapse_all_button->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::_collapse_errors_list));
error_hbox->add_child(collapse_all_button); error_hbox->add_child(collapse_all_button);
@@ -2227,7 +2240,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() {
error_hbox->add_child(space); error_hbox->add_child(space);
clear_button = memnew(Button); clear_button = memnew(Button);
clear_button->set_text(TTR("Clear")); clear_button->set_text(TTRC("Clear"));
clear_button->set_h_size_flags(0); clear_button->set_h_size_flags(0);
clear_button->set_disabled(true); clear_button->set_disabled(true);
clear_button->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::_clear_errors_list)); clear_button->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::_clear_errors_list));
@@ -2267,14 +2280,14 @@ ScriptEditorDebugger::ScriptEditorDebugger() {
{ // Expression evaluator { // Expression evaluator
expression_evaluator = memnew(EditorExpressionEvaluator); expression_evaluator = memnew(EditorExpressionEvaluator);
expression_evaluator->set_name(TTR("Evaluator")); expression_evaluator->set_name(TTRC("Evaluator"));
expression_evaluator->set_editor_debugger(this); expression_evaluator->set_editor_debugger(this);
tabs->add_child(expression_evaluator); tabs->add_child(expression_evaluator);
} }
{ //profiler { //profiler
profiler = memnew(EditorProfiler); profiler = memnew(EditorProfiler);
profiler->set_name(TTR("Profiler")); profiler->set_name(TTRC("Profiler"));
tabs->add_child(profiler); tabs->add_child(profiler);
profiler->connect("enable_profiling", callable_mp(this, &ScriptEditorDebugger::_profiler_activate).bind(PROFILER_SCRIPTS_SERVERS)); profiler->connect("enable_profiling", callable_mp(this, &ScriptEditorDebugger::_profiler_activate).bind(PROFILER_SCRIPTS_SERVERS));
profiler->connect("break_request", callable_mp(this, &ScriptEditorDebugger::_profiler_seeked)); profiler->connect("break_request", callable_mp(this, &ScriptEditorDebugger::_profiler_seeked));
@@ -2282,7 +2295,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() {
{ //frame profiler { //frame profiler
visual_profiler = memnew(EditorVisualProfiler); visual_profiler = memnew(EditorVisualProfiler);
visual_profiler->set_name(TTR("Visual Profiler")); visual_profiler->set_name(TTRC("Visual Profiler"));
tabs->add_child(visual_profiler); tabs->add_child(visual_profiler);
visual_profiler->connect("enable_profiling", callable_mp(this, &ScriptEditorDebugger::_profiler_activate).bind(PROFILER_VISUAL)); visual_profiler->connect("enable_profiling", callable_mp(this, &ScriptEditorDebugger::_profiler_activate).bind(PROFILER_VISUAL));
} }
@@ -2305,7 +2318,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() {
vmem_notice_icon->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED); vmem_notice_icon->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED);
vmem_notice_icon->set_h_size_flags(SIZE_SHRINK_CENTER); vmem_notice_icon->set_h_size_flags(SIZE_SHRINK_CENTER);
vmem_notice_icon->set_visible(true); vmem_notice_icon->set_visible(true);
vmem_notice_icon->set_tooltip_text(TTR(R"(Notice: vmem_notice_icon->set_tooltip_text(TTRC(R"(Notice:
This tool only reports memory allocations tracked by the engine. This tool only reports memory allocations tracked by the engine.
Therefore, total VRAM usage is inaccurate compared to what the Monitors tab or external tools can report. Therefore, total VRAM usage is inaccurate compared to what the Monitors tab or external tools can report.
Instead, use the monitors tab to obtain more precise VRAM usage. Instead, use the monitors tab to obtain more precise VRAM usage.
@@ -2321,7 +2334,7 @@ Instead, use the monitors tab to obtain more precise VRAM usage.
vmem_hb->add_child(space); vmem_hb->add_child(space);
} }
vmem_hb->add_child(memnew(Label(TTR("Total:") + " "))); vmem_hb->add_child(memnew(Label(TTRC("Total:"))));
vmem_total = memnew(LineEdit); vmem_total = memnew(LineEdit);
vmem_total->set_editable(false); vmem_total->set_editable(false);
vmem_total->set_accessibility_name(TTRC("Video RAM Total")); vmem_total->set_accessibility_name(TTRC("Video RAM Total"));
@@ -2333,7 +2346,7 @@ Instead, use the monitors tab to obtain more precise VRAM usage.
vmem_hb->add_child(vmem_refresh); vmem_hb->add_child(vmem_refresh);
vmem_export = memnew(Button); vmem_export = memnew(Button);
vmem_export->set_theme_type_variation(SceneStringName(FlatButton)); vmem_export->set_theme_type_variation(SceneStringName(FlatButton));
vmem_export->set_tooltip_text(TTR("Export list to a CSV file")); vmem_export->set_tooltip_text(TTRC("Export list to a CSV file"));
vmem_hb->add_child(vmem_export); vmem_hb->add_child(vmem_export);
vmem_vb->add_child(vmem_hb); vmem_vb->add_child(vmem_hb);
vmem_refresh->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::_video_mem_request)); vmem_refresh->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::_video_mem_request));
@@ -2347,19 +2360,19 @@ Instead, use the monitors tab to obtain more precise VRAM usage.
vmmc->set_v_size_flags(SIZE_EXPAND_FILL); vmmc->set_v_size_flags(SIZE_EXPAND_FILL);
vmem_vb->add_child(vmmc); vmem_vb->add_child(vmmc);
vmem_vb->set_name(TTR("Video RAM")); vmem_vb->set_name(TTRC("Video RAM"));
vmem_tree->set_columns(4); vmem_tree->set_columns(4);
vmem_tree->set_column_titles_visible(true); vmem_tree->set_column_titles_visible(true);
vmem_tree->set_column_title(0, TTR("Resource Path")); vmem_tree->set_column_title(0, TTRC("Resource Path"));
vmem_tree->set_column_expand(0, true); vmem_tree->set_column_expand(0, true);
vmem_tree->set_column_expand(1, false); vmem_tree->set_column_expand(1, false);
vmem_tree->set_column_title(1, TTR("Type")); vmem_tree->set_column_title(1, TTRC("Type"));
vmem_tree->set_column_custom_minimum_width(1, 100 * EDSCALE); vmem_tree->set_column_custom_minimum_width(1, 100 * EDSCALE);
vmem_tree->set_column_expand(2, false); vmem_tree->set_column_expand(2, false);
vmem_tree->set_column_title(2, TTR("Format")); vmem_tree->set_column_title(2, TTRC("Format"));
vmem_tree->set_column_custom_minimum_width(2, 150 * EDSCALE); vmem_tree->set_column_custom_minimum_width(2, 150 * EDSCALE);
vmem_tree->set_column_expand(3, false); vmem_tree->set_column_expand(3, false);
vmem_tree->set_column_title(3, TTR("Usage")); vmem_tree->set_column_title(3, TTRC("Usage"));
vmem_tree->set_column_custom_minimum_width(3, 80 * EDSCALE); vmem_tree->set_column_custom_minimum_width(3, 80 * EDSCALE);
vmem_tree->set_hide_root(true); vmem_tree->set_hide_root(true);
vmem_tree->connect("item_activated", callable_mp(this, &ScriptEditorDebugger::_vmem_item_activated)); vmem_tree->connect("item_activated", callable_mp(this, &ScriptEditorDebugger::_vmem_item_activated));
@@ -2369,7 +2382,7 @@ Instead, use the monitors tab to obtain more precise VRAM usage.
{ // misc { // misc
VBoxContainer *misc = memnew(VBoxContainer); VBoxContainer *misc = memnew(VBoxContainer);
misc->set_name(TTR("Misc")); misc->set_name(TTRC("Misc"));
tabs->add_child(misc); tabs->add_child(misc);
GridContainer *info_left = memnew(GridContainer); GridContainer *info_left = memnew(GridContainer);
@@ -2379,12 +2392,12 @@ Instead, use the monitors tab to obtain more precise VRAM usage.
clicked_ctrl->set_editable(false); clicked_ctrl->set_editable(false);
clicked_ctrl->set_accessibility_name(TTRC("Clicked Control:")); clicked_ctrl->set_accessibility_name(TTRC("Clicked Control:"));
clicked_ctrl->set_h_size_flags(SIZE_EXPAND_FILL); clicked_ctrl->set_h_size_flags(SIZE_EXPAND_FILL);
info_left->add_child(memnew(Label(TTR("Clicked Control:")))); info_left->add_child(memnew(Label(TTRC("Clicked Control:"))));
info_left->add_child(clicked_ctrl); info_left->add_child(clicked_ctrl);
clicked_ctrl_type = memnew(LineEdit); clicked_ctrl_type = memnew(LineEdit);
clicked_ctrl_type->set_editable(false); clicked_ctrl_type->set_editable(false);
clicked_ctrl_type->set_accessibility_name(TTRC("Clicked Control Type:")); clicked_ctrl_type->set_accessibility_name(TTRC("Clicked Control Type:"));
info_left->add_child(memnew(Label(TTR("Clicked Control Type:")))); info_left->add_child(memnew(Label(TTRC("Clicked Control Type:"))));
info_left->add_child(clicked_ctrl_type); info_left->add_child(clicked_ctrl_type);
scene_tree = memnew(SceneDebuggerTree); scene_tree = memnew(SceneDebuggerTree);
@@ -2395,12 +2408,12 @@ Instead, use the monitors tab to obtain more precise VRAM usage.
{ {
HBoxContainer *lehb = memnew(HBoxContainer); HBoxContainer *lehb = memnew(HBoxContainer);
Label *l = memnew(Label(TTR("Live Edit Root:"))); Label *l = memnew(Label(TTRC("Live Edit Root:")));
info_left->add_child(l); info_left->add_child(l);
lehb->add_child(live_edit_root); lehb->add_child(live_edit_root);
le_set = memnew(Button(TTR("Set From Tree"))); le_set = memnew(Button(TTRC("Set From Tree")));
lehb->add_child(le_set); lehb->add_child(le_set);
le_clear = memnew(Button(TTR("Clear"))); le_clear = memnew(Button(TTRC("Clear")));
lehb->add_child(le_clear); lehb->add_child(le_clear);
info_left->add_child(lehb); info_left->add_child(lehb);
} }
@@ -2409,7 +2422,7 @@ Instead, use the monitors tab to obtain more precise VRAM usage.
HBoxContainer *buttons = memnew(HBoxContainer); HBoxContainer *buttons = memnew(HBoxContainer);
export_csv = memnew(Button(TTR("Export measures as CSV"))); export_csv = memnew(Button(TTRC("Export measures as CSV")));
export_csv->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::_export_csv)); export_csv->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::_export_csv));
buttons->add_child(export_csv); buttons->add_child(export_csv);

View File

@@ -46,6 +46,19 @@ void EditorNetworkProfiler::_bind_methods() {
void EditorNetworkProfiler::_notification(int p_what) { void EditorNetworkProfiler::_notification(int p_what) {
switch (p_what) { switch (p_what) {
case NOTIFICATION_TRANSLATION_CHANGED: {
// TRANSLATORS: This is the label for the network profiler's incoming bandwidth.
down_label->set_text(TTR("Down", "Network"));
// TRANSLATORS: This is the label for the network profiler's outgoing bandwidth.
up_label->set_text(TTR("Up", "Network"));
set_bandwidth(incoming_bandwidth, outgoing_bandwidth);
if (is_ready()) {
refresh_rpc_data();
}
} break;
case NOTIFICATION_THEME_CHANGED: { case NOTIFICATION_THEME_CHANGED: {
if (activate->is_pressed()) { if (activate->is_pressed()) {
activate->set_button_icon(theme_cache.stop_icon); activate->set_button_icon(theme_cache.stop_icon);
@@ -188,10 +201,10 @@ void EditorNetworkProfiler::_activate_pressed() {
void EditorNetworkProfiler::_update_button_text() { void EditorNetworkProfiler::_update_button_text() {
if (activate->is_pressed()) { if (activate->is_pressed()) {
activate->set_button_icon(theme_cache.stop_icon); activate->set_button_icon(theme_cache.stop_icon);
activate->set_text(TTR("Stop")); activate->set_text(TTRC("Stop"));
} else { } else {
activate->set_button_icon(theme_cache.play_icon); activate->set_button_icon(theme_cache.play_icon);
activate->set_text(TTR("Start")); activate->set_text(TTRC("Start"));
} }
} }
@@ -283,6 +296,9 @@ void EditorNetworkProfiler::add_sync_frame_data(const SyncInfo &p_frame) {
} }
void EditorNetworkProfiler::set_bandwidth(int p_incoming, int p_outgoing) { void EditorNetworkProfiler::set_bandwidth(int p_incoming, int p_outgoing) {
incoming_bandwidth = p_incoming;
outgoing_bandwidth = p_outgoing;
incoming_bandwidth_text->set_text(vformat(TTR("%s/s"), String::humanize_size(p_incoming))); incoming_bandwidth_text->set_text(vformat(TTR("%s/s"), String::humanize_size(p_incoming)));
outgoing_bandwidth_text->set_text(vformat(TTR("%s/s"), String::humanize_size(p_outgoing))); outgoing_bandwidth_text->set_text(vformat(TTR("%s/s"), String::humanize_size(p_outgoing)));
@@ -307,19 +323,19 @@ EditorNetworkProfiler::EditorNetworkProfiler() {
activate = memnew(Button); activate = memnew(Button);
activate->set_toggle_mode(true); activate->set_toggle_mode(true);
activate->set_text(TTR("Start")); activate->set_text(TTRC("Start"));
activate->set_disabled(true); activate->set_disabled(true);
activate->connect(SceneStringName(pressed), callable_mp(this, &EditorNetworkProfiler::_activate_pressed)); activate->connect(SceneStringName(pressed), callable_mp(this, &EditorNetworkProfiler::_activate_pressed));
container->add_child(activate); container->add_child(activate);
clear_button = memnew(Button); clear_button = memnew(Button);
clear_button->set_text(TTR("Clear")); clear_button->set_text(TTRC("Clear"));
clear_button->set_disabled(true); clear_button->set_disabled(true);
clear_button->connect(SceneStringName(pressed), callable_mp(this, &EditorNetworkProfiler::_clear_pressed)); clear_button->connect(SceneStringName(pressed), callable_mp(this, &EditorNetworkProfiler::_clear_pressed));
container->add_child(clear_button); container->add_child(clear_button);
CheckBox *autostart_checkbox = memnew(CheckBox); CheckBox *autostart_checkbox = memnew(CheckBox);
autostart_checkbox->set_text(TTR("Autostart")); autostart_checkbox->set_text(TTRC("Autostart"));
autostart_checkbox->set_pressed(EditorSettings::get_singleton()->get_project_metadata("debug_options", "autostart_network_profiler", false)); autostart_checkbox->set_pressed(EditorSettings::get_singleton()->get_project_metadata("debug_options", "autostart_network_profiler", false));
autostart_checkbox->connect(SceneStringName(toggled), callable_mp(this, &EditorNetworkProfiler::_autostart_toggled)); autostart_checkbox->connect(SceneStringName(toggled), callable_mp(this, &EditorNetworkProfiler::_autostart_toggled));
container->add_child(autostart_checkbox); container->add_child(autostart_checkbox);
@@ -332,11 +348,10 @@ EditorNetworkProfiler::EditorNetworkProfiler() {
hb->add_theme_constant_override(SNAME("separation"), 8 * EDSCALE); hb->add_theme_constant_override(SNAME("separation"), 8 * EDSCALE);
container->add_child(hb); container->add_child(hb);
Label *lb = memnew(Label); down_label = memnew(Label);
// TRANSLATORS: This is the label for the network profiler's incoming bandwidth. down_label->set_focus_mode(FOCUS_ACCESSIBILITY);
lb->set_focus_mode(FOCUS_ACCESSIBILITY); down_label->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
lb->set_text(TTR("Down", "Network")); hb->add_child(down_label);
hb->add_child(lb);
incoming_bandwidth_text = memnew(LineEdit); incoming_bandwidth_text = memnew(LineEdit);
incoming_bandwidth_text->set_editable(false); incoming_bandwidth_text->set_editable(false);
@@ -349,11 +364,10 @@ EditorNetworkProfiler::EditorNetworkProfiler() {
down_up_spacer->set_custom_minimum_size(Size2(30, 0) * EDSCALE); down_up_spacer->set_custom_minimum_size(Size2(30, 0) * EDSCALE);
hb->add_child(down_up_spacer); hb->add_child(down_up_spacer);
lb = memnew(Label); up_label = memnew(Label);
// TRANSLATORS: This is the label for the network profiler's outgoing bandwidth. up_label->set_focus_mode(FOCUS_ACCESSIBILITY);
lb->set_focus_mode(FOCUS_ACCESSIBILITY); up_label->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
lb->set_text(TTR("Up", "Network")); hb->add_child(up_label);
hb->add_child(lb);
outgoing_bandwidth_text = memnew(LineEdit); outgoing_bandwidth_text = memnew(LineEdit);
outgoing_bandwidth_text->set_editable(false); outgoing_bandwidth_text->set_editable(false);
@@ -362,9 +376,6 @@ EditorNetworkProfiler::EditorNetworkProfiler() {
outgoing_bandwidth_text->set_accessibility_name(TTRC("Outgoing Bandwidth")); outgoing_bandwidth_text->set_accessibility_name(TTRC("Outgoing Bandwidth"));
hb->add_child(outgoing_bandwidth_text); hb->add_child(outgoing_bandwidth_text);
// Set initial texts in the incoming/outgoing bandwidth labels
set_bandwidth(0, 0);
HSplitContainer *sc = memnew(HSplitContainer); HSplitContainer *sc = memnew(HSplitContainer);
add_child(sc); add_child(sc);
sc->set_v_size_flags(SIZE_EXPAND_FILL); sc->set_v_size_flags(SIZE_EXPAND_FILL);
@@ -380,15 +391,15 @@ EditorNetworkProfiler::EditorNetworkProfiler() {
counters_display->set_hide_root(true); counters_display->set_hide_root(true);
counters_display->set_columns(3); counters_display->set_columns(3);
counters_display->set_column_titles_visible(true); counters_display->set_column_titles_visible(true);
counters_display->set_column_title(0, TTR("Node")); counters_display->set_column_title(0, TTRC("Node"));
counters_display->set_column_expand(0, true); counters_display->set_column_expand(0, true);
counters_display->set_column_clip_content(0, true); counters_display->set_column_clip_content(0, true);
counters_display->set_column_custom_minimum_width(0, 60 * EDSCALE); counters_display->set_column_custom_minimum_width(0, 60 * EDSCALE);
counters_display->set_column_title(1, TTR("Incoming RPC")); counters_display->set_column_title(1, TTRC("Incoming RPC"));
counters_display->set_column_expand(1, false); counters_display->set_column_expand(1, false);
counters_display->set_column_clip_content(1, true); counters_display->set_column_clip_content(1, true);
counters_display->set_column_custom_minimum_width(1, 120 * EDSCALE); counters_display->set_column_custom_minimum_width(1, 120 * EDSCALE);
counters_display->set_column_title(2, TTR("Outgoing RPC")); counters_display->set_column_title(2, TTRC("Outgoing RPC"));
counters_display->set_column_expand(2, false); counters_display->set_column_expand(2, false);
counters_display->set_column_clip_content(2, true); counters_display->set_column_clip_content(2, true);
counters_display->set_column_custom_minimum_width(2, 120 * EDSCALE); counters_display->set_column_custom_minimum_width(2, 120 * EDSCALE);
@@ -403,23 +414,23 @@ EditorNetworkProfiler::EditorNetworkProfiler() {
replication_display->set_hide_root(true); replication_display->set_hide_root(true);
replication_display->set_columns(5); replication_display->set_columns(5);
replication_display->set_column_titles_visible(true); replication_display->set_column_titles_visible(true);
replication_display->set_column_title(0, TTR("Root")); replication_display->set_column_title(0, TTRC("Root"));
replication_display->set_column_expand(0, true); replication_display->set_column_expand(0, true);
replication_display->set_column_clip_content(0, true); replication_display->set_column_clip_content(0, true);
replication_display->set_column_custom_minimum_width(0, 80 * EDSCALE); replication_display->set_column_custom_minimum_width(0, 80 * EDSCALE);
replication_display->set_column_title(1, TTR("Synchronizer")); replication_display->set_column_title(1, TTRC("Synchronizer"));
replication_display->set_column_expand(1, true); replication_display->set_column_expand(1, true);
replication_display->set_column_clip_content(1, true); replication_display->set_column_clip_content(1, true);
replication_display->set_column_custom_minimum_width(1, 80 * EDSCALE); replication_display->set_column_custom_minimum_width(1, 80 * EDSCALE);
replication_display->set_column_title(2, TTR("Config")); replication_display->set_column_title(2, TTRC("Config"));
replication_display->set_column_expand(2, true); replication_display->set_column_expand(2, true);
replication_display->set_column_clip_content(2, true); replication_display->set_column_clip_content(2, true);
replication_display->set_column_custom_minimum_width(2, 80 * EDSCALE); replication_display->set_column_custom_minimum_width(2, 80 * EDSCALE);
replication_display->set_column_title(3, TTR("Count")); replication_display->set_column_title(3, TTRC("Count"));
replication_display->set_column_expand(3, false); replication_display->set_column_expand(3, false);
replication_display->set_column_clip_content(3, true); replication_display->set_column_clip_content(3, true);
replication_display->set_column_custom_minimum_width(3, 80 * EDSCALE); replication_display->set_column_custom_minimum_width(3, 80 * EDSCALE);
replication_display->set_column_title(4, TTR("Size")); replication_display->set_column_title(4, TTRC("Size"));
replication_display->set_column_expand(4, false); replication_display->set_column_expand(4, false);
replication_display->set_column_clip_content(4, true); replication_display->set_column_clip_content(4, true);
replication_display->set_column_custom_minimum_width(4, 80 * EDSCALE); replication_display->set_column_custom_minimum_width(4, 80 * EDSCALE);

View File

@@ -70,6 +70,12 @@ private:
LineEdit *outgoing_bandwidth_text = nullptr; LineEdit *outgoing_bandwidth_text = nullptr;
Tree *replication_display = nullptr; Tree *replication_display = nullptr;
Label *up_label = nullptr;
Label *down_label = nullptr;
int incoming_bandwidth = 0;
int outgoing_bandwidth = 0;
HashMap<ObjectID, RPCNodeInfo> rpc_data; HashMap<ObjectID, RPCNodeInfo> rpc_data;
HashMap<ObjectID, SyncInfo> sync_data; HashMap<ObjectID, SyncInfo> sync_data;
HashMap<ObjectID, NodeInfo> node_data; HashMap<ObjectID, NodeInfo> node_data;

View File

@@ -105,7 +105,7 @@ void MultiplayerEditorDebugger::setup_session(int p_session_id) {
EditorNetworkProfiler *profiler = memnew(EditorNetworkProfiler); EditorNetworkProfiler *profiler = memnew(EditorNetworkProfiler);
profiler->connect("enable_profiling", callable_mp(this, &MultiplayerEditorDebugger::_profiler_activate).bind(p_session_id)); profiler->connect("enable_profiling", callable_mp(this, &MultiplayerEditorDebugger::_profiler_activate).bind(p_session_id));
profiler->connect("open_request", callable_mp(this, &MultiplayerEditorDebugger::_open_request)); profiler->connect("open_request", callable_mp(this, &MultiplayerEditorDebugger::_open_request));
profiler->set_name(TTR("Network Profiler")); profiler->set_name(TTRC("Network Profiler"));
session->connect("started", callable_mp(profiler, &EditorNetworkProfiler::started)); session->connect("started", callable_mp(profiler, &EditorNetworkProfiler::started));
session->connect("stopped", callable_mp(profiler, &EditorNetworkProfiler::stopped)); session->connect("stopped", callable_mp(profiler, &EditorNetworkProfiler::stopped));
session->add_session_tab(profiler); session->add_session_tab(profiler);