summaryrefslogtreecommitdiff
path: root/editor/script_editor_debugger.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/script_editor_debugger.cpp')
-rw-r--r--editor/script_editor_debugger.cpp78
1 files changed, 75 insertions, 3 deletions
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index fc5aecdbe9..6ee09012a5 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -33,6 +33,7 @@
#include "core/io/marshalls.h"
#include "core/project_settings.h"
#include "core/ustring.h"
+#include "editor_network_profiler.h"
#include "editor_node.h"
#include "editor_profiler.h"
#include "editor_settings.h"
@@ -201,6 +202,21 @@ void ScriptEditorDebugger::debug_copy() {
OS::get_singleton()->set_clipboard(msg);
}
+void ScriptEditorDebugger::debug_skip_breakpoints() {
+ skip_breakpoints_value = !skip_breakpoints_value;
+ if (skip_breakpoints_value)
+ skip_breakpoints->set_icon(get_icon("DebugSkipBreakpointsOn", "EditorIcons"));
+ else
+ skip_breakpoints->set_icon(get_icon("DebugSkipBreakpointsOff", "EditorIcons"));
+
+ if (connection.is_valid()) {
+ Array msg;
+ msg.push_back("set_skip_breakpoints");
+ msg.push_back(skip_breakpoints_value);
+ ppeer->put_var(msg);
+ }
+}
+
void ScriptEditorDebugger::debug_next() {
ERR_FAIL_COND(!breaked);
@@ -977,7 +993,20 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
profiler->add_frame_metric(metric, false);
else
profiler->add_frame_metric(metric, true);
-
+ } else if (p_msg == "network_profile") {
+ int frame_size = 6;
+ for (int i = 0; i < p_data.size(); i += frame_size) {
+ MultiplayerAPI::ProfilingInfo pi;
+ pi.node = p_data[i + 0];
+ pi.node_path = p_data[i + 1];
+ pi.incoming_rpc = p_data[i + 2];
+ pi.incoming_rset = p_data[i + 3];
+ pi.outgoing_rpc = p_data[i + 4];
+ pi.outgoing_rset = p_data[i + 5];
+ network_profiler->add_node_frame_data(pi);
+ }
+ } else if (p_msg == "network_bandwidth") {
+ network_profiler->set_bandwidth(p_data[0], p_data[1]);
} else if (p_msg == "kill_me") {
editor->call_deferred("stop_child_process");
@@ -1083,7 +1112,7 @@ void ScriptEditorDebugger::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
inspector->edit(variables);
-
+ skip_breakpoints->set_icon(get_icon("DebugSkipBreakpointsOff", "EditorIcons"));
copy->set_icon(get_icon("ActionCopy", "EditorIcons"));
step->set_icon(get_icon("DebugStep", "EditorIcons"));
@@ -1193,6 +1222,10 @@ void ScriptEditorDebugger::_notification(int p_what) {
if (profiler->is_profiling()) {
_profiler_activate(true);
}
+
+ if (network_profiler->is_profiling()) {
+ _network_profiler_activate(true);
+ }
}
}
@@ -1376,7 +1409,7 @@ void ScriptEditorDebugger::stop() {
profiler->set_enabled(true);
inspect_scene_tree->clear();
- EditorNode::get_singleton()->edit_current();
+ inspector->edit(NULL);
EditorNode::get_singleton()->get_pause_button()->set_pressed(false);
EditorNode::get_singleton()->get_pause_button()->set_disabled(true);
EditorNode::get_singleton()->get_scene_tree_dock()->hide_remote_tree();
@@ -1412,6 +1445,25 @@ void ScriptEditorDebugger::_profiler_activate(bool p_enable) {
}
}
+void ScriptEditorDebugger::_network_profiler_activate(bool p_enable) {
+
+ if (!connection.is_valid())
+ return;
+
+ if (p_enable) {
+ Array msg;
+ msg.push_back("start_network_profiling");
+ ppeer->put_var(msg);
+ print_verbose("Starting network profiling.");
+
+ } else {
+ Array msg;
+ msg.push_back("stop_network_profiling");
+ ppeer->put_var(msg);
+ print_verbose("Ending network profiling.");
+ }
+}
+
void ScriptEditorDebugger::_profiler_seeked() {
if (!connection.is_valid() || !connection->is_connected_to_host())
@@ -1785,6 +1837,10 @@ void ScriptEditorDebugger::reload_scripts() {
}
}
+bool ScriptEditorDebugger::is_skip_breakpoints() {
+ return skip_breakpoints_value;
+}
+
void ScriptEditorDebugger::_error_activated() {
TreeItem *selected = error_tree->get_selected();
@@ -1980,6 +2036,7 @@ void ScriptEditorDebugger::_bind_methods() {
ClassDB::bind_method(D_METHOD("_stack_dump_frame_selected"), &ScriptEditorDebugger::_stack_dump_frame_selected);
+ ClassDB::bind_method(D_METHOD("debug_skip_breakpoints"), &ScriptEditorDebugger::debug_skip_breakpoints);
ClassDB::bind_method(D_METHOD("debug_copy"), &ScriptEditorDebugger::debug_copy);
ClassDB::bind_method(D_METHOD("debug_next"), &ScriptEditorDebugger::debug_next);
@@ -2000,6 +2057,7 @@ void ScriptEditorDebugger::_bind_methods() {
ClassDB::bind_method(D_METHOD("_expand_errors_list"), &ScriptEditorDebugger::_expand_errors_list);
ClassDB::bind_method(D_METHOD("_collapse_errors_list"), &ScriptEditorDebugger::_collapse_errors_list);
ClassDB::bind_method(D_METHOD("_profiler_activate"), &ScriptEditorDebugger::_profiler_activate);
+ ClassDB::bind_method(D_METHOD("_network_profiler_activate"), &ScriptEditorDebugger::_network_profiler_activate);
ClassDB::bind_method(D_METHOD("_profiler_seeked"), &ScriptEditorDebugger::_profiler_seeked);
ClassDB::bind_method(D_METHOD("_clear_errors_list"), &ScriptEditorDebugger::_clear_errors_list);
@@ -2067,6 +2125,13 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
hbc->add_child(memnew(VSeparator));
+ skip_breakpoints = memnew(ToolButton);
+ hbc->add_child(skip_breakpoints);
+ skip_breakpoints->set_tooltip(TTR("Skip Breakpoints"));
+ skip_breakpoints->connect("pressed", this, "debug_skip_breakpoints");
+
+ hbc->add_child(memnew(VSeparator));
+
copy = memnew(ToolButton);
hbc->add_child(copy);
copy->set_tooltip(TTR("Copy Error"));
@@ -2218,6 +2283,13 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
profiler->connect("break_request", this, "_profiler_seeked");
}
+ { //network profiler
+ network_profiler = memnew(EditorNetworkProfiler);
+ network_profiler->set_name(TTR("Network Profiler"));
+ tabs->add_child(network_profiler);
+ network_profiler->connect("enable_profiling", this, "_network_profiler_activate");
+ }
+
{ //monitors
HSplitContainer *hsp = memnew(HSplitContainer);