2023-01-05 13:25:55 +01:00
|
|
|
/**************************************************************************/
|
|
|
|
/* editor_network_profiler.cpp */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* https://godotengine.org */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
|
|
|
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/**************************************************************************/
|
2019-09-01 18:38:58 +02:00
|
|
|
|
|
|
|
#include "editor_network_profiler.h"
|
|
|
|
|
|
|
|
#include "core/os/os.h"
|
2020-03-08 12:21:08 +01:00
|
|
|
#include "editor/editor_scale.h"
|
|
|
|
#include "editor/editor_settings.h"
|
2019-09-01 18:38:58 +02:00
|
|
|
|
|
|
|
void EditorNetworkProfiler::_bind_methods() {
|
|
|
|
ADD_SIGNAL(MethodInfo("enable_profiling", PropertyInfo(Variant::BOOL, "enable")));
|
2022-11-17 03:31:23 +01:00
|
|
|
ADD_SIGNAL(MethodInfo("open_request", PropertyInfo(Variant::STRING, "path")));
|
2019-09-01 18:38:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void EditorNetworkProfiler::_notification(int p_what) {
|
2022-02-16 00:52:32 +01:00
|
|
|
switch (p_what) {
|
2022-08-29 11:04:31 +02:00
|
|
|
case NOTIFICATION_ENTER_TREE:
|
2022-02-16 00:52:32 +01:00
|
|
|
case NOTIFICATION_THEME_CHANGED: {
|
2022-11-17 03:31:23 +01:00
|
|
|
node_icon = get_theme_icon(SNAME("Node"), SNAME("EditorIcons"));
|
|
|
|
if (activate->is_pressed()) {
|
|
|
|
activate->set_icon(get_theme_icon(SNAME("Stop"), SNAME("EditorIcons")));
|
|
|
|
} else {
|
|
|
|
activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons")));
|
|
|
|
}
|
2022-02-16 00:52:32 +01:00
|
|
|
clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")));
|
|
|
|
incoming_bandwidth_text->set_right_icon(get_theme_icon(SNAME("ArrowDown"), SNAME("EditorIcons")));
|
|
|
|
outgoing_bandwidth_text->set_right_icon(get_theme_icon(SNAME("ArrowUp"), SNAME("EditorIcons")));
|
|
|
|
|
|
|
|
// This needs to be done here to set the faded color when the profiler is first opened
|
|
|
|
incoming_bandwidth_text->add_theme_color_override("font_uneditable_color", get_theme_color(SNAME("font_color"), SNAME("Editor")) * Color(1, 1, 1, 0.5));
|
|
|
|
outgoing_bandwidth_text->add_theme_color_override("font_uneditable_color", get_theme_color(SNAME("font_color"), SNAME("Editor")) * Color(1, 1, 1, 0.5));
|
|
|
|
} break;
|
2019-09-01 18:38:58 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-17 03:31:23 +01:00
|
|
|
void EditorNetworkProfiler::_refresh() {
|
|
|
|
if (!dirty) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
dirty = false;
|
|
|
|
refresh_rpc_data();
|
|
|
|
refresh_replication_data();
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorNetworkProfiler::refresh_rpc_data() {
|
2019-09-01 18:38:58 +02:00
|
|
|
counters_display->clear();
|
|
|
|
|
|
|
|
TreeItem *root = counters_display->create_item();
|
2022-11-17 03:31:23 +01:00
|
|
|
int cols = counters_display->get_columns();
|
2019-09-01 18:38:58 +02:00
|
|
|
|
2022-11-17 03:31:23 +01:00
|
|
|
for (const KeyValue<ObjectID, RPCNodeInfo> &E : rpc_data) {
|
2019-09-01 18:38:58 +02:00
|
|
|
TreeItem *node = counters_display->create_item(root);
|
|
|
|
|
2022-11-17 03:31:23 +01:00
|
|
|
for (int j = 0; j < cols; ++j) {
|
2021-11-25 03:58:47 +01:00
|
|
|
node->set_text_alignment(j, j > 0 ? HORIZONTAL_ALIGNMENT_RIGHT : HORIZONTAL_ALIGNMENT_LEFT);
|
2019-09-01 18:38:58 +02:00
|
|
|
}
|
|
|
|
|
2021-08-09 22:13:42 +02:00
|
|
|
node->set_text(0, E.value.node_path);
|
2022-11-16 22:48:12 +01:00
|
|
|
node->set_text(1, E.value.incoming_rpc == 0 ? "-" : vformat(TTR("%d (%s)"), E.value.incoming_rpc, String::humanize_size(E.value.incoming_size)));
|
|
|
|
node->set_text(2, E.value.outgoing_rpc == 0 ? "-" : vformat(TTR("%d (%s)"), E.value.outgoing_rpc, String::humanize_size(E.value.outgoing_size)));
|
2019-09-01 18:38:58 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-17 03:31:23 +01:00
|
|
|
void EditorNetworkProfiler::refresh_replication_data() {
|
|
|
|
replication_display->clear();
|
|
|
|
|
|
|
|
TreeItem *root = replication_display->create_item();
|
|
|
|
|
|
|
|
for (const KeyValue<ObjectID, SyncInfo> &E : sync_data) {
|
|
|
|
// Ensure the nodes have at least a temporary cache.
|
|
|
|
ObjectID ids[3] = { E.value.synchronizer, E.value.config, E.value.root_node };
|
|
|
|
for (uint32_t i = 0; i < 3; i++) {
|
|
|
|
const ObjectID &id = ids[i];
|
|
|
|
if (!node_data.has(id)) {
|
|
|
|
missing_node_data.insert(id);
|
|
|
|
node_data[id] = NodeInfo(id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TreeItem *node = replication_display->create_item(root);
|
|
|
|
|
|
|
|
const NodeInfo &root_info = node_data[E.value.root_node];
|
|
|
|
const NodeInfo &sync_info = node_data[E.value.synchronizer];
|
|
|
|
const NodeInfo &cfg_info = node_data[E.value.config];
|
|
|
|
|
|
|
|
node->set_text(0, root_info.path.get_file());
|
|
|
|
node->set_icon(0, has_theme_icon(root_info.type, SNAME("EditorIcons")) ? get_theme_icon(root_info.type, SNAME("EditorIcons")) : node_icon);
|
|
|
|
node->set_tooltip_text(0, root_info.path);
|
|
|
|
|
|
|
|
node->set_text(1, sync_info.path.get_file());
|
|
|
|
node->set_icon(1, get_theme_icon("MultiplayerSynchronizer", SNAME("EditorIcons")));
|
|
|
|
node->set_tooltip_text(1, sync_info.path);
|
|
|
|
|
|
|
|
int cfg_idx = cfg_info.path.find("::");
|
|
|
|
if (cfg_info.path.begins_with("res://") && ResourceLoader::exists(cfg_info.path) && cfg_idx > 0) {
|
|
|
|
String res_idstr = cfg_info.path.substr(cfg_idx + 2).replace("SceneReplicationConfig_", "");
|
|
|
|
String scene_path = cfg_info.path.substr(0, cfg_idx);
|
|
|
|
node->set_text(2, vformat("%s (%s)", res_idstr, scene_path.get_file()));
|
|
|
|
node->add_button(2, get_theme_icon(SNAME("InstanceOptions"), SNAME("EditorIcons")));
|
|
|
|
node->set_tooltip_text(2, cfg_info.path);
|
|
|
|
node->set_metadata(2, scene_path);
|
|
|
|
} else {
|
|
|
|
node->set_text(2, cfg_info.path);
|
|
|
|
node->set_metadata(2, "");
|
|
|
|
}
|
|
|
|
|
|
|
|
node->set_text(3, vformat("%d - %d", E.value.incoming_syncs, E.value.outgoing_syncs));
|
|
|
|
node->set_text(4, vformat("%d - %d", E.value.incoming_size, E.value.outgoing_size));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Array EditorNetworkProfiler::pop_missing_node_data() {
|
|
|
|
Array out;
|
|
|
|
for (const ObjectID &id : missing_node_data) {
|
|
|
|
out.push_back(id);
|
|
|
|
}
|
|
|
|
missing_node_data.clear();
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorNetworkProfiler::add_node_data(const NodeInfo &p_info) {
|
|
|
|
ERR_FAIL_COND(!node_data.has(p_info.id));
|
|
|
|
node_data[p_info.id] = p_info;
|
|
|
|
dirty = true;
|
|
|
|
}
|
|
|
|
|
2019-09-01 18:38:58 +02:00
|
|
|
void EditorNetworkProfiler::_activate_pressed() {
|
|
|
|
if (activate->is_pressed()) {
|
2022-11-17 03:31:23 +01:00
|
|
|
refresh_timer->start();
|
2021-07-17 23:22:52 +02:00
|
|
|
activate->set_icon(get_theme_icon(SNAME("Stop"), SNAME("EditorIcons")));
|
2019-09-01 18:38:58 +02:00
|
|
|
activate->set_text(TTR("Stop"));
|
|
|
|
} else {
|
2022-11-17 03:31:23 +01:00
|
|
|
refresh_timer->stop();
|
2021-07-17 23:22:52 +02:00
|
|
|
activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons")));
|
2019-09-01 18:38:58 +02:00
|
|
|
activate->set_text(TTR("Start"));
|
|
|
|
}
|
2021-07-17 23:22:52 +02:00
|
|
|
emit_signal(SNAME("enable_profiling"), activate->is_pressed());
|
2019-09-01 18:38:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void EditorNetworkProfiler::_clear_pressed() {
|
2022-11-17 03:31:23 +01:00
|
|
|
rpc_data.clear();
|
|
|
|
sync_data.clear();
|
|
|
|
node_data.clear();
|
|
|
|
missing_node_data.clear();
|
2019-09-01 18:38:58 +02:00
|
|
|
set_bandwidth(0, 0);
|
2022-11-17 03:31:23 +01:00
|
|
|
refresh_rpc_data();
|
|
|
|
refresh_replication_data();
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorNetworkProfiler::_replication_button_clicked(TreeItem *p_item, int p_column, int p_idx, MouseButton p_button) {
|
|
|
|
if (!p_item) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
String meta = p_item->get_metadata(p_column);
|
|
|
|
if (meta.size() && ResourceLoader::exists(meta)) {
|
|
|
|
emit_signal("open_request", meta);
|
2019-09-01 18:38:58 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-17 03:31:23 +01:00
|
|
|
void EditorNetworkProfiler::add_rpc_frame_data(const RPCNodeInfo &p_frame) {
|
|
|
|
dirty = true;
|
|
|
|
if (!rpc_data.has(p_frame.node)) {
|
|
|
|
rpc_data.insert(p_frame.node, p_frame);
|
2019-09-01 18:38:58 +02:00
|
|
|
} else {
|
2022-11-17 03:31:23 +01:00
|
|
|
rpc_data[p_frame.node].incoming_rpc += p_frame.incoming_rpc;
|
|
|
|
rpc_data[p_frame.node].outgoing_rpc += p_frame.outgoing_rpc;
|
2019-09-01 18:38:58 +02:00
|
|
|
}
|
2022-11-16 22:48:12 +01:00
|
|
|
if (p_frame.incoming_rpc) {
|
2022-11-17 03:31:23 +01:00
|
|
|
rpc_data[p_frame.node].incoming_size = p_frame.incoming_size / p_frame.incoming_rpc;
|
2022-11-16 22:48:12 +01:00
|
|
|
}
|
|
|
|
if (p_frame.outgoing_rpc) {
|
2022-11-17 03:31:23 +01:00
|
|
|
rpc_data[p_frame.node].outgoing_size = p_frame.outgoing_size / p_frame.outgoing_rpc;
|
2022-11-16 22:48:12 +01:00
|
|
|
}
|
2022-11-17 03:31:23 +01:00
|
|
|
}
|
2019-09-01 18:38:58 +02:00
|
|
|
|
2022-11-17 03:31:23 +01:00
|
|
|
void EditorNetworkProfiler::add_sync_frame_data(const SyncInfo &p_frame) {
|
|
|
|
dirty = true;
|
|
|
|
if (!sync_data.has(p_frame.synchronizer)) {
|
|
|
|
sync_data[p_frame.synchronizer] = p_frame;
|
|
|
|
} else {
|
|
|
|
sync_data[p_frame.synchronizer].incoming_syncs += p_frame.incoming_syncs;
|
|
|
|
sync_data[p_frame.synchronizer].outgoing_syncs += p_frame.outgoing_syncs;
|
|
|
|
}
|
|
|
|
SyncInfo &info = sync_data[p_frame.synchronizer];
|
|
|
|
if (info.incoming_syncs) {
|
|
|
|
info.incoming_size = p_frame.incoming_size / p_frame.incoming_syncs;
|
|
|
|
}
|
|
|
|
if (info.outgoing_syncs) {
|
|
|
|
info.outgoing_size = p_frame.outgoing_size / p_frame.outgoing_syncs;
|
2019-09-01 18:38:58 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorNetworkProfiler::set_bandwidth(int p_incoming, int p_outgoing) {
|
2019-09-05 19:39:58 +02:00
|
|
|
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)));
|
2019-09-21 15:16:15 +02:00
|
|
|
|
|
|
|
// Make labels more prominent when the bandwidth is greater than 0 to attract user attention
|
2020-03-12 13:37:40 +01:00
|
|
|
incoming_bandwidth_text->add_theme_color_override(
|
2020-12-08 14:11:45 +01:00
|
|
|
"font_uneditable_color",
|
2021-07-17 23:22:52 +02:00
|
|
|
get_theme_color(SNAME("font_color"), SNAME("Editor")) * Color(1, 1, 1, p_incoming > 0 ? 1 : 0.5));
|
2020-03-12 13:37:40 +01:00
|
|
|
outgoing_bandwidth_text->add_theme_color_override(
|
2020-12-08 14:11:45 +01:00
|
|
|
"font_uneditable_color",
|
2021-07-17 23:22:52 +02:00
|
|
|
get_theme_color(SNAME("font_color"), SNAME("Editor")) * Color(1, 1, 1, p_outgoing > 0 ? 1 : 0.5));
|
2019-09-01 18:38:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool EditorNetworkProfiler::is_profiling() {
|
|
|
|
return activate->is_pressed();
|
|
|
|
}
|
|
|
|
|
|
|
|
EditorNetworkProfiler::EditorNetworkProfiler() {
|
|
|
|
HBoxContainer *hb = memnew(HBoxContainer);
|
2020-03-12 13:37:40 +01:00
|
|
|
hb->add_theme_constant_override("separation", 8 * EDSCALE);
|
2019-09-01 18:38:58 +02:00
|
|
|
add_child(hb);
|
|
|
|
|
|
|
|
activate = memnew(Button);
|
|
|
|
activate->set_toggle_mode(true);
|
|
|
|
activate->set_text(TTR("Start"));
|
2020-02-21 18:28:45 +01:00
|
|
|
activate->connect("pressed", callable_mp(this, &EditorNetworkProfiler::_activate_pressed));
|
2019-09-01 18:38:58 +02:00
|
|
|
hb->add_child(activate);
|
|
|
|
|
|
|
|
clear_button = memnew(Button);
|
|
|
|
clear_button->set_text(TTR("Clear"));
|
2020-02-21 18:28:45 +01:00
|
|
|
clear_button->connect("pressed", callable_mp(this, &EditorNetworkProfiler::_clear_pressed));
|
2019-09-01 18:38:58 +02:00
|
|
|
hb->add_child(clear_button);
|
|
|
|
|
|
|
|
hb->add_spacer();
|
|
|
|
|
|
|
|
Label *lb = memnew(Label);
|
2023-02-09 10:01:32 +01:00
|
|
|
// TRANSLATORS: This is the label for the network profiler's incoming bandwidth.
|
|
|
|
lb->set_text(TTR("Down", "Network"));
|
2019-09-01 18:38:58 +02:00
|
|
|
hb->add_child(lb);
|
|
|
|
|
|
|
|
incoming_bandwidth_text = memnew(LineEdit);
|
|
|
|
incoming_bandwidth_text->set_editable(false);
|
2019-09-21 15:16:15 +02:00
|
|
|
incoming_bandwidth_text->set_custom_minimum_size(Size2(120, 0) * EDSCALE);
|
2021-11-25 03:58:47 +01:00
|
|
|
incoming_bandwidth_text->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
|
2019-09-01 18:38:58 +02:00
|
|
|
hb->add_child(incoming_bandwidth_text);
|
|
|
|
|
2019-09-21 15:16:15 +02:00
|
|
|
Control *down_up_spacer = memnew(Control);
|
|
|
|
down_up_spacer->set_custom_minimum_size(Size2(30, 0) * EDSCALE);
|
|
|
|
hb->add_child(down_up_spacer);
|
|
|
|
|
2019-09-01 18:38:58 +02:00
|
|
|
lb = memnew(Label);
|
2023-02-09 10:01:32 +01:00
|
|
|
// TRANSLATORS: This is the label for the network profiler's outgoing bandwidth.
|
|
|
|
lb->set_text(TTR("Up", "Network"));
|
2019-09-01 18:38:58 +02:00
|
|
|
hb->add_child(lb);
|
|
|
|
|
|
|
|
outgoing_bandwidth_text = memnew(LineEdit);
|
|
|
|
outgoing_bandwidth_text->set_editable(false);
|
2019-09-21 15:16:15 +02:00
|
|
|
outgoing_bandwidth_text->set_custom_minimum_size(Size2(120, 0) * EDSCALE);
|
2021-11-25 03:58:47 +01:00
|
|
|
outgoing_bandwidth_text->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
|
2019-09-01 18:38:58 +02:00
|
|
|
hb->add_child(outgoing_bandwidth_text);
|
|
|
|
|
2019-09-21 15:16:15 +02:00
|
|
|
// Set initial texts in the incoming/outgoing bandwidth labels
|
|
|
|
set_bandwidth(0, 0);
|
|
|
|
|
2022-11-17 03:31:23 +01:00
|
|
|
HSplitContainer *sc = memnew(HSplitContainer);
|
|
|
|
add_child(sc);
|
|
|
|
sc->set_v_size_flags(SIZE_EXPAND_FILL);
|
|
|
|
sc->set_h_size_flags(SIZE_EXPAND_FILL);
|
|
|
|
sc->set_split_offset(100 * EDSCALE);
|
|
|
|
|
|
|
|
// RPC
|
2019-09-01 18:38:58 +02:00
|
|
|
counters_display = memnew(Tree);
|
2022-11-17 03:31:23 +01:00
|
|
|
counters_display->set_custom_minimum_size(Size2(320, 0) * EDSCALE);
|
2019-09-01 18:38:58 +02:00
|
|
|
counters_display->set_v_size_flags(SIZE_EXPAND_FILL);
|
2022-11-17 03:31:23 +01:00
|
|
|
counters_display->set_h_size_flags(SIZE_EXPAND_FILL);
|
2019-09-01 18:38:58 +02:00
|
|
|
counters_display->set_hide_folding(true);
|
|
|
|
counters_display->set_hide_root(true);
|
2022-02-06 02:29:08 +01:00
|
|
|
counters_display->set_columns(3);
|
2019-09-01 18:38:58 +02:00
|
|
|
counters_display->set_column_titles_visible(true);
|
|
|
|
counters_display->set_column_title(0, TTR("Node"));
|
|
|
|
counters_display->set_column_expand(0, true);
|
2021-07-04 05:13:28 +02:00
|
|
|
counters_display->set_column_clip_content(0, true);
|
2021-06-28 15:40:56 +02:00
|
|
|
counters_display->set_column_custom_minimum_width(0, 60 * EDSCALE);
|
2019-09-01 18:38:58 +02:00
|
|
|
counters_display->set_column_title(1, TTR("Incoming RPC"));
|
|
|
|
counters_display->set_column_expand(1, false);
|
2021-07-04 05:13:28 +02:00
|
|
|
counters_display->set_column_clip_content(1, true);
|
2021-06-28 15:40:56 +02:00
|
|
|
counters_display->set_column_custom_minimum_width(1, 120 * EDSCALE);
|
2022-02-06 02:29:08 +01:00
|
|
|
counters_display->set_column_title(2, TTR("Outgoing RPC"));
|
2019-09-01 18:38:58 +02:00
|
|
|
counters_display->set_column_expand(2, false);
|
2021-07-04 05:13:28 +02:00
|
|
|
counters_display->set_column_clip_content(2, true);
|
2021-06-28 15:40:56 +02:00
|
|
|
counters_display->set_column_custom_minimum_width(2, 120 * EDSCALE);
|
2022-11-17 03:31:23 +01:00
|
|
|
sc->add_child(counters_display);
|
|
|
|
|
|
|
|
// Replication
|
|
|
|
replication_display = memnew(Tree);
|
|
|
|
replication_display->set_custom_minimum_size(Size2(320, 0) * EDSCALE);
|
|
|
|
replication_display->set_v_size_flags(SIZE_EXPAND_FILL);
|
|
|
|
replication_display->set_h_size_flags(SIZE_EXPAND_FILL);
|
|
|
|
replication_display->set_hide_folding(true);
|
|
|
|
replication_display->set_hide_root(true);
|
|
|
|
replication_display->set_columns(5);
|
|
|
|
replication_display->set_column_titles_visible(true);
|
|
|
|
replication_display->set_column_title(0, TTR("Root"));
|
|
|
|
replication_display->set_column_expand(0, true);
|
|
|
|
replication_display->set_column_clip_content(0, true);
|
|
|
|
replication_display->set_column_custom_minimum_width(0, 80 * EDSCALE);
|
|
|
|
replication_display->set_column_title(1, TTR("Synchronizer"));
|
|
|
|
replication_display->set_column_expand(1, true);
|
|
|
|
replication_display->set_column_clip_content(1, true);
|
|
|
|
replication_display->set_column_custom_minimum_width(1, 80 * EDSCALE);
|
|
|
|
replication_display->set_column_title(2, TTR("Config"));
|
|
|
|
replication_display->set_column_expand(2, true);
|
|
|
|
replication_display->set_column_clip_content(2, true);
|
|
|
|
replication_display->set_column_custom_minimum_width(2, 80 * EDSCALE);
|
|
|
|
replication_display->set_column_title(3, TTR("Count"));
|
|
|
|
replication_display->set_column_expand(3, false);
|
|
|
|
replication_display->set_column_clip_content(3, true);
|
|
|
|
replication_display->set_column_custom_minimum_width(3, 80 * EDSCALE);
|
|
|
|
replication_display->set_column_title(4, TTR("Size"));
|
|
|
|
replication_display->set_column_expand(4, false);
|
|
|
|
replication_display->set_column_clip_content(4, true);
|
|
|
|
replication_display->set_column_custom_minimum_width(4, 80 * EDSCALE);
|
|
|
|
replication_display->connect("button_clicked", callable_mp(this, &EditorNetworkProfiler::_replication_button_clicked));
|
|
|
|
sc->add_child(replication_display);
|
2019-09-01 18:38:58 +02:00
|
|
|
|
2022-11-17 03:31:23 +01:00
|
|
|
refresh_timer = memnew(Timer);
|
|
|
|
refresh_timer->set_wait_time(0.5);
|
|
|
|
refresh_timer->connect("timeout", callable_mp(this, &EditorNetworkProfiler::_refresh));
|
|
|
|
add_child(refresh_timer);
|
2019-09-01 18:38:58 +02:00
|
|
|
}
|