feat: updated engine version to 4.4-rc1

This commit is contained in:
Sara 2025-02-23 14:38:14 +01:00
parent ee00efde1f
commit 21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions

View file

@ -30,10 +30,11 @@
#include "editor_network_profiler.h"
#include "core/os/os.h"
#include "editor/editor_settings.h"
#include "editor/editor_string_names.h"
#include "editor/gui/editor_run_bar.h"
#include "editor/themes/editor_scale.h"
#include "scene/gui/check_box.h"
void EditorNetworkProfiler::_bind_methods() {
ADD_SIGNAL(MethodInfo("enable_profiling", PropertyInfo(Variant::BOOL, "enable")));
@ -44,11 +45,11 @@ void EditorNetworkProfiler::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_THEME_CHANGED: {
if (activate->is_pressed()) {
activate->set_icon(theme_cache.stop_icon);
activate->set_button_icon(theme_cache.stop_icon);
} else {
activate->set_icon(theme_cache.play_icon);
activate->set_button_icon(theme_cache.play_icon);
}
clear_button->set_icon(theme_cache.clear_icon);
clear_button->set_button_icon(theme_cache.clear_icon);
incoming_bandwidth_text->set_right_icon(theme_cache.incoming_bandwidth_icon);
outgoing_bandwidth_text->set_right_icon(theme_cache.outgoing_bandwidth_icon);
@ -170,15 +171,46 @@ void EditorNetworkProfiler::add_node_data(const NodeInfo &p_info) {
}
void EditorNetworkProfiler::_activate_pressed() {
_update_button_text();
if (activate->is_pressed()) {
refresh_timer->start();
activate->set_icon(theme_cache.stop_icon);
activate->set_text(TTR("Stop"));
} else {
refresh_timer->stop();
activate->set_icon(theme_cache.play_icon);
}
emit_signal(SNAME("enable_profiling"), activate->is_pressed());
}
void EditorNetworkProfiler::_update_button_text() {
if (activate->is_pressed()) {
activate->set_button_icon(theme_cache.stop_icon);
activate->set_text(TTR("Stop"));
} else {
activate->set_button_icon(theme_cache.play_icon);
activate->set_text(TTR("Start"));
}
}
void EditorNetworkProfiler::started() {
_clear_pressed();
activate->set_disabled(false);
if (EditorSettings::get_singleton()->get_project_metadata("debug_options", "autostart_network_profiler", false)) {
set_profiling(true);
refresh_timer->start();
}
}
void EditorNetworkProfiler::stopped() {
activate->set_disabled(true);
set_profiling(false);
refresh_timer->stop();
}
void EditorNetworkProfiler::set_profiling(bool p_pressed) {
activate->set_pressed(p_pressed);
_update_button_text();
emit_signal(SNAME("enable_profiling"), activate->is_pressed());
}
@ -190,6 +222,12 @@ void EditorNetworkProfiler::_clear_pressed() {
set_bandwidth(0, 0);
refresh_rpc_data();
refresh_replication_data();
clear_button->set_disabled(true);
}
void EditorNetworkProfiler::_autostart_toggled(bool p_toggled_on) {
EditorSettings::get_singleton()->set_project_metadata("debug_options", "autostart_network_profiler", p_toggled_on);
EditorRunBar::get_singleton()->update_profiler_autostart_indicator();
}
void EditorNetworkProfiler::_replication_button_clicked(TreeItem *p_item, int p_column, int p_idx, MouseButton p_button) {
@ -203,6 +241,9 @@ void EditorNetworkProfiler::_replication_button_clicked(TreeItem *p_item, int p_
}
void EditorNetworkProfiler::add_rpc_frame_data(const RPCNodeInfo &p_frame) {
if (clear_button->is_disabled()) {
clear_button->set_disabled(false);
}
dirty = true;
if (!rpc_data.has(p_frame.node)) {
rpc_data.insert(p_frame.node, p_frame);
@ -219,6 +260,9 @@ void EditorNetworkProfiler::add_rpc_frame_data(const RPCNodeInfo &p_frame) {
}
void EditorNetworkProfiler::add_sync_frame_data(const SyncInfo &p_frame) {
if (clear_button->is_disabled()) {
clear_button->set_disabled(false);
}
dirty = true;
if (!sync_data.has(p_frame.synchronizer)) {
sync_data[p_frame.synchronizer] = p_frame;
@ -227,10 +271,10 @@ void EditorNetworkProfiler::add_sync_frame_data(const SyncInfo &p_frame) {
sync_data[p_frame.synchronizer].outgoing_syncs += p_frame.outgoing_syncs;
}
SyncInfo &info = sync_data[p_frame.synchronizer];
if (info.incoming_syncs) {
if (p_frame.incoming_syncs) {
info.incoming_size = p_frame.incoming_size / p_frame.incoming_syncs;
}
if (info.outgoing_syncs) {
if (p_frame.outgoing_syncs) {
info.outgoing_size = p_frame.outgoing_size / p_frame.outgoing_syncs;
}
}
@ -260,14 +304,22 @@ EditorNetworkProfiler::EditorNetworkProfiler() {
activate = memnew(Button);
activate->set_toggle_mode(true);
activate->set_text(TTR("Start"));
activate->set_disabled(true);
activate->connect(SceneStringName(pressed), callable_mp(this, &EditorNetworkProfiler::_activate_pressed));
hb->add_child(activate);
clear_button = memnew(Button);
clear_button->set_text(TTR("Clear"));
clear_button->set_disabled(true);
clear_button->connect(SceneStringName(pressed), callable_mp(this, &EditorNetworkProfiler::_clear_pressed));
hb->add_child(clear_button);
CheckBox *autostart_checkbox = memnew(CheckBox);
autostart_checkbox->set_text(TTR("Autostart"));
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));
hb->add_child(autostart_checkbox);
hb->add_spacer();
Label *lb = memnew(Label);

View file

@ -92,7 +92,9 @@ private:
void _activate_pressed();
void _clear_pressed();
void _autostart_toggled(bool p_toggled_on);
void _refresh();
void _update_button_text();
void _replication_button_clicked(TreeItem *p_item, int p_column, int p_idx, MouseButton p_button);
protected:
@ -112,6 +114,10 @@ public:
void set_bandwidth(int p_incoming, int p_outgoing);
bool is_profiling();
void set_profiling(bool p_pressed);
void started();
void stopped();
EditorNetworkProfiler();
};

View file

@ -106,6 +106,8 @@ void MultiplayerEditorDebugger::setup_session(int 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->set_name(TTR("Network Profiler"));
session->connect("started", callable_mp(profiler, &EditorNetworkProfiler::started));
session->connect("stopped", callable_mp(profiler, &EditorNetworkProfiler::stopped));
session->add_session_tab(profiler);
profilers[p_session_id] = profiler;
}
@ -114,7 +116,7 @@ void MultiplayerEditorDebugger::setup_session(int p_session_id) {
MultiplayerEditorPlugin::MultiplayerEditorPlugin() {
repl_editor = memnew(ReplicationEditor);
button = EditorNode::get_bottom_panel()->add_item(TTR("Replication"), repl_editor, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_replication_bottom_panel", TTR("Toggle Replication Bottom Panel")));
button = EditorNode::get_bottom_panel()->add_item(TTR("Replication"), repl_editor, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_replication_bottom_panel", TTRC("Toggle Replication Bottom Panel")));
button->hide();
repl_editor->get_pin()->connect(SceneStringName(pressed), callable_mp(this, &MultiplayerEditorPlugin::_pinned));
debugger.instantiate();

View file

@ -37,7 +37,6 @@
#include "editor/editor_string_names.h"
#include "editor/editor_undo_redo_manager.h"
#include "editor/gui/scene_tree_editor.h"
#include "editor/inspector_dock.h"
#include "editor/property_selector.h"
#include "editor/themes/editor_scale.h"
#include "editor/themes/editor_theme_manager.h"
@ -93,24 +92,6 @@ void ReplicationEditor::_pick_node_select_recursive(TreeItem *p_item, const Stri
}
}
void ReplicationEditor::_pick_node_filter_input(const Ref<InputEvent> &p_ie) {
Ref<InputEventKey> k = p_ie;
if (k.is_valid()) {
switch (k->get_keycode()) {
case Key::UP:
case Key::DOWN:
case Key::PAGEUP:
case Key::PAGEDOWN: {
pick_node->get_scene_tree()->get_scene_tree()->gui_input(k);
pick_node->get_filter_line_edit()->accept_event();
} break;
default:
break;
}
}
}
void ReplicationEditor::_pick_node_selected(NodePath p_path) {
Node *root = current->get_node(current->get_root_path());
ERR_FAIL_NULL(root);
@ -184,11 +165,9 @@ ReplicationEditor::ReplicationEditor() {
pick_node = memnew(SceneTreeDialog);
add_child(pick_node);
pick_node->register_text_enter(pick_node->get_filter_line_edit());
pick_node->set_title(TTR("Pick a node to synchronize:"));
pick_node->connect("selected", callable_mp(this, &ReplicationEditor::_pick_node_selected));
pick_node->get_filter_line_edit()->connect(SceneStringName(text_changed), callable_mp(this, &ReplicationEditor::_pick_node_filter_text_changed));
pick_node->get_filter_line_edit()->connect("gui_input", callable_mp(this, &ReplicationEditor::_pick_node_filter_input));
prop_selector = memnew(PropertySelector);
add_child(prop_selector);
@ -256,7 +235,7 @@ ReplicationEditor::ReplicationEditor() {
np_line_edit = memnew(LineEdit);
np_line_edit->set_placeholder(":property");
np_line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
np_line_edit->connect("text_submitted", callable_mp(this, &ReplicationEditor::_np_text_submitted));
np_line_edit->connect(SceneStringName(text_submitted), callable_mp(this, &ReplicationEditor::_np_text_submitted));
hb->add_child(np_line_edit);
add_from_path_button = memnew(Button);
@ -269,7 +248,7 @@ ReplicationEditor::ReplicationEditor() {
hb->add_child(vs);
pin = memnew(Button);
pin->set_theme_type_variation("FlatButton");
pin->set_theme_type_variation(SceneStringName(FlatButton));
pin->set_toggle_mode(true);
pin->set_tooltip_text(TTR("Pin replication editor"));
hb->add_child(pin);
@ -373,8 +352,8 @@ void ReplicationEditor::_notification(int p_what) {
}
case NOTIFICATION_ENTER_TREE: {
add_theme_style_override(SceneStringName(panel), EditorNode::get_singleton()->get_editor_theme()->get_stylebox(SceneStringName(panel), SNAME("Panel")));
add_pick_button->set_icon(get_theme_icon(SNAME("Add"), EditorStringName(EditorIcons)));
pin->set_icon(get_theme_icon(SNAME("Pin"), EditorStringName(EditorIcons)));
add_pick_button->set_button_icon(get_theme_icon(SNAME("Add"), EditorStringName(EditorIcons)));
pin->set_button_icon(get_theme_icon(SNAME("Pin"), EditorStringName(EditorIcons)));
} break;
}
}
@ -395,7 +374,7 @@ void ReplicationEditor::_add_pressed() {
return;
}
int idx = np_text.find(":");
int idx = np_text.find_char(':');
if (idx == -1) {
np_text = ".:" + np_text;
} else if (idx == 0) {
@ -511,7 +490,7 @@ void ReplicationEditor::_update_config() {
tree->clear();
tree->create_item();
drop_label->set_visible(true);
if (!config.is_valid()) {
if (config.is_null()) {
return;
}
TypedArray<NodePath> props = config->get_properties();
@ -574,7 +553,7 @@ void ReplicationEditor::_add_property(const NodePath &p_property, bool p_spawn,
Node *root_node = current && !current->get_root_path().is_empty() ? current->get_node(current->get_root_path()) : nullptr;
Ref<Texture2D> icon = _get_class_icon(root_node);
if (root_node) {
String path = prop.substr(0, prop.find(":"));
String path = prop.substr(0, prop.find_char(':'));
String subpath = prop.substr(path.size());
Node *node = root_node->get_node_or_null(path);
if (!node) {

View file

@ -81,7 +81,6 @@ private:
void _pick_node_filter_text_changed(const String &p_newtext);
void _pick_node_select_recursive(TreeItem *p_item, const String &p_filter, Vector<Node *> &p_select_candidates);
void _pick_node_filter_input(const Ref<InputEvent> &p_ie);
void _pick_node_selected(NodePath p_path);
void _pick_new_property();