summaryrefslogtreecommitdiff
path: root/editor/debugger
diff options
context:
space:
mode:
Diffstat (limited to 'editor/debugger')
-rw-r--r--editor/debugger/debug_adapter/debug_adapter_protocol.cpp32
-rw-r--r--editor/debugger/debug_adapter/debug_adapter_protocol.h8
-rw-r--r--editor/debugger/editor_debugger_inspector.cpp6
-rw-r--r--editor/debugger/editor_debugger_inspector.h4
-rw-r--r--editor/debugger/editor_debugger_node.cpp23
-rw-r--r--editor/debugger/editor_debugger_node.h4
-rw-r--r--editor/debugger/editor_network_profiler.h12
-rw-r--r--editor/debugger/editor_performance_profiler.cpp5
-rw-r--r--editor/debugger/editor_performance_profiler.h8
-rw-r--r--editor/debugger/editor_profiler.cpp9
-rw-r--r--editor/debugger/editor_profiler.h36
-rw-r--r--editor/debugger/editor_visual_profiler.cpp72
-rw-r--r--editor/debugger/editor_visual_profiler.h39
-rw-r--r--editor/debugger/script_editor_debugger.cpp66
-rw-r--r--editor/debugger/script_editor_debugger.h80
15 files changed, 200 insertions, 204 deletions
diff --git a/editor/debugger/debug_adapter/debug_adapter_protocol.cpp b/editor/debugger/debug_adapter/debug_adapter_protocol.cpp
index babe8af8bc..fea4c2b156 100644
--- a/editor/debugger/debug_adapter/debug_adapter_protocol.cpp
+++ b/editor/debugger/debug_adapter/debug_adapter_protocol.cpp
@@ -268,12 +268,12 @@ int DebugAdapterProtocol::parse_variant(const Variant &p_var) {
x.type = type_vec2;
y.type = type_vec2;
origin.type = type_vec2;
- x.value = transform.elements[0];
- y.value = transform.elements[1];
- origin.value = transform.elements[2];
- x.variablesReference = parse_variant(transform.elements[0]);
- y.variablesReference = parse_variant(transform.elements[1]);
- origin.variablesReference = parse_variant(transform.elements[2]);
+ x.value = transform.columns[0];
+ y.value = transform.columns[1];
+ origin.value = transform.columns[2];
+ x.variablesReference = parse_variant(transform.columns[0]);
+ y.variablesReference = parse_variant(transform.columns[1]);
+ origin.variablesReference = parse_variant(transform.columns[2]);
Array arr;
arr.push_back(x.to_json());
@@ -349,20 +349,20 @@ int DebugAdapterProtocol::parse_variant(const Variant &p_var) {
case Variant::BASIS: {
int id = variable_id++;
Basis basis = p_var;
- const String type_vec2 = Variant::get_type_name(Variant::VECTOR2);
+ const String type_vec3 = Variant::get_type_name(Variant::VECTOR3);
DAP::Variable x, y, z;
x.name = "x";
y.name = "y";
z.name = "z";
- x.type = type_vec2;
- y.type = type_vec2;
- z.type = type_vec2;
- x.value = basis.elements[0];
- y.value = basis.elements[1];
- z.value = basis.elements[2];
- x.variablesReference = parse_variant(basis.elements[0]);
- y.variablesReference = parse_variant(basis.elements[1]);
- z.variablesReference = parse_variant(basis.elements[2]);
+ x.type = type_vec3;
+ y.type = type_vec3;
+ z.type = type_vec3;
+ x.value = basis.rows[0];
+ y.value = basis.rows[1];
+ z.value = basis.rows[2];
+ x.variablesReference = parse_variant(basis.rows[0]);
+ y.variablesReference = parse_variant(basis.rows[1]);
+ z.variablesReference = parse_variant(basis.rows[2]);
Array arr;
arr.push_back(x.to_json());
diff --git a/editor/debugger/debug_adapter/debug_adapter_protocol.h b/editor/debugger/debug_adapter/debug_adapter_protocol.h
index b54a5f1f3f..66db75c634 100644
--- a/editor/debugger/debug_adapter/debug_adapter_protocol.h
+++ b/editor/debugger/debug_adapter/debug_adapter_protocol.h
@@ -76,7 +76,7 @@ class DebugAdapterProtocol : public Object {
private:
static DebugAdapterProtocol *singleton;
- DebugAdapterParser *parser;
+ DebugAdapterParser *parser = nullptr;
List<Ref<DAPeer>> clients;
Ref<TCPServer> server;
@@ -111,9 +111,9 @@ private:
String _current_request;
Ref<DAPeer> _current_peer;
- int breakpoint_id;
- int stackframe_id;
- int variable_id;
+ int breakpoint_id = 0;
+ int stackframe_id = 0;
+ int variable_id = 0;
List<DAP::Breakpoint> breakpoint_list;
Map<DAP::StackFrame, List<int>> stackframe_list;
Map<int, Array> variable_list;
diff --git a/editor/debugger/editor_debugger_inspector.cpp b/editor/debugger/editor_debugger_inspector.cpp
index c111190ca3..854c050793 100644
--- a/editor/debugger/editor_debugger_inspector.cpp
+++ b/editor/debugger/editor_debugger_inspector.cpp
@@ -157,7 +157,7 @@ ObjectID EditorDebuggerInspector::add_object(const Array &p_arr) {
if (path.contains("::")) {
// built-in resource
String base_path = path.get_slice("::", 0);
- RES dependency = ResourceLoader::load(base_path);
+ Ref<Resource> dependency = ResourceLoader::load(base_path);
if (dependency.is_valid()) {
remote_dependencies.insert(dependency);
}
@@ -166,7 +166,7 @@ ObjectID EditorDebuggerInspector::add_object(const Array &p_arr) {
if (pinfo.hint_string == "Script") {
if (debugObj->get_script() != var) {
- debugObj->set_script(REF());
+ debugObj->set_script(Ref<RefCounted>());
Ref<Script> script(var);
if (!script.is_null()) {
ScriptInstance *script_instance = script->placeholder_instance_create(debugObj);
@@ -206,7 +206,7 @@ ObjectID EditorDebuggerInspector::add_object(const Array &p_arr) {
void EditorDebuggerInspector::clear_cache() {
for (const KeyValue<ObjectID, EditorDebuggerRemoteObject *> &E : remote_objects) {
EditorNode *editor = EditorNode::get_singleton();
- if (editor->get_editor_history()->get_current() == E.value->get_instance_id()) {
+ if (editor->get_editor_selection_history()->get_current() == E.value->get_instance_id()) {
editor->push_item(nullptr);
}
memdelete(E.value);
diff --git a/editor/debugger/editor_debugger_inspector.h b/editor/debugger/editor_debugger_inspector.h
index 5cdc4417d0..2bf5bf3419 100644
--- a/editor/debugger/editor_debugger_inspector.h
+++ b/editor/debugger/editor_debugger_inspector.h
@@ -69,8 +69,8 @@ class EditorDebuggerInspector : public EditorInspector {
private:
ObjectID inspected_object_id;
Map<ObjectID, EditorDebuggerRemoteObject *> remote_objects;
- Set<RES> remote_dependencies;
- EditorDebuggerRemoteObject *variables;
+ Set<Ref<Resource>> remote_dependencies;
+ EditorDebuggerRemoteObject *variables = nullptr;
void _object_selected(ObjectID p_object);
void _object_edited(ObjectID p_id, const String &p_prop, const Variant &p_value);
diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp
index 7c9a984b6a..c0685af572 100644
--- a/editor/debugger/editor_debugger_node.cpp
+++ b/editor/debugger/editor_debugger_node.cpp
@@ -39,6 +39,7 @@
#include "editor/scene_tree_dock.h"
#include "scene/gui/menu_button.h"
#include "scene/gui/tab_container.h"
+#include "scene/resources/packed_scene.h"
template <typename Func>
void _for_all(TabContainer *p_node, const Func &p_func) {
@@ -60,7 +61,6 @@ EditorDebuggerNode::EditorDebuggerNode() {
add_theme_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("BottomPanelDebuggerOverride"), SNAME("EditorStyles"))->get_margin(SIDE_RIGHT));
tabs = memnew(TabContainer);
- tabs->set_tab_alignment(TabContainer::ALIGNMENT_LEFT);
tabs->set_tabs_visible(false);
tabs->connect("tab_changed", callable_mp(this, &EditorDebuggerNode::_debugger_changed));
add_child(tabs);
@@ -141,11 +141,22 @@ void EditorDebuggerNode::_error_selected(const String &p_file, int p_line, int p
}
void EditorDebuggerNode::_text_editor_stack_goto(const ScriptEditorDebugger *p_debugger) {
- const String file = p_debugger->get_stack_script_file();
+ String file = p_debugger->get_stack_script_file();
if (file.is_empty()) {
return;
}
- stack_script = ResourceLoader::load(file);
+ if (file.is_resource_file()) {
+ stack_script = ResourceLoader::load(file);
+ } else {
+ // If the script is built-in, it can be opened only if the scene is loaded in memory.
+ int i = file.find("::");
+ int j = file.rfind("(", i);
+ if (j > -1) { // If the script is named, the string is "name (file)", so we need to extract the path.
+ file = file.substr(j + 1, file.find(")", i) - j - 1);
+ }
+ Ref<PackedScene> ps = ResourceLoader::load(file.get_slice("::", 0));
+ stack_script = ResourceLoader::load(file);
+ }
const int line = p_debugger->get_stack_script_line() - 1;
emit_signal(SNAME("goto_script_line"), stack_script, line);
emit_signal(SNAME("set_execution"), stack_script, line);
@@ -170,7 +181,7 @@ void EditorDebuggerNode::_bind_methods() {
}
EditorDebuggerRemoteObject *EditorDebuggerNode::get_inspected_remote_object() {
- return Object::cast_to<EditorDebuggerRemoteObject>(ObjectDB::get_instance(EditorNode::get_singleton()->get_editor_history()->get_current()));
+ return Object::cast_to<EditorDebuggerRemoteObject>(ObjectDB::get_instance(EditorNode::get_singleton()->get_editor_selection_history()->get_current()));
}
ScriptEditorDebugger *EditorDebuggerNode::get_debugger(int p_id) const {
@@ -598,12 +609,12 @@ void EditorDebuggerNode::_save_node_requested(ObjectID p_id, const String &p_fil
}
// Remote inspector/edit.
-void EditorDebuggerNode::_method_changeds(void *p_ud, Object *p_base, const StringName &p_name, VARIANT_ARG_DECLARE) {
+void EditorDebuggerNode::_method_changeds(void *p_ud, Object *p_base, const StringName &p_name, const Variant **p_args, int p_argcount) {
if (!singleton) {
return;
}
_for_all(singleton->tabs, [&](ScriptEditorDebugger *dbg) {
- dbg->_method_changed(p_base, p_name, VARIANT_ARG_PASS);
+ dbg->_method_changed(p_base, p_name, p_args, p_argcount);
});
}
diff --git a/editor/debugger/editor_debugger_node.h b/editor/debugger/editor_debugger_node.h
index 6fcdbf5f73..b4fbb90301 100644
--- a/editor/debugger/editor_debugger_node.h
+++ b/editor/debugger/editor_debugger_node.h
@@ -124,7 +124,7 @@ protected:
void _remote_object_requested(ObjectID p_id, int p_debugger);
void _save_node_requested(ObjectID p_id, const String &p_file, int p_debugger);
- void _clear_execution(REF p_script) {
+ void _clear_execution(Ref<RefCounted> p_script) {
emit_signal(SNAME("clear_execution"), p_script);
}
@@ -171,7 +171,7 @@ public:
// Remote inspector/edit.
void request_remote_tree();
- static void _method_changeds(void *p_ud, Object *p_base, const StringName &p_name, VARIANT_ARG_DECLARE);
+ static void _method_changeds(void *p_ud, Object *p_base, const StringName &p_name, const Variant **p_args, int p_argcount);
static void _property_changeds(void *p_ud, Object *p_base, const StringName &p_property, const Variant &p_value);
// LiveDebug
diff --git a/editor/debugger/editor_network_profiler.h b/editor/debugger/editor_network_profiler.h
index 3e95eb0de6..3a604f5564 100644
--- a/editor/debugger/editor_network_profiler.h
+++ b/editor/debugger/editor_network_profiler.h
@@ -42,13 +42,13 @@ class EditorNetworkProfiler : public VBoxContainer {
GDCLASS(EditorNetworkProfiler, VBoxContainer)
private:
- Button *activate;
- Button *clear_button;
- Tree *counters_display;
- LineEdit *incoming_bandwidth_text;
- LineEdit *outgoing_bandwidth_text;
+ Button *activate = nullptr;
+ Button *clear_button = nullptr;
+ Tree *counters_display = nullptr;
+ LineEdit *incoming_bandwidth_text = nullptr;
+ LineEdit *outgoing_bandwidth_text = nullptr;
- Timer *frame_delay;
+ Timer *frame_delay = nullptr;
Map<ObjectID, SceneDebugger::RPCNodeInfo> nodes_data;
diff --git a/editor/debugger/editor_performance_profiler.cpp b/editor/debugger/editor_performance_profiler.cpp
index 56d1e7cee9..c821561ca6 100644
--- a/editor/debugger/editor_performance_profiler.cpp
+++ b/editor/debugger/editor_performance_profiler.cpp
@@ -30,6 +30,7 @@
#include "editor_performance_profiler.h"
+#include "editor/editor_property_name_processor.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#include "main/performance.h"
@@ -386,8 +387,8 @@ EditorPerformanceProfiler::EditorPerformanceProfiler() {
monitor_draw->add_child(info_message);
for (int i = 0; i < Performance::MONITOR_MAX; i++) {
- String base = Performance::get_singleton()->get_monitor_name(Performance::Monitor(i)).get_slicec('/', 0).capitalize();
- String name = Performance::get_singleton()->get_monitor_name(Performance::Monitor(i)).get_slicec('/', 1).capitalize();
+ String base = EditorPropertyNameProcessor::get_singleton()->process_name(Performance::get_singleton()->get_monitor_name(Performance::Monitor(i)).get_slicec('/', 0), EditorPropertyNameProcessor::STYLE_CAPITALIZED);
+ String name = EditorPropertyNameProcessor::get_singleton()->process_name(Performance::get_singleton()->get_monitor_name(Performance::Monitor(i)).get_slicec('/', 1), EditorPropertyNameProcessor::STYLE_CAPITALIZED);
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));
}
diff --git a/editor/debugger/editor_performance_profiler.h b/editor/debugger/editor_performance_profiler.h
index 998ecc5bb6..ab0e43de2f 100644
--- a/editor/debugger/editor_performance_profiler.h
+++ b/editor/debugger/editor_performance_profiler.h
@@ -62,11 +62,11 @@ private:
OrderedHashMap<StringName, Monitor> monitors;
Map<StringName, TreeItem *> base_map;
- Tree *monitor_tree;
- Control *monitor_draw;
- Label *info_message;
+ Tree *monitor_tree = nullptr;
+ Control *monitor_draw = nullptr;
+ Label *info_message = nullptr;
StringName marker_key;
- int marker_frame;
+ int marker_frame = 0;
const int MARGIN = 4;
const int POINT_SEPARATION = 5;
const int MARKER_MARGIN = 2;
diff --git a/editor/debugger/editor_profiler.cpp b/editor/debugger/editor_profiler.cpp
index 4b263e5152..50f3b19cc2 100644
--- a/editor/debugger/editor_profiler.cpp
+++ b/editor/debugger/editor_profiler.cpp
@@ -396,6 +396,7 @@ void EditorProfiler::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
+ case NOTIFICATION_THEME_CHANGED:
case NOTIFICATION_TRANSLATION_CHANGED: {
activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons")));
clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")));
@@ -659,11 +660,8 @@ EditorProfiler::EditorProfiler() {
h_split->add_child(graph);
graph->set_h_size_flags(SIZE_EXPAND_FILL);
- int metric_size = CLAMP(int(EDITOR_DEF("debugger/profiler_frame_history_size", 600)), 60, 1024);
+ int metric_size = CLAMP(int(EDITOR_GET("debugger/profiler_frame_history_size")), 60, 1024);
frame_metrics.resize(metric_size);
- total_metrics = 0;
- last_metric = -1;
- hover_metric = -1;
EDITOR_DEF("debugger/profiler_frame_max_functions", 64);
@@ -681,7 +679,4 @@ EditorProfiler::EditorProfiler() {
plot_sigs.insert("physics_frame_time");
plot_sigs.insert("category_frame_time");
-
- seeking = false;
- graph_height = 1;
}
diff --git a/editor/debugger/editor_profiler.h b/editor/debugger/editor_profiler.h
index 45f7ac39c1..2aef654a2f 100644
--- a/editor/debugger/editor_profiler.h
+++ b/editor/debugger/editor_profiler.h
@@ -49,7 +49,7 @@ public:
int frame_number = 0;
float frame_time = 0;
- float idle_time = 0;
+ float process_time = 0;
float physics_time = 0;
float physics_frame_time = 0;
@@ -90,37 +90,37 @@ public:
};
private:
- Button *activate;
- Button *clear_button;
- TextureRect *graph;
+ Button *activate = nullptr;
+ Button *clear_button = nullptr;
+ TextureRect *graph = nullptr;
Ref<ImageTexture> graph_texture;
Vector<uint8_t> graph_image;
- Tree *variables;
- HSplitContainer *h_split;
+ Tree *variables = nullptr;
+ HSplitContainer *h_split = nullptr;
Set<StringName> plot_sigs;
- OptionButton *display_mode;
- OptionButton *display_time;
+ OptionButton *display_mode = nullptr;
+ OptionButton *display_time = nullptr;
- SpinBox *cursor_metric_edit;
+ SpinBox *cursor_metric_edit = nullptr;
Vector<Metric> frame_metrics;
- int total_metrics;
- int last_metric;
+ int total_metrics = 0;
+ int last_metric = -1;
- int max_functions;
+ int max_functions = 0;
- bool updating_frame;
+ bool updating_frame = false;
- int hover_metric;
+ int hover_metric = -1;
- float graph_height;
+ float graph_height = 1.0f;
- bool seeking;
+ bool seeking = false;
- Timer *frame_delay;
- Timer *plot_delay;
+ Timer *frame_delay = nullptr;
+ Timer *plot_delay = nullptr;
void _update_frame();
diff --git a/editor/debugger/editor_visual_profiler.cpp b/editor/debugger/editor_visual_profiler.cpp
index 2a1b0029d4..503c03bafe 100644
--- a/editor/debugger/editor_visual_profiler.cpp
+++ b/editor/debugger/editor_visual_profiler.cpp
@@ -67,7 +67,7 @@ void EditorVisualProfiler::add_frame_metric(const Metric &p_metric) {
updating_frame = true;
cursor_metric_edit->set_max(frame_metrics[last_metric].frame_number);
- cursor_metric_edit->set_min(MAX(frame_metrics[last_metric].frame_number - frame_metrics.size(), 0));
+ cursor_metric_edit->set_min(MAX(frame_metrics[last_metric].frame_number - frame_metrics.size(), 0u));
if (!seeking) {
cursor_metric_edit->set_value(frame_metrics[last_metric].frame_number);
@@ -143,12 +143,12 @@ void EditorVisualProfiler::_item_selected() {
}
void EditorVisualProfiler::_update_plot() {
- int w = graph->get_size().width;
- int h = graph->get_size().height;
+ const int w = graph->get_size().width;
+ const int h = graph->get_size().height;
bool reset_texture = false;
- int desired_len = w * h * 4;
+ const int desired_len = w * h * 4;
if (graph_image.size() != desired_len) {
reset_texture = true;
@@ -156,12 +156,13 @@ void EditorVisualProfiler::_update_plot() {
}
uint8_t *wr = graph_image.ptrw();
+ const Color background_color = get_theme_color("dark_color_2", "Editor");
- //clear
+ // Clear the previous frame and set the background color.
for (int i = 0; i < desired_len; i += 4) {
- wr[i + 0] = 0;
- wr[i + 1] = 0;
- wr[i + 2] = 0;
+ wr[i + 0] = Math::fast_ftoi(background_color.r * 255);
+ wr[i + 1] = Math::fast_ftoi(background_color.g * 255);
+ wr[i + 2] = Math::fast_ftoi(background_color.b * 255);
wr[i + 3] = 255;
}
@@ -259,9 +260,9 @@ void EditorVisualProfiler::_update_plot() {
uint8_t r, g, b;
if (column_cpu[j].a == 0) {
- r = 0;
- g = 0;
- b = 0;
+ r = Math::fast_ftoi(background_color.r * 255);
+ g = Math::fast_ftoi(background_color.g * 255);
+ b = Math::fast_ftoi(background_color.b * 255);
} else {
r = CLAMP((column_cpu[j].r / column_cpu[j].a) * 255.0, 0, 255);
g = CLAMP((column_cpu[j].g / column_cpu[j].a) * 255.0, 0, 255);
@@ -279,9 +280,9 @@ void EditorVisualProfiler::_update_plot() {
uint8_t r, g, b;
if (column_gpu[j].a == 0) {
- r = 0;
- g = 0;
- b = 0;
+ r = Math::fast_ftoi(background_color.r * 255);
+ g = Math::fast_ftoi(background_color.g * 255);
+ b = Math::fast_ftoi(background_color.b * 255);
} else {
r = CLAMP((column_gpu[j].r / column_gpu[j].a) * 255.0, 0, 255);
g = CLAMP((column_gpu[j].g / column_gpu[j].a) * 255.0, 0, 255);
@@ -425,6 +426,7 @@ void EditorVisualProfiler::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
+ case NOTIFICATION_THEME_CHANGED:
case NOTIFICATION_TRANSLATION_CHANGED: {
if (is_layout_rtl()) {
activate->set_icon(get_theme_icon(SNAME("PlayBackwards"), SNAME("EditorIcons")));
@@ -440,8 +442,11 @@ void EditorVisualProfiler::_graph_tex_draw() {
if (last_metric < 0) {
return;
}
+
Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Label"));
int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Label"));
+ const Color color = get_theme_color(SNAME("font_color"), SNAME("Editor"));
+
if (seeking) {
int max_frames = frame_metrics.size();
int frame = cursor_metric_edit->get_value() - (frame_metrics[last_metric].frame_number - max_frames + 1);
@@ -451,10 +456,9 @@ void EditorVisualProfiler::_graph_tex_draw() {
int half_width = graph->get_size().x / 2;
int cur_x = frame * half_width / max_frames;
- //cur_x /= 2.0;
- graph->draw_line(Vector2(cur_x, 0), Vector2(cur_x, graph->get_size().y), Color(1, 1, 1, 0.8));
- graph->draw_line(Vector2(cur_x + half_width, 0), Vector2(cur_x + half_width, graph->get_size().y), Color(1, 1, 1, 0.8));
+ graph->draw_line(Vector2(cur_x, 0), Vector2(cur_x, graph->get_size().y), color * Color(1, 1, 1));
+ graph->draw_line(Vector2(cur_x + half_width, 0), Vector2(cur_x + half_width, graph->get_size().y), color * Color(1, 1, 1));
}
if (graph_height_cpu > 0) {
@@ -462,10 +466,10 @@ void EditorVisualProfiler::_graph_tex_draw() {
int half_width = graph->get_size().x / 2;
- graph->draw_line(Vector2(0, frame_y), Vector2(half_width, frame_y), Color(1, 1, 1, 0.3));
+ graph->draw_line(Vector2(0, frame_y), Vector2(half_width, frame_y), color * Color(1, 1, 1, 0.5));
- String limit_str = String::num(graph_limit, 2);
- graph->draw_string(font, Vector2(half_width - font->get_string_size(limit_str, font_size).x - 2, frame_y - 2), limit_str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(1, 1, 1, 0.6));
+ const String limit_str = String::num(graph_limit, 2) + " ms";
+ graph->draw_string(font, Vector2(half_width - font->get_string_size(limit_str, font_size).x - 2, frame_y - 2), limit_str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, color * Color(1, 1, 1, 0.75));
}
if (graph_height_gpu > 0) {
@@ -473,14 +477,14 @@ void EditorVisualProfiler::_graph_tex_draw() {
int half_width = graph->get_size().x / 2;
- graph->draw_line(Vector2(half_width, frame_y), Vector2(graph->get_size().x, frame_y), Color(1, 1, 1, 0.3));
+ graph->draw_line(Vector2(half_width, frame_y), Vector2(graph->get_size().x, frame_y), color * Color(1, 1, 1, 0.5));
- String limit_str = String::num(graph_limit, 2);
- graph->draw_string(font, Vector2(half_width * 2 - font->get_string_size(limit_str, font_size).x - 2, frame_y - 2), limit_str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(1, 1, 1, 0.6));
+ const String limit_str = String::num(graph_limit, 2) + " ms";
+ graph->draw_string(font, Vector2(half_width * 2 - font->get_string_size(limit_str, font_size).x - 2, frame_y - 2), limit_str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, color * Color(1, 1, 1, 0.75));
}
- graph->draw_string(font, Vector2(font->get_string_size("X", font_size).x, font->get_ascent(font_size) + 2), "CPU:", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(1, 1, 1, 0.8));
- graph->draw_string(font, Vector2(font->get_string_size("X", font_size).x + graph->get_size().width / 2, font->get_ascent(font_size) + 2), "GPU:", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(1, 1, 1, 0.8));
+ graph->draw_string(font, Vector2(font->get_string_size("X", font_size).x, font->get_ascent(font_size) + 2), "CPU:", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, color * Color(1, 1, 1));
+ graph->draw_string(font, Vector2(font->get_string_size("X", font_size).x + graph->get_size().width / 2, font->get_ascent(font_size) + 2), "GPU:", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, color * Color(1, 1, 1));
}
void EditorVisualProfiler::_graph_tex_mouse_exit() {
@@ -724,7 +728,7 @@ EditorVisualProfiler::EditorVisualProfiler() {
hb->add_child(memnew(Label(TTR("Measure:"))));
display_mode = memnew(OptionButton);
- display_mode->add_item(TTR("Frame Time (msec)"));
+ display_mode->add_item(TTR("Frame Time (ms)"));
display_mode->add_item(TTR("Frame %"));
display_mode->connect("item_selected", callable_mp(this, &EditorVisualProfiler::_combo_changed));
@@ -778,7 +782,6 @@ EditorVisualProfiler::EditorVisualProfiler() {
graph = memnew(TextureRect);
graph->set_ignore_texture_size(true);
graph->set_mouse_filter(MOUSE_FILTER_STOP);
- //graph->set_ignore_mouse(false);
graph->connect("draw", callable_mp(this, &EditorVisualProfiler::_graph_tex_draw));
graph->connect("gui_input", callable_mp(this, &EditorVisualProfiler::_graph_tex_input));
graph->connect("mouse_exited", callable_mp(this, &EditorVisualProfiler::_graph_tex_mouse_exit));
@@ -786,13 +789,8 @@ EditorVisualProfiler::EditorVisualProfiler() {
h_split->add_child(graph);
graph->set_h_size_flags(SIZE_EXPAND_FILL);
- int metric_size = CLAMP(int(EDITOR_DEF("debugger/profiler_frame_history_size", 600)), 60, 1024);
+ int metric_size = CLAMP(int(EDITOR_GET("debugger/profiler_frame_history_size")), 60, 1024);
frame_metrics.resize(metric_size);
- last_metric = -1;
- //cursor_metric=-1;
- hover_metric = -1;
-
- //display_mode=DISPLAY_FRAME_TIME;
frame_delay = memnew(Timer);
frame_delay->set_wait_time(0.1);
@@ -805,12 +803,4 @@ EditorVisualProfiler::EditorVisualProfiler() {
plot_delay->set_one_shot(true);
add_child(plot_delay);
plot_delay->connect("timeout", callable_mp(this, &EditorVisualProfiler::_update_plot));
-
- seeking = false;
- graph_height_cpu = 1;
- graph_height_gpu = 1;
-
- graph_limit = 1000 / 60.0;
-
- //activate->set_disabled(true);
}
diff --git a/editor/debugger/editor_visual_profiler.h b/editor/debugger/editor_visual_profiler.h
index 55ba725ae8..4e5169da9e 100644
--- a/editor/debugger/editor_visual_profiler.h
+++ b/editor/debugger/editor_visual_profiler.h
@@ -67,40 +67,39 @@ public:
};
private:
- Button *activate;
- Button *clear_button;
+ Button *activate = nullptr;
+ Button *clear_button = nullptr;
- TextureRect *graph;
+ TextureRect *graph = nullptr;
Ref<ImageTexture> graph_texture;
Vector<uint8_t> graph_image;
- Tree *variables;
- HSplitContainer *h_split;
- CheckBox *frame_relative;
- CheckBox *linked;
+ Tree *variables = nullptr;
+ HSplitContainer *h_split = nullptr;
+ CheckBox *frame_relative = nullptr;
+ CheckBox *linked = nullptr;
- OptionButton *display_mode;
+ OptionButton *display_mode = nullptr;
- SpinBox *cursor_metric_edit;
+ SpinBox *cursor_metric_edit = nullptr;
Vector<Metric> frame_metrics;
- int last_metric;
+ int last_metric = -1;
- StringName selected_area;
+ int hover_metric = -1;
- bool updating_frame;
+ StringName selected_area;
- //int cursor_metric;
- int hover_metric;
+ bool updating_frame = false;
- float graph_height_cpu;
- float graph_height_gpu;
+ float graph_height_cpu = 1.0f;
+ float graph_height_gpu = 1.0f;
- float graph_limit;
+ float graph_limit = 1000.0f / 60;
- bool seeking;
+ bool seeking = false;
- Timer *frame_delay;
- Timer *plot_delay;
+ Timer *frame_delay = nullptr;
+ Timer *plot_delay = nullptr;
void _update_frame(bool p_focus_selected = false);
diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp
index 645d7608f3..90679657ba 100644
--- a/editor/debugger/script_editor_debugger.cpp
+++ b/editor/debugger/script_editor_debugger.cpp
@@ -44,6 +44,7 @@
#include "editor/editor_file_dialog.h"
#include "editor/editor_log.h"
#include "editor/editor_node.h"
+#include "editor/editor_property_name_processor.h"
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#include "editor/plugins/canvas_item_editor_plugin.h"
@@ -135,15 +136,15 @@ void ScriptEditorDebugger::debug_continue() {
void ScriptEditorDebugger::update_tabs() {
if (error_count == 0 && warning_count == 0) {
errors_tab->set_name(TTR("Errors"));
- tabs->set_tab_icon(errors_tab->get_index(), Ref<Texture2D>());
+ tabs->set_tab_icon(tabs->get_tab_idx_from_control(errors_tab), Ref<Texture2D>());
} else {
errors_tab->set_name(TTR("Errors") + " (" + itos(error_count + warning_count) + ")");
if (error_count >= 1 && warning_count >= 1) {
- tabs->set_tab_icon(errors_tab->get_index(), get_theme_icon(SNAME("ErrorWarning"), SNAME("EditorIcons")));
+ tabs->set_tab_icon(tabs->get_tab_idx_from_control(errors_tab), get_theme_icon(SNAME("ErrorWarning"), SNAME("EditorIcons")));
} else if (error_count >= 1) {
- tabs->set_tab_icon(errors_tab->get_index(), get_theme_icon(SNAME("Error"), SNAME("EditorIcons")));
+ tabs->set_tab_icon(tabs->get_tab_idx_from_control(errors_tab), get_theme_icon(SNAME("Error"), SNAME("EditorIcons")));
} else {
- tabs->set_tab_icon(errors_tab->get_index(), get_theme_icon(SNAME("Warning"), SNAME("EditorIcons")));
+ tabs->set_tab_icon(tabs->get_tab_idx_from_control(errors_tab), get_theme_icon(SNAME("Warning"), SNAME("EditorIcons")));
}
}
}
@@ -163,7 +164,7 @@ void ScriptEditorDebugger::_file_selected(const String &p_file) {
switch (file_dialog_purpose) {
case SAVE_MONITORS_CSV: {
Error err;
- FileAccessRef file = FileAccess::open(p_file, FileAccess::WRITE, &err);
+ Ref<FileAccess> file = FileAccess::open(p_file, FileAccess::WRITE, &err);
if (err != OK) {
ERR_PRINT("Failed to open " + p_file);
@@ -208,7 +209,7 @@ void ScriptEditorDebugger::_file_selected(const String &p_file) {
} break;
case SAVE_VRAM_CSV: {
Error err;
- FileAccessRef file = FileAccess::open(p_file, FileAccess::WRITE, &err);
+ Ref<FileAccess> file = FileAccess::open(p_file, FileAccess::WRITE, &err);
if (err != OK) {
ERR_PRINT("Failed to open " + p_file);
@@ -392,7 +393,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
stack_dump_info.push_back(d);
s->set_metadata(0, d);
- String line = itos(i) + " - " + String(d["file"]) + ":" + itos(d["line"]) + " - at function: " + d["function"];
+ String line = itos(i) + " - " + String(d["file"]) + ":" + itos(d["line"]) + " - at function: " + String(d["function"]);
s->set_text(0, line);
if (i == 0) {
@@ -605,7 +606,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
metric.valid = true;
metric.frame_number = frame.frame_number;
metric.frame_time = frame.frame_time;
- metric.idle_time = frame.idle_time;
+ metric.process_time = frame.process_time;
metric.physics_time = frame.physics_time;
metric.physics_frame_time = frame.physics_frame_time;
@@ -626,10 +627,10 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
frame_time.items.push_back(item);
- item.name = "Idle Time";
- item.total = metric.idle_time;
+ item.name = "Process Time";
+ item.total = metric.process_time;
item.self = item.total;
- item.signature = "idle_time";
+ item.signature = "process_time";
frame_time.items.push_back(item);
@@ -647,7 +648,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
const ServersDebugger::ServerInfo &srv = frame.servers[i];
EditorProfiler::Metric::Category c;
const String name = srv.name;
- c.name = name.capitalize();
+ c.name = EditorPropertyNameProcessor::get_singleton()->process_name(name, EditorPropertyNameProcessor::STYLE_CAPITALIZED);
c.items.resize(srv.functions.size());
c.total_time = 0;
c.signature = "categ::" + name;
@@ -659,7 +660,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
item.self = srv.functions[j].time;
item.total = item.self;
item.signature = "categ::" + name + "::" + item.name;
- item.name = item.name.capitalize();
+ item.name = EditorPropertyNameProcessor::get_singleton()->process_name(item.name, EditorPropertyNameProcessor::STYLE_CAPITALIZED);
c.total_time += item.total;
c.items.write[j] = item;
}
@@ -779,18 +780,20 @@ void ScriptEditorDebugger::_set_reason_text(const String &p_reason, MessageType
void ScriptEditorDebugger::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
- skip_breakpoints->set_icon(get_theme_icon(SNAME("DebugSkipBreakpointsOff"), SNAME("EditorIcons")));
- copy->set_icon(get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons")));
-
- step->set_icon(get_theme_icon(SNAME("DebugStep"), SNAME("EditorIcons")));
- next->set_icon(get_theme_icon(SNAME("DebugNext"), SNAME("EditorIcons")));
- dobreak->set_icon(get_theme_icon(SNAME("Pause"), SNAME("EditorIcons")));
- docontinue->set_icon(get_theme_icon(SNAME("DebugContinue"), SNAME("EditorIcons")));
le_set->connect("pressed", callable_mp(this, &ScriptEditorDebugger::_live_edit_set));
le_clear->connect("pressed", callable_mp(this, &ScriptEditorDebugger::_live_edit_clear));
error_tree->connect("item_selected", callable_mp(this, &ScriptEditorDebugger::_error_selected));
error_tree->connect("item_activated", callable_mp(this, &ScriptEditorDebugger::_error_activated));
breakpoints_tree->connect("item_activated", callable_mp(this, &ScriptEditorDebugger::_breakpoint_tree_clicked));
+ [[fallthrough]];
+ }
+ case NOTIFICATION_THEME_CHANGED: {
+ skip_breakpoints->set_icon(get_theme_icon(skip_breakpoints_value ? SNAME("DebugSkipBreakpointsOn") : SNAME("DebugSkipBreakpointsOff"), SNAME("EditorIcons")));
+ copy->set_icon(get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons")));
+ step->set_icon(get_theme_icon(SNAME("DebugStep"), SNAME("EditorIcons")));
+ next->set_icon(get_theme_icon(SNAME("DebugNext"), SNAME("EditorIcons")));
+ dobreak->set_icon(get_theme_icon(SNAME("Pause"), SNAME("EditorIcons")));
+ docontinue->set_icon(get_theme_icon(SNAME("DebugContinue"), SNAME("EditorIcons")));
vmem_refresh->set_icon(get_theme_icon(SNAME("Reload"), SNAME("EditorIcons")));
vmem_export->set_icon(get_theme_icon(SNAME("Save"), SNAME("EditorIcons")));
search->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
@@ -809,7 +812,7 @@ void ScriptEditorDebugger::_notification(int p_what) {
Transform2D transform;
transform.scale_basis(Size2(zoom, zoom));
- transform.elements[2] = -offset * zoom;
+ transform.columns[2] = -offset * zoom;
Array msg;
msg.push_back(transform);
@@ -1064,18 +1067,16 @@ int ScriptEditorDebugger::_get_res_path_cache(const String &p_path) {
return last_path_id;
}
-void ScriptEditorDebugger::_method_changed(Object *p_base, const StringName &p_name, VARIANT_ARG_DECLARE) {
+void ScriptEditorDebugger::_method_changed(Object *p_base, const StringName &p_name, const Variant **p_args, int p_argcount) {
if (!p_base || !live_debug || !is_session_active() || !EditorNode::get_singleton()->get_edited_scene()) {
return;
}
Node *node = Object::cast_to<Node>(p_base);
- VARIANT_ARGPTRS
-
- for (int i = 0; i < VARIANT_ARG_MAX; i++) {
+ for (int i = 0; i < p_argcount; i++) {
//no pointers, sorry
- if (argptr[i] && (argptr[i]->get_type() == Variant::OBJECT || argptr[i]->get_type() == Variant::RID)) {
+ if (p_args[i]->get_type() == Variant::OBJECT || p_args[i]->get_type() == Variant::RID) {
return;
}
}
@@ -1087,9 +1088,9 @@ void ScriptEditorDebugger::_method_changed(Object *p_base, const StringName &p_n
Array msg;
msg.push_back(pathid);
msg.push_back(p_name);
- for (int i = 0; i < VARIANT_ARG_MAX; i++) {
+ for (int i = 0; i < p_argcount; i++) {
//no pointers, sorry
- msg.push_back(*argptr[i]);
+ msg.push_back(*p_args[i]);
}
_put_msg("scene:live_node_call", msg);
@@ -1105,9 +1106,9 @@ void ScriptEditorDebugger::_method_changed(Object *p_base, const StringName &p_n
Array msg;
msg.push_back(pathid);
msg.push_back(p_name);
- for (int i = 0; i < VARIANT_ARG_MAX; i++) {
+ for (int i = 0; i < p_argcount; i++) {
//no pointers, sorry
- msg.push_back(*argptr[i]);
+ msg.push_back(*p_args[i]);
}
_put_msg("scene:live_res_call", msg);
@@ -1495,7 +1496,7 @@ void ScriptEditorDebugger::_error_tree_item_rmb_selected(const Vector2 &p_pos) {
if (error_tree->is_anything_selected()) {
item_menu->add_icon_item(get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons")), TTR("Copy Error"), ACTION_COPY_ERROR);
- item_menu->add_icon_item(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons")), TTR("Open C++ Source on GitHub"), ACTION_OPEN_SOURCE);
+ item_menu->add_icon_item(get_theme_icon(SNAME("ExternalLink"), SNAME("EditorIcons")), TTR("Open C++ Source on GitHub"), ACTION_OPEN_SOURCE);
}
if (item_menu->get_item_count() > 0) {
@@ -1658,7 +1659,6 @@ bool ScriptEditorDebugger::has_capture(const StringName &p_name) {
ScriptEditorDebugger::ScriptEditorDebugger() {
tabs = memnew(TabContainer);
- tabs->set_tab_alignment(TabContainer::ALIGNMENT_LEFT);
tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles")));
tabs->connect("tab_changed", callable_mp(this, &ScriptEditorDebugger::_tab_changed));
@@ -1764,7 +1764,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() {
inspector = memnew(EditorDebuggerInspector);
inspector->set_h_size_flags(SIZE_EXPAND_FILL);
inspector->set_v_size_flags(SIZE_EXPAND_FILL);
- inspector->set_enable_capitalize_paths(false);
+ inspector->set_property_name_style(EditorPropertyNameProcessor::STYLE_RAW);
inspector->set_read_only(true);
inspector->connect("object_selected", callable_mp(this, &ScriptEditorDebugger::_remote_object_selected));
inspector->connect("object_edited", callable_mp(this, &ScriptEditorDebugger::_remote_object_edited));
diff --git a/editor/debugger/script_editor_debugger.h b/editor/debugger/script_editor_debugger.h
index e4d3a2fa09..ad90e63c16 100644
--- a/editor/debugger/script_editor_debugger.h
+++ b/editor/debugger/script_editor_debugger.h
@@ -85,26 +85,26 @@ private:
ACTION_DELETE_ALL_BREAKPOINTS,
};
- AcceptDialog *msgdialog;
-
- LineEdit *clicked_ctrl;
- LineEdit *clicked_ctrl_type;
- LineEdit *live_edit_root;
- Button *le_set;
- Button *le_clear;
- Button *export_csv;
-
- VBoxContainer *errors_tab;
- Tree *error_tree;
- Button *expand_all_button;
- Button *collapse_all_button;
- Button *clear_button;
- PopupMenu *item_menu;
-
- Tree *breakpoints_tree;
- PopupMenu *breakpoints_menu;
-
- EditorFileDialog *file_dialog;
+ AcceptDialog *msgdialog = nullptr;
+
+ LineEdit *clicked_ctrl = nullptr;
+ LineEdit *clicked_ctrl_type = nullptr;
+ LineEdit *live_edit_root = nullptr;
+ Button *le_set = nullptr;
+ Button *le_clear = nullptr;
+ Button *export_csv = nullptr;
+
+ VBoxContainer *errors_tab = nullptr;
+ Tree *error_tree = nullptr;
+ Button *expand_all_button = nullptr;
+ Button *collapse_all_button = nullptr;
+ Button *clear_button = nullptr;
+ PopupMenu *item_menu = nullptr;
+
+ Tree *breakpoints_tree = nullptr;
+ PopupMenu *breakpoints_menu = nullptr;
+
+ EditorFileDialog *file_dialog = nullptr;
enum FileDialogPurpose {
SAVE_MONITORS_CSV,
SAVE_VRAM_CSV,
@@ -117,31 +117,31 @@ private:
bool skip_breakpoints_value = false;
Ref<Script> stack_script;
- TabContainer *tabs;
+ TabContainer *tabs = nullptr;
- Label *reason;
+ Label *reason = nullptr;
- Button *skip_breakpoints;
- Button *copy;
- Button *step;
- Button *next;
- Button *dobreak;
- Button *docontinue;
+ Button *skip_breakpoints = nullptr;
+ Button *copy = nullptr;
+ Button *step = nullptr;
+ Button *next = nullptr;
+ Button *dobreak = nullptr;
+ Button *docontinue = nullptr;
// Reference to "Remote" tab in scene tree. Needed by _live_edit_set and buttons state.
// Each debugger should have it's tree in the future I guess.
const Tree *editor_remote_tree = nullptr;
Map<int, String> profiler_signature;
- Tree *vmem_tree;
- Button *vmem_refresh;
- Button *vmem_export;
- LineEdit *vmem_total;
+ Tree *vmem_tree = nullptr;
+ Button *vmem_refresh = nullptr;
+ Button *vmem_export = nullptr;
+ LineEdit *vmem_total = nullptr;
- Tree *stack_dump;
+ Tree *stack_dump = nullptr;
LineEdit *search = nullptr;
- EditorDebuggerInspector *inspector;
- SceneDebuggerTree *scene_tree;
+ EditorDebuggerInspector *inspector = nullptr;
+ SceneDebuggerTree *scene_tree = nullptr;
Ref<RemoteDebuggerPeer> peer;
@@ -149,10 +149,10 @@ private:
int last_path_id;
Map<String, int> res_path_cache;
- EditorProfiler *profiler;
- EditorVisualProfiler *visual_profiler;
- EditorNetworkProfiler *network_profiler;
- EditorPerformanceProfiler *performance_profiler;
+ EditorProfiler *profiler = nullptr;
+ EditorVisualProfiler *visual_profiler = nullptr;
+ EditorNetworkProfiler *network_profiler = nullptr;
+ EditorPerformanceProfiler *performance_profiler = nullptr;
OS::ProcessID remote_pid = 0;
bool breaked = false;
@@ -187,7 +187,7 @@ private:
void _live_edit_set();
void _live_edit_clear();
- void _method_changed(Object *p_base, const StringName &p_name, VARIANT_ARG_DECLARE);
+ void _method_changed(Object *p_base, const StringName &p_name, const Variant **p_args, int p_argcount);
void _property_changed(Object *p_base, const StringName &p_property, const Variant &p_value);
void _error_activated();