Make performance monitor names translatable
This commit is contained in:
parent
557f63d037
commit
d33e79f299
|
@ -31,6 +31,7 @@
|
||||||
#include "editor_performance_profiler.h"
|
#include "editor_performance_profiler.h"
|
||||||
|
|
||||||
#include "editor/editor_property_name_processor.h"
|
#include "editor/editor_property_name_processor.h"
|
||||||
|
#include "editor/editor_settings.h"
|
||||||
#include "editor/editor_string_names.h"
|
#include "editor/editor_string_names.h"
|
||||||
#include "editor/themes/editor_scale.h"
|
#include "editor/themes/editor_scale.h"
|
||||||
#include "editor/themes/editor_theme_manager.h"
|
#include "editor/themes/editor_theme_manager.h"
|
||||||
|
@ -231,7 +232,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, p_base_name);
|
base->set_text(0, EditorPropertyNameProcessor::get_singleton()->process_name(p_base_name, EditorPropertyNameProcessor::get_settings_style()));
|
||||||
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);
|
||||||
|
@ -248,7 +249,7 @@ TreeItem *EditorPerformanceProfiler::_create_monitor_item(const StringName &p_mo
|
||||||
item->set_editable(0, true);
|
item->set_editable(0, true);
|
||||||
item->set_selectable(0, false);
|
item->set_selectable(0, false);
|
||||||
item->set_selectable(1, false);
|
item->set_selectable(1, false);
|
||||||
item->set_text(0, p_monitor_name);
|
item->set_text(0, EditorPropertyNameProcessor::get_singleton()->process_name(p_monitor_name, EditorPropertyNameProcessor::get_settings_style()));
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,6 +379,12 @@ void EditorPerformanceProfiler::_notification(int p_what) {
|
||||||
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)));
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||||
|
if (EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/localize_settings")) {
|
||||||
|
_build_monitor_tree();
|
||||||
|
}
|
||||||
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,6 +393,7 @@ EditorPerformanceProfiler::EditorPerformanceProfiler() {
|
||||||
set_split_offset(340 * EDSCALE);
|
set_split_offset(340 * EDSCALE);
|
||||||
|
|
||||||
monitor_tree = memnew(Tree);
|
monitor_tree = memnew(Tree);
|
||||||
|
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, TTR("Monitor"));
|
||||||
monitor_tree->set_column_title(1, TTR("Value"));
|
monitor_tree->set_column_title(1, TTR("Value"));
|
||||||
|
@ -411,9 +419,11 @@ EditorPerformanceProfiler::EditorPerformanceProfiler() {
|
||||||
monitor_draw->add_child(info_message);
|
monitor_draw->add_child(info_message);
|
||||||
|
|
||||||
for (int i = 0; i < Performance::MONITOR_MAX; i++) {
|
for (int i = 0; i < Performance::MONITOR_MAX; i++) {
|
||||||
String base = EditorPropertyNameProcessor::get_singleton()->process_name(Performance::get_singleton()->get_monitor_name(Performance::Monitor(i)).get_slicec('/', 0), EditorPropertyNameProcessor::STYLE_CAPITALIZED);
|
const Performance::Monitor monitor = Performance::Monitor(i);
|
||||||
String name = EditorPropertyNameProcessor::get_singleton()->process_name(Performance::get_singleton()->get_monitor_name(Performance::Monitor(i)).get_slicec('/', 1), EditorPropertyNameProcessor::STYLE_CAPITALIZED);
|
const String path = Performance::get_singleton()->get_monitor_name(monitor);
|
||||||
monitors.insert(Performance::get_singleton()->get_monitor_name(Performance::Monitor(i)), Monitor(name, base, i, Performance::get_singleton()->get_monitor_type(Performance::Monitor(i)), nullptr));
|
const String base = path.get_slicec('/', 0);
|
||||||
|
const String name = path.get_slicec('/', 1);
|
||||||
|
monitors.insert(path, Monitor(name, base, i, Performance::get_singleton()->get_monitor_type(monitor), nullptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
_build_monitor_tree();
|
_build_monitor_tree();
|
||||||
|
|
|
@ -106,41 +106,41 @@ int Performance::_get_node_count() const {
|
||||||
String Performance::get_monitor_name(Monitor p_monitor) const {
|
String Performance::get_monitor_name(Monitor p_monitor) const {
|
||||||
ERR_FAIL_INDEX_V(p_monitor, MONITOR_MAX, String());
|
ERR_FAIL_INDEX_V(p_monitor, MONITOR_MAX, String());
|
||||||
static const char *names[MONITOR_MAX] = {
|
static const char *names[MONITOR_MAX] = {
|
||||||
"time/fps",
|
PNAME("time/fps"),
|
||||||
"time/process",
|
PNAME("time/process"),
|
||||||
"time/physics_process",
|
PNAME("time/physics_process"),
|
||||||
"time/navigation_process",
|
PNAME("time/navigation_process"),
|
||||||
"memory/static",
|
PNAME("memory/static"),
|
||||||
"memory/static_max",
|
PNAME("memory/static_max"),
|
||||||
"memory/msg_buf_max",
|
PNAME("memory/msg_buf_max"),
|
||||||
"object/objects",
|
PNAME("object/objects"),
|
||||||
"object/resources",
|
PNAME("object/resources"),
|
||||||
"object/nodes",
|
PNAME("object/nodes"),
|
||||||
"object/orphan_nodes",
|
PNAME("object/orphan_nodes"),
|
||||||
"raster/total_objects_drawn",
|
PNAME("raster/total_objects_drawn"),
|
||||||
"raster/total_primitives_drawn",
|
PNAME("raster/total_primitives_drawn"),
|
||||||
"raster/total_draw_calls",
|
PNAME("raster/total_draw_calls"),
|
||||||
"video/video_mem",
|
PNAME("video/video_mem"),
|
||||||
"video/texture_mem",
|
PNAME("video/texture_mem"),
|
||||||
"video/buffer_mem",
|
PNAME("video/buffer_mem"),
|
||||||
"physics_2d/active_objects",
|
PNAME("physics_2d/active_objects"),
|
||||||
"physics_2d/collision_pairs",
|
PNAME("physics_2d/collision_pairs"),
|
||||||
"physics_2d/islands",
|
PNAME("physics_2d/islands"),
|
||||||
#ifndef _3D_DISABLED
|
#ifndef _3D_DISABLED
|
||||||
"physics_3d/active_objects",
|
PNAME("physics_3d/active_objects"),
|
||||||
"physics_3d/collision_pairs",
|
PNAME("physics_3d/collision_pairs"),
|
||||||
"physics_3d/islands",
|
PNAME("physics_3d/islands"),
|
||||||
#endif // _3D_DISABLED
|
#endif // _3D_DISABLED
|
||||||
"audio/driver/output_latency",
|
PNAME("audio/driver/output_latency"),
|
||||||
"navigation/active_maps",
|
PNAME("navigation/active_maps"),
|
||||||
"navigation/regions",
|
PNAME("navigation/regions"),
|
||||||
"navigation/agents",
|
PNAME("navigation/agents"),
|
||||||
"navigation/links",
|
PNAME("navigation/links"),
|
||||||
"navigation/polygons",
|
PNAME("navigation/polygons"),
|
||||||
"navigation/edges",
|
PNAME("navigation/edges"),
|
||||||
"navigation/edges_merged",
|
PNAME("navigation/edges_merged"),
|
||||||
"navigation/edges_connected",
|
PNAME("navigation/edges_connected"),
|
||||||
"navigation/edges_free",
|
PNAME("navigation/edges_free"),
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue