diff options
Diffstat (limited to 'editor/debugger')
-rw-r--r-- | editor/debugger/editor_debugger_inspector.cpp | 23 | ||||
-rw-r--r-- | editor/debugger/editor_debugger_inspector.h | 2 | ||||
-rw-r--r-- | editor/debugger/editor_debugger_node.cpp | 74 | ||||
-rw-r--r-- | editor/debugger/editor_debugger_node.h | 4 | ||||
-rw-r--r-- | editor/debugger/editor_debugger_server.cpp | 1 | ||||
-rw-r--r-- | editor/debugger/editor_debugger_server.h | 1 | ||||
-rw-r--r-- | editor/debugger/editor_debugger_tree.cpp | 26 | ||||
-rw-r--r-- | editor/debugger/editor_debugger_tree.h | 1 | ||||
-rw-r--r-- | editor/debugger/editor_network_profiler.cpp | 7 | ||||
-rw-r--r-- | editor/debugger/editor_network_profiler.h | 1 | ||||
-rw-r--r-- | editor/debugger/editor_profiler.cpp | 88 | ||||
-rw-r--r-- | editor/debugger/editor_profiler.h | 4 | ||||
-rw-r--r-- | editor/debugger/editor_visual_profiler.cpp | 68 | ||||
-rw-r--r-- | editor/debugger/editor_visual_profiler.h | 2 | ||||
-rw-r--r-- | editor/debugger/script_editor_debugger.cpp | 202 | ||||
-rw-r--r-- | editor/debugger/script_editor_debugger.h | 1 |
16 files changed, 208 insertions, 297 deletions
diff --git a/editor/debugger/editor_debugger_inspector.cpp b/editor/debugger/editor_debugger_inspector.cpp index 00ed2bbc4c..125439d09b 100644 --- a/editor/debugger/editor_debugger_inspector.cpp +++ b/editor/debugger/editor_debugger_inspector.cpp @@ -36,9 +36,9 @@ #include "scene/debugger/scene_debugger.h" bool EditorDebuggerRemoteObject::_set(const StringName &p_name, const Variant &p_value) { - - if (!editable || !prop_values.has(p_name) || String(p_name).begins_with("Constants/")) + if (!editable || !prop_values.has(p_name) || String(p_name).begins_with("Constants/")) { return false; + } prop_values[p_name] = p_value; emit_signal("value_edited", remote_object_id, p_name, p_value); @@ -46,16 +46,15 @@ bool EditorDebuggerRemoteObject::_set(const StringName &p_name, const Variant &p } bool EditorDebuggerRemoteObject::_get(const StringName &p_name, Variant &r_ret) const { - - if (!prop_values.has(p_name)) + if (!prop_values.has(p_name)) { return false; + } r_ret = prop_values[p_name]; return true; } void EditorDebuggerRemoteObject::_get_property_list(List<PropertyInfo> *p_list) const { - p_list->clear(); //sorry, no want category for (const List<PropertyInfo>::Element *E = prop_list.front(); E; E = E->next()) { p_list->push_back(E->get()); @@ -63,10 +62,11 @@ void EditorDebuggerRemoteObject::_get_property_list(List<PropertyInfo> *p_list) } String EditorDebuggerRemoteObject::get_title() { - if (remote_object_id.is_valid()) + if (remote_object_id.is_valid()) { return TTR("Remote ") + String(type_name) + ": " + itos(remote_object_id); - else + } else { return "<null>"; + } } Variant EditorDebuggerRemoteObject::get_variant(const StringName &p_name) { @@ -76,7 +76,6 @@ Variant EditorDebuggerRemoteObject::get_variant(const StringName &p_name) { } void EditorDebuggerRemoteObject::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_title"), &EditorDebuggerRemoteObject::get_title); ClassDB::bind_method(D_METHOD("get_variant"), &EditorDebuggerRemoteObject::get_variant); ClassDB::bind_method(D_METHOD("clear"), &EditorDebuggerRemoteObject::clear); @@ -115,12 +114,10 @@ void EditorDebuggerInspector::_notification(int p_what) { } void EditorDebuggerInspector::_object_edited(ObjectID p_id, const String &p_prop, const Variant &p_value) { - emit_signal("object_edited", p_id, p_prop, p_value); } void EditorDebuggerInspector::_object_selected(ObjectID p_object) { - emit_signal("object_selected", p_object); } @@ -147,7 +144,6 @@ ObjectID EditorDebuggerInspector::add_object(const Array &p_arr) { int new_props_added = 0; Set<String> changed; for (int i = 0; i < obj.properties.size(); i++) { - PropertyInfo &pinfo = obj.properties[i].first; Variant &var = obj.properties[i].second; @@ -187,7 +183,6 @@ ObjectID EditorDebuggerInspector::add_object(const Array &p_arr) { new_props_added++; debugObj->prop_values[pinfo.name] = var; } else { - if (bool(Variant::evaluate(Variant::OP_NOT_EQUAL, debugObj->prop_values[pinfo.name], var))) { debugObj->prop_values[pinfo.name] = var; changed.insert(pinfo.name); @@ -219,13 +214,13 @@ void EditorDebuggerInspector::clear_cache() { } Object *EditorDebuggerInspector::get_object(ObjectID p_id) { - if (remote_objects.has(p_id)) + if (remote_objects.has(p_id)) { return remote_objects[p_id]; + } return nullptr; } void EditorDebuggerInspector::add_stack_variable(const Array &p_array) { - DebuggerMarshalls::ScriptStackVariable var; var.deserialize(p_array); String n = var.name; diff --git a/editor/debugger/editor_debugger_inspector.h b/editor/debugger/editor_debugger_inspector.h index f0ee7a2535..638dee3c3f 100644 --- a/editor/debugger/editor_debugger_inspector.h +++ b/editor/debugger/editor_debugger_inspector.h @@ -33,7 +33,6 @@ #include "editor/editor_inspector.h" class EditorDebuggerRemoteObject : public Object { - GDCLASS(EditorDebuggerRemoteObject, Object); protected: @@ -65,7 +64,6 @@ public: }; class EditorDebuggerInspector : public EditorInspector { - GDCLASS(EditorDebuggerInspector, EditorInspector); private: diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp index 5bfb79806e..a9c18138d8 100644 --- a/editor/debugger/editor_debugger_node.cpp +++ b/editor/debugger/editor_debugger_node.cpp @@ -50,8 +50,9 @@ void _for_all(TabContainer *p_node, const Func &p_func) { EditorDebuggerNode *EditorDebuggerNode::singleton = nullptr; EditorDebuggerNode::EditorDebuggerNode() { - if (!singleton) + if (!singleton) { singleton = this; + } add_theme_constant_override("margin_left", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_LEFT)); add_theme_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox("BottomPanelDebuggerOverride", "EditorStyles")->get_margin(MARGIN_RIGHT)); @@ -119,8 +120,9 @@ ScriptEditorDebugger *EditorDebuggerNode::_add_debugger() { void EditorDebuggerNode::_stack_frame_selected(int p_debugger) { const ScriptEditorDebugger *dbg = get_debugger(p_debugger); ERR_FAIL_COND(!dbg); - if (dbg != get_current_debugger()) + if (dbg != get_current_debugger()) { return; + } _text_editor_stack_goto(dbg); } @@ -131,8 +133,9 @@ 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(); - if (file.empty()) + if (file.empty()) { return; + } stack_script = ResourceLoader::load(file); const int line = p_debugger->get_stack_script_line() - 1; emit_signal("goto_script_line", stack_script, line); @@ -141,7 +144,6 @@ void EditorDebuggerNode::_text_editor_stack_goto(const ScriptEditorDebugger *p_d } void EditorDebuggerNode::_bind_methods() { - // LiveDebug. ClassDB::bind_method("live_debug_create_node", &EditorDebuggerNode::live_debug_create_node); ClassDB::bind_method("live_debug_instance_node", &EditorDebuggerNode::live_debug_instance_node); @@ -199,13 +201,15 @@ void EditorDebuggerNode::stop() { } // Also close all debugging sessions. _for_all(tabs, [&](ScriptEditorDebugger *dbg) { - if (dbg->is_session_active()) + if (dbg->is_session_active()) { dbg->stop(); + } }); _break_state_changed(); if (hide_on_stop) { - if (is_visible_in_tree()) + if (is_visible_in_tree()) { EditorNode::get_singleton()->hide_bottom_panel(); + } } breakpoints.clear(); set_process(false); @@ -225,8 +229,9 @@ void EditorDebuggerNode::_notification(int p_what) { break; } - if (p_what != NOTIFICATION_PROCESS || !server.is_valid()) + if (p_what != NOTIFICATION_PROCESS || !server.is_valid()) { return; + } if (!server.is_valid() || !server->is_active()) { stop(); @@ -243,7 +248,6 @@ void EditorDebuggerNode::_notification(int p_what) { }); if (error_count != last_error_count || warning_count != last_warning_count) { - _for_all(tabs, [&](ScriptEditorDebugger *dbg) { dbg->update_tabs(); }); @@ -287,8 +291,9 @@ void EditorDebuggerNode::_notification(int p_what) { if (server->is_connection_available()) { ScriptEditorDebugger *debugger = nullptr; _for_all(tabs, [&](ScriptEditorDebugger *dbg) { - if (debugger || dbg->is_session_active()) + if (debugger || dbg->is_session_active()) { return; + } debugger = dbg; }); if (debugger == nullptr) { @@ -327,8 +332,9 @@ void EditorDebuggerNode::_debugger_stopped(int p_id) { bool found = false; _for_all(tabs, [&](ScriptEditorDebugger *p_debugger) { - if (p_debugger->is_session_active()) + if (p_debugger->is_session_active()) { found = true; + } }); if (!found) { EditorNode::get_singleton()->get_pause_button()->set_pressed(false); @@ -342,8 +348,9 @@ void EditorDebuggerNode::_debugger_stopped(int p_id) { void EditorDebuggerNode::_debugger_wants_stop(int p_id) { // Ask editor to kill PID. int pid = get_debugger(p_id)->get_remote_pid(); - if (pid) + if (pid) { EditorNode::get_singleton()->call_deferred("stop_child_process", pid); + } } void EditorDebuggerNode::_debugger_changed(int p_tab) { @@ -382,12 +389,14 @@ void EditorDebuggerNode::set_script_debug_button(MenuButton *p_button) { void EditorDebuggerNode::_break_state_changed() { const bool breaked = get_current_debugger()->is_breaked(); const bool can_debug = get_current_debugger()->is_debuggable(); - if (breaked) // Show debugger. + if (breaked) { // Show debugger. EditorNode::get_singleton()->make_bottom_panel_item_visible(this); + } // Update script menu. - if (!script_menu) + if (!script_menu) { return; + } PopupMenu *p = script_menu->get_popup(); p->set_item_disabled(p->get_item_index(DEBUG_NEXT), !(breaked && can_debug)); p->set_item_disabled(p->get_item_index(DEBUG_STEP), !(breaked && can_debug)); @@ -436,8 +445,9 @@ void EditorDebuggerNode::_paused() { void EditorDebuggerNode::_breaked(bool p_breaked, bool p_can_debug, int p_debugger) { if (get_current_debugger() != get_debugger(p_debugger)) { - if (!p_breaked) + if (!p_breaked) { return; + } tabs->set_current_tab(p_debugger); } _break_state_changed(); @@ -488,58 +498,67 @@ void EditorDebuggerNode::request_remote_tree() { } void EditorDebuggerNode::_remote_tree_updated(int p_debugger) { - if (p_debugger != tabs->get_current_tab()) + if (p_debugger != tabs->get_current_tab()) { return; + } remote_scene_tree->clear(); remote_scene_tree->update_scene_tree(get_current_debugger()->get_remote_tree(), p_debugger); } void EditorDebuggerNode::_remote_object_updated(ObjectID p_id, int p_debugger) { - if (p_debugger != tabs->get_current_tab()) + if (p_debugger != tabs->get_current_tab()) { return; + } if (EditorDebuggerRemoteObject *obj = get_inspected_remote_object()) { - if (obj->remote_object_id == p_id) + if (obj->remote_object_id == p_id) { return; // Already being edited + } } EditorNode::get_singleton()->push_item(get_current_debugger()->get_remote_object(p_id)); } void EditorDebuggerNode::_remote_object_property_updated(ObjectID p_id, const String &p_property, int p_debugger) { - if (p_debugger != tabs->get_current_tab()) + if (p_debugger != tabs->get_current_tab()) { return; + } if (EditorDebuggerRemoteObject *obj = get_inspected_remote_object()) { - if (obj->remote_object_id != p_id) + if (obj->remote_object_id != p_id) { return; + } EditorNode::get_singleton()->get_inspector()->update_property(p_property); } } void EditorDebuggerNode::_remote_object_requested(ObjectID p_id, int p_debugger) { - if (p_debugger != tabs->get_current_tab()) + if (p_debugger != tabs->get_current_tab()) { return; + } inspect_edited_object_timeout = 0.7; // Temporarily disable timeout to avoid multiple requests. get_current_debugger()->request_remote_object(p_id); } void EditorDebuggerNode::_save_node_requested(ObjectID p_id, const String &p_file, int p_debugger) { - if (p_debugger != tabs->get_current_tab()) + if (p_debugger != tabs->get_current_tab()) { return; + } get_current_debugger()->save_node(p_id, p_file); } // Remote inspector/edit. void EditorDebuggerNode::_method_changeds(void *p_ud, Object *p_base, const StringName &p_name, VARIANT_ARG_DECLARE) { - if (!singleton) + if (!singleton) { return; + } _for_all(singleton->tabs, [&](ScriptEditorDebugger *dbg) { dbg->_method_changed(p_base, p_name, VARIANT_ARG_PASS); }); } void EditorDebuggerNode::_property_changeds(void *p_ud, Object *p_base, const StringName &p_property, const Variant &p_value) { - if (!singleton) + if (!singleton) { return; + } _for_all(singleton->tabs, [&](ScriptEditorDebugger *dbg) { dbg->_property_changed(p_base, p_property, p_value); }); @@ -547,46 +566,53 @@ void EditorDebuggerNode::_property_changeds(void *p_ud, Object *p_base, const St // LiveDebug void EditorDebuggerNode::set_live_debugging(bool p_enabled) { - _for_all(tabs, [&](ScriptEditorDebugger *dbg) { dbg->set_live_debugging(p_enabled); }); } + void EditorDebuggerNode::update_live_edit_root() { _for_all(tabs, [&](ScriptEditorDebugger *dbg) { dbg->update_live_edit_root(); }); } + void EditorDebuggerNode::live_debug_create_node(const NodePath &p_parent, const String &p_type, const String &p_name) { _for_all(tabs, [&](ScriptEditorDebugger *dbg) { dbg->live_debug_create_node(p_parent, p_type, p_name); }); } + void EditorDebuggerNode::live_debug_instance_node(const NodePath &p_parent, const String &p_path, const String &p_name) { _for_all(tabs, [&](ScriptEditorDebugger *dbg) { dbg->live_debug_instance_node(p_parent, p_path, p_name); }); } + void EditorDebuggerNode::live_debug_remove_node(const NodePath &p_at) { _for_all(tabs, [&](ScriptEditorDebugger *dbg) { dbg->live_debug_remove_node(p_at); }); } + void EditorDebuggerNode::live_debug_remove_and_keep_node(const NodePath &p_at, ObjectID p_keep_id) { _for_all(tabs, [&](ScriptEditorDebugger *dbg) { dbg->live_debug_remove_and_keep_node(p_at, p_keep_id); }); } + void EditorDebuggerNode::live_debug_restore_node(ObjectID p_id, const NodePath &p_at, int p_at_pos) { _for_all(tabs, [&](ScriptEditorDebugger *dbg) { dbg->live_debug_restore_node(p_id, p_at, p_at_pos); }); } + void EditorDebuggerNode::live_debug_duplicate_node(const NodePath &p_at, const String &p_new_name) { _for_all(tabs, [&](ScriptEditorDebugger *dbg) { dbg->live_debug_duplicate_node(p_at, p_new_name); }); } + void EditorDebuggerNode::live_debug_reparent_node(const NodePath &p_at, const NodePath &p_new_place, const String &p_new_name, int p_at_pos) { _for_all(tabs, [&](ScriptEditorDebugger *dbg) { dbg->live_debug_reparent_node(p_at, p_new_place, p_new_name, p_at_pos); diff --git a/editor/debugger/editor_debugger_node.h b/editor/debugger/editor_debugger_node.h index 88b82d37fd..ff9601c026 100644 --- a/editor/debugger/editor_debugger_node.h +++ b/editor/debugger/editor_debugger_node.h @@ -42,7 +42,6 @@ class ScriptEditorDebugger; class TabContainer; class EditorDebuggerNode : public MarginContainer { - GDCLASS(EditorDebuggerNode, MarginContainer); public: @@ -71,8 +70,9 @@ private: int line = 0; bool operator<(const Breakpoint &p_b) const { - if (line == p_b.line) + if (line == p_b.line) { return source < p_b.source; + } return line < p_b.line; } diff --git a/editor/debugger/editor_debugger_server.cpp b/editor/debugger/editor_debugger_server.cpp index 33f20d9a12..0b655044a8 100644 --- a/editor/debugger/editor_debugger_server.cpp +++ b/editor/debugger/editor_debugger_server.cpp @@ -39,7 +39,6 @@ #include "editor/editor_settings.h" class EditorDebuggerServerTCP : public EditorDebuggerServer { - private: Ref<TCP_Server> server; diff --git a/editor/debugger/editor_debugger_server.h b/editor/debugger/editor_debugger_server.h index 515ffce628..10a9a232ab 100644 --- a/editor/debugger/editor_debugger_server.h +++ b/editor/debugger/editor_debugger_server.h @@ -35,7 +35,6 @@ #include "core/reference.h" class EditorDebuggerServer : public Reference { - public: typedef EditorDebuggerServer *(*CreateServerFunc)(const String &p_uri); diff --git a/editor/debugger/editor_debugger_tree.cpp b/editor/debugger/editor_debugger_tree.cpp index c2b94c79bb..0b5f865a98 100644 --- a/editor/debugger/editor_debugger_tree.cpp +++ b/editor/debugger/editor_debugger_tree.cpp @@ -64,7 +64,6 @@ void EditorDebuggerTree::_bind_methods() { } void EditorDebuggerTree::_scene_tree_selected() { - if (updating_scene_tree) { return; } @@ -80,15 +79,14 @@ void EditorDebuggerTree::_scene_tree_selected() { } void EditorDebuggerTree::_scene_tree_folded(Object *p_obj) { - if (updating_scene_tree) { - return; } TreeItem *item = Object::cast_to<TreeItem>(p_obj); - if (!item) + if (!item) { return; + } ObjectID id = ObjectID(uint64_t(item->get_metadata(0))); if (unfold_cache.has(id)) { @@ -99,10 +97,10 @@ void EditorDebuggerTree::_scene_tree_folded(Object *p_obj) { } void EditorDebuggerTree::_scene_tree_rmb_selected(const Vector2 &p_position) { - TreeItem *item = get_item_at_position(p_position); - if (!item) + if (!item) { return; + } item->select(0); @@ -180,12 +178,14 @@ void EditorDebuggerTree::update_scene_tree(const SceneDebuggerTree *p_tree, int // Apply filters. while (parent) { const bool had_siblings = item->get_prev() || item->get_next(); - if (filter.is_subsequence_ofi(item->get_text(0))) + if (filter.is_subsequence_ofi(item->get_text(0))) { break; // Filter matches, must survive. + } parent->remove_child(item); memdelete(item); - if (had_siblings) + if (had_siblings) { break; // Parent must survive. + } item = parent; parent = item->get_parent(); // Check if parent expects more children. @@ -203,8 +203,9 @@ void EditorDebuggerTree::update_scene_tree(const SceneDebuggerTree *p_tree, int } String EditorDebuggerTree::get_selected_path() { - if (!get_selected()) + if (!get_selected()) { return ""; + } return _get_path(get_selected()); } @@ -224,11 +225,8 @@ String EditorDebuggerTree::_get_path(TreeItem *p_item) { } void EditorDebuggerTree::_item_menu_id_pressed(int p_option) { - switch (p_option) { - case ITEM_MENU_SAVE_REMOTE_NODE: { - file_dialog->set_access(EditorFileDialog::ACCESS_RESOURCES); file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); @@ -243,7 +241,6 @@ void EditorDebuggerTree::_item_menu_id_pressed(int p_option) { file_dialog->popup_centered_ratio(); } break; case ITEM_MENU_COPY_NODE_PATH: { - String text = get_selected_path(); if (text.empty()) { return; @@ -264,7 +261,8 @@ void EditorDebuggerTree::_item_menu_id_pressed(int p_option) { } void EditorDebuggerTree::_file_selected(const String &p_file) { - if (inspected_object_id.is_null()) + if (inspected_object_id.is_null()) { return; + } emit_signal("save_node", inspected_object_id, p_file, debugger_id); } diff --git a/editor/debugger/editor_debugger_tree.h b/editor/debugger/editor_debugger_tree.h index 342eb23194..5ec1423c07 100644 --- a/editor/debugger/editor_debugger_tree.h +++ b/editor/debugger/editor_debugger_tree.h @@ -37,7 +37,6 @@ class SceneDebuggerTree; class EditorFileDialog; class EditorDebuggerTree : public Tree { - GDCLASS(EditorDebuggerTree, Tree); private: diff --git a/editor/debugger/editor_network_profiler.cpp b/editor/debugger/editor_network_profiler.cpp index b8c795d9ca..baa88bcdbc 100644 --- a/editor/debugger/editor_network_profiler.cpp +++ b/editor/debugger/editor_network_profiler.cpp @@ -39,7 +39,6 @@ void EditorNetworkProfiler::_bind_methods() { } void EditorNetworkProfiler::_notification(int p_what) { - if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { activate->set_icon(get_theme_icon("Play", "EditorIcons")); clear_button->set_icon(get_theme_icon("Clear", "EditorIcons")); @@ -53,13 +52,11 @@ void EditorNetworkProfiler::_notification(int p_what) { } void EditorNetworkProfiler::_update_frame() { - counters_display->clear(); TreeItem *root = counters_display->create_item(); for (Map<ObjectID, DebuggerMarshalls::MultiplayerNodeInfo>::Element *E = nodes_data.front(); E; E = E->next()) { - TreeItem *node = counters_display->create_item(root); for (int j = 0; j < counters_display->get_columns(); ++j) { @@ -75,7 +72,6 @@ void EditorNetworkProfiler::_update_frame() { } void EditorNetworkProfiler::_activate_pressed() { - if (activate->is_pressed()) { activate->set_icon(get_theme_icon("Stop", "EditorIcons")); activate->set_text(TTR("Stop")); @@ -96,7 +92,6 @@ void EditorNetworkProfiler::_clear_pressed() { } void EditorNetworkProfiler::add_node_frame_data(const DebuggerMarshalls::MultiplayerNodeInfo p_frame) { - if (!nodes_data.has(p_frame.node)) { nodes_data.insert(p_frame.node, p_frame); } else { @@ -113,7 +108,6 @@ void EditorNetworkProfiler::add_node_frame_data(const DebuggerMarshalls::Multipl } void EditorNetworkProfiler::set_bandwidth(int p_incoming, int p_outgoing) { - 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))); @@ -131,7 +125,6 @@ bool EditorNetworkProfiler::is_profiling() { } EditorNetworkProfiler::EditorNetworkProfiler() { - HBoxContainer *hb = memnew(HBoxContainer); hb->add_theme_constant_override("separation", 8 * EDSCALE); add_child(hb); diff --git a/editor/debugger/editor_network_profiler.h b/editor/debugger/editor_network_profiler.h index f532dc5dd0..cf65fb5316 100644 --- a/editor/debugger/editor_network_profiler.h +++ b/editor/debugger/editor_network_profiler.h @@ -39,7 +39,6 @@ #include "scene/gui/tree.h" class EditorNetworkProfiler : public VBoxContainer { - GDCLASS(EditorNetworkProfiler, VBoxContainer) private: diff --git a/editor/debugger/editor_profiler.cpp b/editor/debugger/editor_profiler.cpp index 347de2470b..8bd21fff5c 100644 --- a/editor/debugger/editor_profiler.cpp +++ b/editor/debugger/editor_profiler.cpp @@ -35,7 +35,6 @@ #include "editor/editor_settings.h" void EditorProfiler::_make_metric_ptrs(Metric &m) { - for (int i = 0; i < m.categories.size(); i++) { m.category_ptrs[m.categories[i].signature] = &m.categories.write[i]; for (int j = 0; j < m.categories[i].items.size(); j++) { @@ -45,10 +44,10 @@ void EditorProfiler::_make_metric_ptrs(Metric &m) { } void EditorProfiler::add_frame_metric(const Metric &p_metric, bool p_final) { - ++last_metric; - if (last_metric >= frame_metrics.size()) + if (last_metric >= frame_metrics.size()) { last_metric = 0; + } frame_metrics.write[last_metric] = p_metric; _make_metric_ptrs(frame_metrics.write[last_metric]); @@ -69,7 +68,6 @@ void EditorProfiler::add_frame_metric(const Metric &p_metric, bool p_final) { updating_frame = false; if (frame_delay->is_stopped()) { - frame_delay->set_wait_time(p_final ? 0.1 : 1); frame_delay->start(); } @@ -81,7 +79,6 @@ void EditorProfiler::add_frame_metric(const Metric &p_metric, bool p_final) { } void EditorProfiler::clear() { - int metric_size = EditorSettings::get_singleton()->get("debugger/profiler_frame_history_size"); metric_size = CLAMP(metric_size, 60, 1024); frame_metrics.clear(); @@ -110,7 +107,6 @@ static String _get_percent_txt(float p_value, float p_total) { } String EditorProfiler::_get_time_as_text(const Metric &m, float p_time, int p_calls) { - const int dmode = display_mode->get_selected(); if (dmode == DISPLAY_FRAME_TIME) { @@ -131,7 +127,6 @@ String EditorProfiler::_get_time_as_text(const Metric &m, float p_time, int p_ca } Color EditorProfiler::_get_color_from_signature(const StringName &p_signature) const { - Color bc = get_theme_color("error_color", "Editor"); double rot = ABS(double(p_signature.hash()) / double(0x7FFFFFFF)); Color c; @@ -140,20 +135,22 @@ Color EditorProfiler::_get_color_from_signature(const StringName &p_signature) c } void EditorProfiler::_item_edited() { - - if (updating_frame) + if (updating_frame) { return; + } TreeItem *item = variables->get_edited(); - if (!item) + if (!item) { return; + } StringName signature = item->get_metadata(0); bool checked = item->is_checked(0); - if (checked) + if (checked) { plot_sigs.insert(signature); - else + } else { plot_sigs.erase(signature); + } if (!frame_delay->is_processing()) { frame_delay->set_wait_time(0.1); @@ -164,7 +161,6 @@ void EditorProfiler::_item_edited() { } void EditorProfiler::_update_plot() { - const int w = graph->get_size().width; const int h = graph->get_size().height; bool reset_texture = false; @@ -193,11 +189,11 @@ void EditorProfiler::_update_plot() { for (int i = 0; i < frame_metrics.size(); i++) { const Metric &m = frame_metrics[i]; - if (!m.valid) + if (!m.valid) { continue; + } for (Set<StringName>::Element *E = plot_sigs.front(); E; E = E->next()) { - const Map<StringName, Metric::Category *>::Element *F = m.category_ptrs.find(E->get()); if (F) { highest = MAX(F->get()->total_time, highest); @@ -228,7 +224,6 @@ void EditorProfiler::_update_plot() { //Map<StringName,int> plot_max; for (int i = 0; i < w; i++) { - for (int j = 0; j < h * 4; j++) { column[j] = 0; } @@ -238,15 +233,14 @@ void EditorProfiler::_update_plot() { if (next > frame_metrics.size()) { next = frame_metrics.size(); } - if (next == current) + if (next == current) { next = current + 1; //just because for loop must work + } for (Set<StringName>::Element *E = plot_sigs.front(); E; E = E->next()) { - int plot_pos = -1; for (int j = current; j < next; j++) { - //wrap int idx = last_metric + 1 + j; while (idx >= frame_metrics.size()) { @@ -255,8 +249,9 @@ void EditorProfiler::_update_plot() { //get const Metric &m = frame_metrics[idx]; - if (!m.valid) + if (!m.valid) { continue; //skip because invalid + } float value = 0; @@ -292,7 +287,6 @@ void EditorProfiler::_update_plot() { } if (prev_plot != -1 && plot_pos == -1) { - plot_pos = prev_plot; } @@ -310,7 +304,6 @@ void EditorProfiler::_update_plot() { Color col = _get_color_from_signature(E->get()); for (int j = prev_plot; j <= plot_pos; j++) { - column[j * 4 + 0] += Math::fast_ftoi(CLAMP(col.r * 255, 0, 255)); column[j * 4 + 1] += Math::fast_ftoi(CLAMP(col.g * 255, 0, 255)); column[j * 4 + 2] += Math::fast_ftoi(CLAMP(col.b * 255, 0, 255)); @@ -319,7 +312,6 @@ void EditorProfiler::_update_plot() { } for (int j = 0; j < h * 4; j += 4) { - const int a = column[j + 3]; if (a > 0) { column[j + 0] /= a; @@ -347,7 +339,6 @@ void EditorProfiler::_update_plot() { img->create(w, h, false, Image::FORMAT_RGBA8, graph_image); if (reset_texture) { - if (graph_texture.is_null()) { graph_texture.instance(); } @@ -361,7 +352,6 @@ void EditorProfiler::_update_plot() { } void EditorProfiler::_update_frame() { - int cursor_metric = _get_cursor_index(); ERR_FAIL_INDEX(cursor_metric, frame_metrics.size()); @@ -375,7 +365,6 @@ void EditorProfiler::_update_frame() { int dtime = display_time->get_selected(); for (int i = 0; i < m.categories.size(); i++) { - TreeItem *category = variables->create_item(root); category->set_cell_mode(0, TreeItem::CELL_MODE_CHECK); category->set_editable(0, true); @@ -418,7 +407,6 @@ void EditorProfiler::_update_frame() { } void EditorProfiler::_activate_pressed() { - if (activate->is_pressed()) { activate->set_icon(get_theme_icon("Stop", "EditorIcons")); activate->set_text(TTR("Stop")); @@ -430,13 +418,11 @@ void EditorProfiler::_activate_pressed() { } void EditorProfiler::_clear_pressed() { - clear(); _update_plot(); } void EditorProfiler::_notification(int p_what) { - if (p_what == NOTIFICATION_ENTER_TREE) { activate->set_icon(get_theme_icon("Play", "EditorIcons")); clear_button->set_icon(get_theme_icon("Clear", "EditorIcons")); @@ -444,15 +430,15 @@ void EditorProfiler::_notification(int p_what) { } void EditorProfiler::_graph_tex_draw() { - - if (last_metric < 0) + if (last_metric < 0) { return; + } if (seeking) { - int max_frames = frame_metrics.size(); int frame = cursor_metric_edit->get_value() - (frame_metrics[last_metric].frame_number - max_frames + 1); - if (frame < 0) + if (frame < 0) { frame = 0; + } int cur_x = frame * graph->get_size().x / max_frames; @@ -460,11 +446,11 @@ void EditorProfiler::_graph_tex_draw() { } if (hover_metric != -1 && frame_metrics[hover_metric].valid) { - int max_frames = frame_metrics.size(); int frame = frame_metrics[hover_metric].frame_number - (frame_metrics[last_metric].frame_number - max_frames + 1); - if (frame < 0) + if (frame < 0) { frame = 0; + } int cur_x = frame * graph->get_size().x / max_frames; @@ -473,23 +459,23 @@ void EditorProfiler::_graph_tex_draw() { } void EditorProfiler::_graph_tex_mouse_exit() { - hover_metric = -1; graph->update(); } void EditorProfiler::_cursor_metric_changed(double) { - if (updating_frame) + if (updating_frame) { return; + } graph->update(); _update_frame(); } void EditorProfiler::_graph_tex_input(const Ref<InputEvent> &p_ev) { - - if (last_metric < 0) + if (last_metric < 0) { return; + } Ref<InputEventMouse> me = p_ev; Ref<InputEventMouseButton> mb = p_ev; @@ -498,7 +484,6 @@ void EditorProfiler::_graph_tex_input(const Ref<InputEvent> &p_ev) { if ( (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) || (mm.is_valid())) { - int x = me->get_position().x; x = x * frame_metrics.size() / graph->get_size().width; @@ -519,7 +504,6 @@ void EditorProfiler::_graph_tex_input(const Ref<InputEvent> &p_ev) { } if (show_hover) { - hover_metric = metric; } else { @@ -533,19 +517,20 @@ void EditorProfiler::_graph_tex_input(const Ref<InputEvent> &p_ev) { //metric may be invalid, so look for closest metric that is valid, this makes snap feel better bool valid = false; for (int i = 0; i < frame_metrics.size(); i++) { - if (frame_metrics[metric].valid) { valid = true; break; } metric++; - if (metric >= frame_metrics.size()) + if (metric >= frame_metrics.size()) { metric = 0; + } } - if (valid) + if (valid) { cursor_metric_edit->set_value(frame_metrics[metric].frame_number); + } updating_frame = false; @@ -568,11 +553,12 @@ void EditorProfiler::_graph_tex_input(const Ref<InputEvent> &p_ev) { } int EditorProfiler::_get_cursor_index() const { - - if (last_metric < 0) + if (last_metric < 0) { return 0; - if (!frame_metrics[last_metric].valid) + } + if (!frame_metrics[last_metric].valid) { return 0; + } int diff = (frame_metrics[last_metric].frame_number - cursor_metric_edit->get_value()); @@ -585,25 +571,21 @@ int EditorProfiler::_get_cursor_index() const { } void EditorProfiler::disable_seeking() { - seeking = false; graph->update(); } void EditorProfiler::_combo_changed(int) { - _update_frame(); _update_plot(); } void EditorProfiler::_bind_methods() { - ADD_SIGNAL(MethodInfo("enable_profiling", PropertyInfo(Variant::BOOL, "enable"))); ADD_SIGNAL(MethodInfo("break_request")); } void EditorProfiler::set_enabled(bool p_enable) { - activate->set_disabled(!p_enable); } @@ -623,7 +605,6 @@ Vector<Vector<String>> EditorProfiler::get_data_as_csv() const { const Vector<EditorProfiler::Metric::Category> &categories = frame_metrics[0].categories; for (int j = 0; j < categories.size(); j++) { - const EditorProfiler::Metric::Category &c = categories[j]; signatures.push_back(c.signature); @@ -640,7 +621,6 @@ Vector<Vector<String>> EditorProfiler::get_data_as_csv() const { int index = last_metric; for (int i = 0; i < frame_metrics.size(); i++) { - ++index; if (index >= frame_metrics.size()) { @@ -654,7 +634,6 @@ Vector<Vector<String>> EditorProfiler::get_data_as_csv() const { const Vector<EditorProfiler::Metric::Category> &frame_cat = frame_metrics[index].categories; for (int j = 0; j < frame_cat.size(); j++) { - const EditorProfiler::Metric::Category &c = frame_cat[j]; values.write[it++] = String::num_real(c.total_time); @@ -669,7 +648,6 @@ Vector<Vector<String>> EditorProfiler::get_data_as_csv() const { } EditorProfiler::EditorProfiler() { - HBoxContainer *hb = memnew(HBoxContainer); add_child(hb); activate = memnew(Button); diff --git a/editor/debugger/editor_profiler.h b/editor/debugger/editor_profiler.h index 4afd2c8302..aa2ef58db4 100644 --- a/editor/debugger/editor_profiler.h +++ b/editor/debugger/editor_profiler.h @@ -41,12 +41,10 @@ #include "scene/gui/tree.h" class EditorProfiler : public VBoxContainer { - GDCLASS(EditorProfiler, VBoxContainer); public: struct Metric { - bool valid; int frame_number; @@ -56,13 +54,11 @@ public: float physics_frame_time; struct Category { - StringName signature; String name; float total_time; //total for category struct Item { - StringName signature; String name; String script; diff --git a/editor/debugger/editor_visual_profiler.cpp b/editor/debugger/editor_visual_profiler.cpp index 589ef0d64e..81b42da08e 100644 --- a/editor/debugger/editor_visual_profiler.cpp +++ b/editor/debugger/editor_visual_profiler.cpp @@ -35,10 +35,10 @@ #include "editor/editor_settings.h" void EditorVisualProfiler::add_frame_metric(const Metric &p_metric) { - ++last_metric; - if (last_metric >= frame_metrics.size()) + if (last_metric >= frame_metrics.size()) { last_metric = 0; + } frame_metrics.write[last_metric] = p_metric; // _make_metric_ptrs(frame_metrics.write[last_metric]); @@ -60,7 +60,6 @@ void EditorVisualProfiler::add_frame_metric(const Metric &p_metric) { } if (name[0] == '>') { - stack.push_back(full_name + "/"); } @@ -83,7 +82,6 @@ void EditorVisualProfiler::add_frame_metric(const Metric &p_metric) { updating_frame = false; if (frame_delay->is_stopped()) { - frame_delay->set_wait_time(0.1); frame_delay->start(); } @@ -95,7 +93,6 @@ void EditorVisualProfiler::add_frame_metric(const Metric &p_metric) { } void EditorVisualProfiler::clear() { - int metric_size = EditorSettings::get_singleton()->get("debugger/profiler_frame_history_size"); metric_size = CLAMP(metric_size, 60, 1024); frame_metrics.clear(); @@ -114,7 +111,6 @@ void EditorVisualProfiler::clear() { } String EditorVisualProfiler::_get_time_as_text(float p_time) { - int dmode = display_mode->get_selected(); if (dmode == DISPLAY_FRAME_TIME) { @@ -127,7 +123,6 @@ String EditorVisualProfiler::_get_time_as_text(float p_time) { } Color EditorVisualProfiler::_get_color_from_signature(const StringName &p_signature) const { - Color bc = get_theme_color("error_color", "Editor"); double rot = ABS(double(p_signature.hash()) / double(0x7FFFFFFF)); Color c; @@ -136,19 +131,19 @@ Color EditorVisualProfiler::_get_color_from_signature(const StringName &p_signat } void EditorVisualProfiler::_item_selected() { - - if (updating_frame) + if (updating_frame) { return; + } TreeItem *item = variables->get_selected(); - if (!item) + if (!item) { return; + } selected_area = item->get_metadata(0); _update_plot(); } void EditorVisualProfiler::_update_plot() { - int w = graph->get_size().width; int h = graph->get_size().height; @@ -178,8 +173,9 @@ void EditorVisualProfiler::_update_plot() { for (int i = 0; i < frame_metrics.size(); i++) { const Metric &m = frame_metrics[i]; - if (!m.valid) + if (!m.valid) { continue; + } if (m.areas.size()) { highest_cpu = MAX(highest_cpu, m.areas[m.areas.size() - 1].cpu_time); @@ -188,7 +184,6 @@ void EditorVisualProfiler::_update_plot() { } if (highest_cpu > 0 || highest_gpu > 0) { - if (frame_relative->is_pressed()) { highest_cpu = MAX(graph_limit, highest_cpu); highest_gpu = MAX(graph_limit, highest_gpu); @@ -225,11 +220,11 @@ void EditorVisualProfiler::_update_plot() { if (next > frame_metrics.size()) { next = frame_metrics.size(); } - if (next == current) + if (next == current) { next = current + 1; //just because for loop must work + } for (int j = current; j < next; j++) { - //wrap int idx = last_metric + 1 + j; while (idx >= frame_metrics.size()) { @@ -262,7 +257,6 @@ void EditorVisualProfiler::_update_plot() { //plot CPU for (int j = 0; j < h; j++) { - uint8_t r, g, b; if (column_cpu[j].a == 0) { @@ -283,7 +277,6 @@ void EditorVisualProfiler::_update_plot() { } //plot GPU for (int j = 0; j < h; j++) { - uint8_t r, g, b; if (column_gpu[j].a == 0) { @@ -310,7 +303,6 @@ void EditorVisualProfiler::_update_plot() { img->create(w, h, false, Image::FORMAT_RGBA8, graph_image); if (reset_texture) { - if (graph_texture.is_null()) { graph_texture.instance(); } @@ -324,7 +316,6 @@ void EditorVisualProfiler::_update_plot() { } void EditorVisualProfiler::_update_frame(bool p_focus_selected) { - int cursor_metric = _get_cursor_index(); Ref<Texture> track_icon = get_theme_icon("TrackColor", "EditorIcons"); @@ -343,7 +334,6 @@ void EditorVisualProfiler::_update_frame(bool p_focus_selected) { TreeItem *ensure_selected = nullptr; for (int i = 1; i < m.areas.size() - 1; i++) { - TreeItem *parent = stack.size() ? stack.back()->get() : root; String name = m.areas[i].name; @@ -416,7 +406,6 @@ void EditorVisualProfiler::_update_frame(bool p_focus_selected) { } void EditorVisualProfiler::_activate_pressed() { - if (activate->is_pressed()) { activate->set_icon(get_theme_icon("Stop", "EditorIcons")); activate->set_text(TTR("Stop")); @@ -429,13 +418,11 @@ void EditorVisualProfiler::_activate_pressed() { } void EditorVisualProfiler::_clear_pressed() { - clear(); _update_plot(); } void EditorVisualProfiler::_notification(int p_what) { - if (p_what == NOTIFICATION_ENTER_TREE) { activate->set_icon(get_theme_icon("Play", "EditorIcons")); clear_button->set_icon(get_theme_icon("Clear", "EditorIcons")); @@ -443,16 +430,16 @@ void EditorVisualProfiler::_notification(int p_what) { } void EditorVisualProfiler::_graph_tex_draw() { - - if (last_metric < 0) + if (last_metric < 0) { return; + } Ref<Font> font = get_theme_font("font", "Label"); if (seeking) { - int max_frames = frame_metrics.size(); int frame = cursor_metric_edit->get_value() - (frame_metrics[last_metric].frame_number - max_frames + 1); - if (frame < 0) + if (frame < 0) { frame = 0; + } int half_width = graph->get_size().x / 2; int cur_x = frame * half_width / max_frames; @@ -503,23 +490,23 @@ void EditorVisualProfiler::_graph_tex_draw() { } void EditorVisualProfiler::_graph_tex_mouse_exit() { - hover_metric = -1; graph->update(); } void EditorVisualProfiler::_cursor_metric_changed(double) { - if (updating_frame) + if (updating_frame) { return; + } graph->update(); _update_frame(); } void EditorVisualProfiler::_graph_tex_input(const Ref<InputEvent> &p_ev) { - - if (last_metric < 0) + if (last_metric < 0) { return; + } Ref<InputEventMouse> me = p_ev; Ref<InputEventMouseButton> mb = p_ev; @@ -528,7 +515,6 @@ void EditorVisualProfiler::_graph_tex_input(const Ref<InputEvent> &p_ev) { if ( (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) || (mm.is_valid())) { - int half_w = graph->get_size().width / 2; int x = me->get_position().x; if (x > half_w) { @@ -553,7 +539,6 @@ void EditorVisualProfiler::_graph_tex_input(const Ref<InputEvent> &p_ev) { } if (show_hover) { - hover_metric = metric; } else { @@ -567,15 +552,15 @@ void EditorVisualProfiler::_graph_tex_input(const Ref<InputEvent> &p_ev) { //metric may be invalid, so look for closest metric that is valid, this makes snap feel better bool valid = false; for (int i = 0; i < frame_metrics.size(); i++) { - if (frame_metrics[metric].valid) { valid = true; break; } metric++; - if (metric >= frame_metrics.size()) + if (metric >= frame_metrics.size()) { metric = 0; + } } if (!valid) { @@ -607,7 +592,6 @@ void EditorVisualProfiler::_graph_tex_input(const Ref<InputEvent> &p_ev) { int last_valid = -1; bool found = false; for (int i = 0; i < area_count - 1; i++) { - if (areas[i].name[0] != '<' && areas[i].name[0] != '>') { last_valid = i; } @@ -636,11 +620,12 @@ void EditorVisualProfiler::_graph_tex_input(const Ref<InputEvent> &p_ev) { } int EditorVisualProfiler::_get_cursor_index() const { - - if (last_metric < 0) + if (last_metric < 0) { return 0; - if (!frame_metrics[last_metric].valid) + } + if (!frame_metrics[last_metric].valid) { return 0; + } int diff = (frame_metrics[last_metric].frame_number - cursor_metric_edit->get_value()); @@ -653,24 +638,20 @@ int EditorVisualProfiler::_get_cursor_index() const { } void EditorVisualProfiler::disable_seeking() { - seeking = false; graph->update(); } void EditorVisualProfiler::_combo_changed(int) { - _update_frame(); _update_plot(); } void EditorVisualProfiler::_bind_methods() { - ADD_SIGNAL(MethodInfo("enable_profiling", PropertyInfo(Variant::BOOL, "enable"))); } void EditorVisualProfiler::set_enabled(bool p_enable) { - activate->set_disabled(!p_enable); } @@ -736,7 +717,6 @@ Vector<Vector<String>> EditorVisualProfiler::get_data_as_csv() const { } EditorVisualProfiler::EditorVisualProfiler() { - HBoxContainer *hb = memnew(HBoxContainer); add_child(hb); activate = memnew(Button); diff --git a/editor/debugger/editor_visual_profiler.h b/editor/debugger/editor_visual_profiler.h index d3a758557c..3c1a55dc38 100644 --- a/editor/debugger/editor_visual_profiler.h +++ b/editor/debugger/editor_visual_profiler.h @@ -42,12 +42,10 @@ #include "scene/gui/tree.h" class EditorVisualProfiler : public VBoxContainer { - GDCLASS(EditorVisualProfiler, VBoxContainer); public: struct Metric { - bool valid; uint64_t frame_number; diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index 3ed271c7c6..49137f76fa 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -74,17 +74,19 @@ void ScriptEditorDebugger::_put_msg(String p_message, Array p_data) { void ScriptEditorDebugger::debug_copy() { String msg = reason->get_text(); - if (msg == "") + if (msg == "") { return; + } DisplayServer::get_singleton()->clipboard_set(msg); } void ScriptEditorDebugger::debug_skip_breakpoints() { skip_breakpoints_value = !skip_breakpoints_value; - if (skip_breakpoints_value) + if (skip_breakpoints_value) { skip_breakpoints->set_icon(get_theme_icon("DebugSkipBreakpointsOn", "EditorIcons")); - else + } else { skip_breakpoints->set_icon(get_theme_icon("DebugSkipBreakpointsOff", "EditorIcons")); + } Array msg; msg.push_back(skip_breakpoints_value); @@ -92,14 +94,13 @@ void ScriptEditorDebugger::debug_skip_breakpoints() { } void ScriptEditorDebugger::debug_next() { - ERR_FAIL_COND(!breaked); _put_msg("next", Array()); _clear_execution(); } -void ScriptEditorDebugger::debug_step() { +void ScriptEditorDebugger::debug_step() { ERR_FAIL_COND(!breaked); _put_msg("step", Array()); @@ -107,19 +108,18 @@ void ScriptEditorDebugger::debug_step() { } void ScriptEditorDebugger::debug_break() { - ERR_FAIL_COND(breaked); _put_msg("break", Array()); } void ScriptEditorDebugger::debug_continue() { - ERR_FAIL_COND(!breaked); // Allow focus stealing only if we actually run this client for security. - if (remote_pid && EditorNode::get_singleton()->has_child_process(remote_pid)) + if (remote_pid && EditorNode::get_singleton()->has_child_process(remote_pid)) { DisplayServer::get_singleton()->enable_for_stealing_focus(remote_pid); + } _clear_execution(); _put_msg("continue", Array()); @@ -153,7 +153,6 @@ void ScriptEditorDebugger::save_node(ObjectID p_id, const String &p_file) { } void ScriptEditorDebugger::_file_selected(const String &p_file) { - switch (file_dialog_purpose) { case SAVE_MONITORS_CSV: { Error err; @@ -175,10 +174,8 @@ void ScriptEditorDebugger::_file_selected(const String &p_file) { // values List<Vector<float>>::Element *E = perf_history.back(); while (E) { - Vector<float> &perf_data = E->get(); for (int i = 0; i < perf_data.size(); i++) { - line.write[i] = String::num_real(perf_data[i]); } file->store_csv_line(line); @@ -225,7 +222,6 @@ void ScriptEditorDebugger::_file_selected(const String &p_file) { } void ScriptEditorDebugger::request_remote_tree() { - _put_msg("scene:request_scene_tree", Array()); } @@ -234,7 +230,6 @@ const SceneDebuggerTree *ScriptEditorDebugger::get_remote_tree() { } void ScriptEditorDebugger::update_remote_object(ObjectID p_obj_id, const String &p_prop, const Variant &p_value) { - Array msg; msg.push_back(p_obj_id); msg.push_back(p_prop); @@ -243,7 +238,6 @@ void ScriptEditorDebugger::update_remote_object(ObjectID p_obj_id, const String } void ScriptEditorDebugger::request_remote_object(ObjectID p_obj_id) { - ERR_FAIL_COND(p_obj_id.is_null()); Array msg; msg.push_back(p_obj_id); @@ -268,12 +262,10 @@ void ScriptEditorDebugger::_remote_object_property_updated(ObjectID p_id, const } void ScriptEditorDebugger::_video_mem_request() { - _put_msg("core:memory", Array()); } void ScriptEditorDebugger::_video_mem_export() { - file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM); file_dialog->clear_filters(); @@ -282,16 +274,13 @@ void ScriptEditorDebugger::_video_mem_export() { } Size2 ScriptEditorDebugger::get_minimum_size() const { - Size2 ms = MarginContainer::get_minimum_size(); ms.y = MAX(ms.y, 250 * EDSCALE); return ms; } void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_data) { - if (p_msg == "debug_enter") { - _put_msg("get_stack_dump", Array()); ERR_FAIL_COND(p_data.size() != 2); @@ -310,7 +299,6 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da inspector->clear_cache(); // Take a chance to force remote objects update. } else if (p_msg == "debug_exit") { - breaked = false; can_debug = false; _clear_execution(); @@ -320,27 +308,23 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da profiler->set_enabled(true); profiler->disable_seeking(); } else if (p_msg == "set_pid") { - ERR_FAIL_COND(p_data.size() < 1); remote_pid = p_data[0]; } else if (p_msg == "scene:click_ctrl") { - ERR_FAIL_COND(p_data.size() < 2); clicked_ctrl->set_text(p_data[0]); clicked_ctrl_type->set_text(p_data[1]); } else if (p_msg == "scene:scene_tree") { - scene_tree->nodes.clear(); scene_tree->deserialize(p_data); emit_signal("remote_tree_updated"); _update_buttons_state(); } else if (p_msg == "scene:inspect_object") { - ObjectID id = inspector->add_object(p_data); - if (id.is_valid()) + if (id.is_valid()) { emit_signal("remote_object_updated", id); + } } else if (p_msg == "memory:usage") { - vmem_tree->clear(); TreeItem *root = vmem_tree->create_item(); DebuggerMarshalls::ResourceUsage usage; @@ -349,7 +333,6 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da int total = 0; for (List<DebuggerMarshalls::ResourceInfo>::Element *E = usage.infos.front(); E; E = E->next()) { - TreeItem *it = vmem_tree->create_item(root); String type = E->get().type; int bytes = E->get().vram; @@ -359,15 +342,15 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da it->set_text(3, String::humanize_size(bytes)); total += bytes; - if (has_theme_icon(type, "EditorIcons")) + if (has_theme_icon(type, "EditorIcons")) { it->set_icon(0, get_theme_icon(type, "EditorIcons")); + } } vmem_total->set_tooltip(TTR("Bytes:") + " " + itos(total)); vmem_total->set_text(String::humanize_size(total)); } else if (p_msg == "stack_dump") { - DebuggerMarshalls::ScriptStackDump stack; stack.deserialize(p_data); @@ -376,7 +359,6 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da TreeItem *r = stack_dump->create_item(); for (int i = 0; i < stack.frames.size(); i++) { - TreeItem *s = stack_dump->create_item(r); Dictionary d; d["frame"] = i; @@ -388,15 +370,14 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da String line = itos(i) + " - " + String(d["file"]) + ":" + itos(d["line"]) + " - at function: " + d["function"]; s->set_text(0, line); - if (i == 0) + if (i == 0) { s->select(0); + } } } else if (p_msg == "stack_frame_vars") { - inspector->clear_stack_variables(); } else if (p_msg == "stack_frame_var") { - inspector->add_stack_variable(p_data); } else if (p_msg == "output") { @@ -433,7 +414,6 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da for (int i = 0; i < p_data.size(); i++) { p.write[i] = p_data[i]; if (i < perf_items.size()) { - const float value = p[i]; String label = rtos(value); String tooltip = label; @@ -453,8 +433,9 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da perf_items[i]->set_text(1, label); perf_items[i]->set_tooltip(1, tooltip); - if (p[i] > perf_max[i]) + if (p[i] > perf_max[i]) { perf_max.write[i] = p[i]; + } } } perf_history.push_front(p); @@ -480,7 +461,6 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da visual_profiler->add_frame_metric(metric); } else if (p_msg == "error") { - DebuggerMarshalls::OutputError oe; ERR_FAIL_COND_MSG(oe.deserialize(p_data) == false, "Failed to deserialize error message"); @@ -520,8 +500,9 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da String error_title; // Include method name, when given, in error title. - if (!oe.source_func.empty()) + if (!oe.source_func.empty()) { error_title += oe.source_func + ": "; + } // If we have a (custom) error message, use it as title, and add a C++ Error // item with the original error condition. error_title += oe.error_descr.empty() ? oe.error : oe.error_descr; @@ -535,16 +516,18 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da cpp_cond->set_text(1, oe.error); cpp_cond->set_text_align(0, TreeItem::ALIGN_LEFT); tooltip += TTR("C++ Error:") + " " + oe.error + "\n"; - if (source_is_project_file) + if (source_is_project_file) { cpp_cond->set_metadata(0, source_meta); + } } Vector<uint8_t> v; v.resize(100); // Source of the error. String source_txt = (source_is_project_file ? oe.source_file.get_file() : oe.source_file) + ":" + itos(oe.source_line); - if (!oe.source_func.empty()) + if (!oe.source_func.empty()) { source_txt += " @ " + oe.source_func + "()"; + } TreeItem *cpp_source = error_tree->create_item(error); cpp_source->set_text(0, "<" + (source_is_project_file ? TTR("Source") : TTR("C++ Source")) + ">"); @@ -566,7 +549,6 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da // of the stack trace (script, method, line). const ScriptLanguage::StackInfo *infos = oe.callstack.ptr(); for (unsigned int i = 0; i < (unsigned int)oe.callstack.size(); i++) { - TreeItem *stack_trace = error_tree->create_item(error); Array meta; @@ -582,10 +564,11 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da stack_trace->set_text(1, infos[i].file.get_file() + ":" + itos(infos[i].line) + " @ " + infos[i].func + "()"); } - if (oe.warning) + if (oe.warning) { warning_count++; - else + } else { error_count++; + } } else if (p_msg == "servers:function_signature") { // Cache a profiler signature. @@ -639,7 +622,6 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da } for (int i = 0; i < frame.servers.size(); i++) { - const DebuggerMarshalls::ServerInfo &srv = frame.servers[i]; EditorProfiler::Metric::Category c; const String name = srv.name; @@ -648,7 +630,6 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da c.total_time = 0; c.signature = "categ::" + name; for (int j = 0; j < srv.functions.size(); j++) { - EditorProfiler::Metric::Category::Item item; item.calls = 1; item.line = 0; @@ -669,7 +650,6 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da funcs.name = "Script Functions"; funcs.signature = "script_functions"; for (int i = 0; i < frame.script_functions.size(); i++) { - int signature = frame.script_functions[i].sig_id; int calls = frame.script_functions[i].call_count; float total = frame.script_functions[i].total_time; @@ -677,7 +657,6 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da EditorProfiler::Metric::Category::Item item; if (profiler_signature.has(signature)) { - item.signature = profiler_signature[signature]; String name = profiler_signature[signature]; @@ -704,10 +683,11 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da metric.categories.push_back(funcs); - if (p_msg == "servers:profile_frame") + if (p_msg == "servers:profile_frame") { profiler->add_frame_metric(metric, false); - else + } else { profiler->add_frame_metric(metric, true); + } } else if (p_msg == "network:profile_frame") { DebuggerMarshalls::NetworkProfilerFrame frame; @@ -745,17 +725,15 @@ void ScriptEditorDebugger::_set_reason_text(const String &p_reason, MessageType } void ScriptEditorDebugger::_performance_select() { - perf_draw->update(); } void ScriptEditorDebugger::_performance_draw() { - Vector<int> which; for (int i = 0; i < perf_items.size(); i++) { - - if (perf_items[i]->is_checked(0)) + if (perf_items[i]->is_checked(0)) { which.push_back(i); + } } if (which.empty()) { @@ -770,14 +748,14 @@ void ScriptEditorDebugger::_performance_draw() { int cols = Math::ceil(Math::sqrt((float)which.size())); int rows = Math::ceil((float)which.size() / cols); - if (which.size() == 1) + if (which.size() == 1) { rows = 1; + } int margin = 3; int point_sep = 5; Size2i s = Size2i(perf_draw->get_size()) / Size2i(cols, rows); for (int i = 0; i < which.size(); i++) { - Point2i p(i % cols, i / cols); Rect2i r(p * s, s); r.position += Point2(margin, margin); @@ -803,15 +781,16 @@ void ScriptEditorDebugger::_performance_draw() { List<Vector<float>>::Element *E = perf_history.front(); float prev = -1; while (from >= 0 && E) { - float m = perf_max[pi]; - if (m == 0) + if (m == 0) { m = 0.00001; + } float h2 = E->get()[pi] / m; h2 = (1.0 - h2) * r.size.y; - if (E != perf_history.front()) + if (E != perf_history.front()) { perf_draw->draw_line(r.position + Point2(from, h2), r.position + Point2(from + spacing, prev), c, Math::round(EDSCALE)); + } prev = h2; E = E->next(); from -= spacing; @@ -820,11 +799,8 @@ void ScriptEditorDebugger::_performance_draw() { } void ScriptEditorDebugger::_notification(int p_what) { - switch (p_what) { - case NOTIFICATION_ENTER_TREE: { - skip_breakpoints->set_icon(get_theme_icon("DebugSkipBreakpointsOff", "EditorIcons")); copy->set_icon(get_theme_icon("ActionCopy", "EditorIcons")); @@ -843,9 +819,7 @@ void ScriptEditorDebugger::_notification(int p_what) { } break; case NOTIFICATION_PROCESS: { - if (is_session_active()) { - peer->poll(); if (camera_override == CameraOverride::OVERRIDE_2D) { @@ -886,7 +860,6 @@ void ScriptEditorDebugger::_notification(int p_what) { const uint64_t until = OS::get_singleton()->get_ticks_msec() + 20; while (peer.is_valid() && peer->has_message()) { - Array arr = peer->get_message(); if (arr.size() != 2 || arr[0].get_type() != Variant::STRING || arr[1].get_type() != Variant::ARRAY) { _stop_and_notify(); @@ -894,8 +867,9 @@ void ScriptEditorDebugger::_notification(int p_what) { } _parse_message(arr[0], arr[1]); - if (OS::get_singleton()->get_ticks_msec() > until) + if (OS::get_singleton()->get_ticks_msec() > until) { break; + } } if (!is_session_active()) { _stop_and_notify(); @@ -903,7 +877,6 @@ void ScriptEditorDebugger::_notification(int p_what) { }; } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { - if (tabs->has_theme_stylebox_override("panel")) { tabs->add_theme_style_override("panel", editor->get_gui_base()->get_theme_stylebox("DebuggerPanel", "EditorStyles")); } @@ -921,8 +894,9 @@ void ScriptEditorDebugger::_notification(int p_what) { void ScriptEditorDebugger::_clear_execution() { TreeItem *ti = stack_dump->get_selected(); - if (!ti) + if (!ti) { return; + } Dictionary d = ti->get_metadata(0); @@ -934,7 +908,6 @@ void ScriptEditorDebugger::_clear_execution() { } void ScriptEditorDebugger::start(Ref<RemoteDebuggerPeer> p_peer) { - error_count = 0; warning_count = 0; stop(); @@ -944,7 +917,6 @@ void ScriptEditorDebugger::start(Ref<RemoteDebuggerPeer> p_peer) { perf_history.clear(); for (int i = 0; i < Performance::MONITOR_MAX; i++) { - perf_max.write[i] = 0; } @@ -978,7 +950,6 @@ void ScriptEditorDebugger::_stop_and_notify() { } void ScriptEditorDebugger::stop() { - set_process(false); breaked = false; can_debug = false; @@ -1003,7 +974,6 @@ void ScriptEditorDebugger::stop() { } void ScriptEditorDebugger::_profiler_activate(bool p_enable, int p_type) { - Array data; data.push_back(p_enable); switch (p_type) { @@ -1031,14 +1001,13 @@ void ScriptEditorDebugger::_profiler_activate(bool p_enable, int p_type) { } void ScriptEditorDebugger::_profiler_seeked() { - - if (breaked) + if (breaked) { return; + } debug_break(); } void ScriptEditorDebugger::_stack_dump_frame_selected() { - emit_signal("stack_frame_selected"); int frame = get_stack_script_frame(); @@ -1053,7 +1022,6 @@ void ScriptEditorDebugger::_stack_dump_frame_selected() { } void ScriptEditorDebugger::_export_csv() { - file_dialog->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM); file_dialog_purpose = SAVE_MONITORS_CSV; @@ -1061,16 +1029,17 @@ void ScriptEditorDebugger::_export_csv() { } String ScriptEditorDebugger::get_var_value(const String &p_var) const { - if (!breaked) + if (!breaked) { return String(); + } return inspector->get_stack_variable(p_var); } int ScriptEditorDebugger::_get_node_path_cache(const NodePath &p_path) { - const int *r = node_path_cache.getptr(p_path); - if (r) + if (r) { return *r; + } last_path_id++; @@ -1084,11 +1053,11 @@ int ScriptEditorDebugger::_get_node_path_cache(const NodePath &p_path) { } int ScriptEditorDebugger::_get_res_path_cache(const String &p_path) { - Map<String, int>::Element *E = res_path_cache.find(p_path); - if (E) + if (E) { return E->get(); + } last_path_id++; @@ -1102,9 +1071,9 @@ int ScriptEditorDebugger::_get_res_path_cache(const String &p_path) { } void ScriptEditorDebugger::_method_changed(Object *p_base, const StringName &p_name, VARIANT_ARG_DECLARE) { - - if (!p_base || !live_debug || !is_session_active() || !editor->get_edited_scene()) + if (!p_base || !live_debug || !is_session_active() || !editor->get_edited_scene()) { return; + } Node *node = Object::cast_to<Node>(p_base); @@ -1112,12 +1081,12 @@ void ScriptEditorDebugger::_method_changed(Object *p_base, const StringName &p_n for (int i = 0; i < VARIANT_ARG_MAX; i++) { //no pointers, sorry - if (argptr[i] && (argptr[i]->get_type() == Variant::OBJECT || argptr[i]->get_type() == Variant::_RID)) + if (argptr[i] && (argptr[i]->get_type() == Variant::OBJECT || argptr[i]->get_type() == Variant::_RID)) { return; + } } if (node) { - NodePath path = editor->get_edited_scene()->get_path_to(node); int pathid = _get_node_path_cache(path); @@ -1136,7 +1105,6 @@ void ScriptEditorDebugger::_method_changed(Object *p_base, const StringName &p_n Resource *res = Object::cast_to<Resource>(p_base); if (res && res->get_path() != String()) { - String respath = res->get_path(); int pathid = _get_res_path_cache(respath); @@ -1154,21 +1122,19 @@ void ScriptEditorDebugger::_method_changed(Object *p_base, const StringName &p_n } void ScriptEditorDebugger::_property_changed(Object *p_base, const StringName &p_property, const Variant &p_value) { - - if (!p_base || !live_debug || !editor->get_edited_scene()) + if (!p_base || !live_debug || !editor->get_edited_scene()) { return; + } Node *node = Object::cast_to<Node>(p_base); if (node) { - NodePath path = editor->get_edited_scene()->get_path_to(node); int pathid = _get_node_path_cache(path); if (p_value.is_ref()) { Ref<Resource> res = p_value; if (res.is_valid() && res->get_path() != String()) { - Array msg; msg.push_back(pathid); msg.push_back(p_property); @@ -1176,7 +1142,6 @@ void ScriptEditorDebugger::_property_changed(Object *p_base, const StringName &p _put_msg("scene:live_node_prop_res", msg); } } else { - Array msg; msg.push_back(pathid); msg.push_back(p_property); @@ -1190,14 +1155,12 @@ void ScriptEditorDebugger::_property_changed(Object *p_base, const StringName &p Resource *res = Object::cast_to<Resource>(p_base); if (res && res->get_path() != String()) { - String respath = res->get_path(); int pathid = _get_res_path_cache(respath); if (p_value.is_ref()) { Ref<Resource> res2 = p_value; if (res2.is_valid() && res2->get_path() != String()) { - Array msg; msg.push_back(pathid); msg.push_back(p_property); @@ -1205,7 +1168,6 @@ void ScriptEditorDebugger::_property_changed(Object *p_base, const StringName &p _put_msg("scene:live_res_prop_res", msg); } } else { - Array msg; msg.push_back(pathid); msg.push_back(p_property); @@ -1219,41 +1181,44 @@ void ScriptEditorDebugger::_property_changed(Object *p_base, const StringName &p String ScriptEditorDebugger::get_stack_script_file() const { TreeItem *ti = stack_dump->get_selected(); - if (!ti) + if (!ti) { return ""; + } Dictionary d = ti->get_metadata(0); return d["file"]; } int ScriptEditorDebugger::get_stack_script_line() const { TreeItem *ti = stack_dump->get_selected(); - if (!ti) + if (!ti) { return -1; + } Dictionary d = ti->get_metadata(0); return d["line"]; } int ScriptEditorDebugger::get_stack_script_frame() const { TreeItem *ti = stack_dump->get_selected(); - if (!ti) + if (!ti) { return -1; + } Dictionary d = ti->get_metadata(0); return d["frame"]; } void ScriptEditorDebugger::set_live_debugging(bool p_enable) { - live_debug = p_enable; } void ScriptEditorDebugger::_live_edit_set() { - - if (!is_session_active() || !editor_remote_tree) + if (!is_session_active() || !editor_remote_tree) { return; + } TreeItem *ti = editor_remote_tree->get_selected(); - if (!ti) + if (!ti) { return; + } String path; @@ -1271,7 +1236,6 @@ void ScriptEditorDebugger::_live_edit_set() { } void ScriptEditorDebugger::_live_edit_clear() { - NodePath np = NodePath("/root"); editor->get_editor_data().set_edited_scene_live_edit_root(np); @@ -1279,21 +1243,20 @@ void ScriptEditorDebugger::_live_edit_clear() { } void ScriptEditorDebugger::update_live_edit_root() { - NodePath np = editor->get_editor_data().get_edited_scene_live_edit_root(); Array msg; msg.push_back(np); - if (editor->get_edited_scene()) + if (editor->get_edited_scene()) { msg.push_back(editor->get_edited_scene()->get_filename()); - else + } else { msg.push_back(""); + } _put_msg("scene:live_set_root", msg); live_edit_root->set_text(np); } void ScriptEditorDebugger::live_debug_create_node(const NodePath &p_parent, const String &p_type, const String &p_name) { - if (live_debug) { Array msg; msg.push_back(p_parent); @@ -1304,7 +1267,6 @@ void ScriptEditorDebugger::live_debug_create_node(const NodePath &p_parent, cons } void ScriptEditorDebugger::live_debug_instance_node(const NodePath &p_parent, const String &p_path, const String &p_name) { - if (live_debug) { Array msg; msg.push_back(p_parent); @@ -1313,16 +1275,16 @@ void ScriptEditorDebugger::live_debug_instance_node(const NodePath &p_parent, co _put_msg("scene:live_instance_node", msg); } } -void ScriptEditorDebugger::live_debug_remove_node(const NodePath &p_at) { +void ScriptEditorDebugger::live_debug_remove_node(const NodePath &p_at) { if (live_debug) { Array msg; msg.push_back(p_at); _put_msg("scene:live_remove_node", msg); } } -void ScriptEditorDebugger::live_debug_remove_and_keep_node(const NodePath &p_at, ObjectID p_keep_id) { +void ScriptEditorDebugger::live_debug_remove_and_keep_node(const NodePath &p_at, ObjectID p_keep_id) { if (live_debug) { Array msg; msg.push_back(p_at); @@ -1330,8 +1292,8 @@ void ScriptEditorDebugger::live_debug_remove_and_keep_node(const NodePath &p_at, _put_msg("scene:live_remove_and_keep_node", msg); } } -void ScriptEditorDebugger::live_debug_restore_node(ObjectID p_id, const NodePath &p_at, int p_at_pos) { +void ScriptEditorDebugger::live_debug_restore_node(ObjectID p_id, const NodePath &p_at, int p_at_pos) { if (live_debug) { Array msg; msg.push_back(p_id); @@ -1340,8 +1302,8 @@ void ScriptEditorDebugger::live_debug_restore_node(ObjectID p_id, const NodePath _put_msg("scene:live_restore_node", msg); } } -void ScriptEditorDebugger::live_debug_duplicate_node(const NodePath &p_at, const String &p_new_name) { +void ScriptEditorDebugger::live_debug_duplicate_node(const NodePath &p_at, const String &p_new_name) { if (live_debug) { Array msg; msg.push_back(p_at); @@ -1349,8 +1311,8 @@ void ScriptEditorDebugger::live_debug_duplicate_node(const NodePath &p_at, const _put_msg("scene:live_duplicate_node", msg); } } -void ScriptEditorDebugger::live_debug_reparent_node(const NodePath &p_at, const NodePath &p_new_place, const String &p_new_name, int p_at_pos) { +void ScriptEditorDebugger::live_debug_reparent_node(const NodePath &p_at, const NodePath &p_new_place, const String &p_new_name, int p_at_pos) { if (live_debug) { Array msg; msg.push_back(p_at); @@ -1366,7 +1328,6 @@ CameraOverride ScriptEditorDebugger::get_camera_override() const { } void ScriptEditorDebugger::set_camera_override(CameraOverride p_override) { - if (p_override == CameraOverride::OVERRIDE_2D && camera_override != CameraOverride::OVERRIDE_2D) { Array msg; msg.push_back(true); @@ -1389,7 +1350,6 @@ void ScriptEditorDebugger::set_camera_override(CameraOverride p_override) { } void ScriptEditorDebugger::set_breakpoint(const String &p_path, int p_line, bool p_enabled) { - Array msg; msg.push_back(p_path); msg.push_back(p_line); @@ -1398,7 +1358,6 @@ void ScriptEditorDebugger::set_breakpoint(const String &p_path, int p_line, bool } void ScriptEditorDebugger::reload_scripts() { - _put_msg("reload_scripts", Array()); } @@ -1426,10 +1385,10 @@ void ScriptEditorDebugger::_error_selected() { } void ScriptEditorDebugger::_expand_errors_list() { - TreeItem *root = error_tree->get_root(); - if (!root) + if (!root) { return; + } TreeItem *item = root->get_children(); while (item) { @@ -1439,10 +1398,10 @@ void ScriptEditorDebugger::_expand_errors_list() { } void ScriptEditorDebugger::_collapse_errors_list() { - TreeItem *root = error_tree->get_root(); - if (!root) + if (!root) { return; + } TreeItem *item = root->get_children(); while (item) { @@ -1452,7 +1411,6 @@ void ScriptEditorDebugger::_collapse_errors_list() { } void ScriptEditorDebugger::_clear_errors_list() { - error_tree->clear(); error_count = 0; warning_count = 0; @@ -1460,7 +1418,6 @@ void ScriptEditorDebugger::_clear_errors_list() { // Right click on specific file(s) or folder(s). void ScriptEditorDebugger::_error_tree_item_rmb_selected(const Vector2 &p_pos) { - item_menu->clear(); item_menu->set_size(Size2(1, 1)); @@ -1476,8 +1433,9 @@ void ScriptEditorDebugger::_error_tree_item_rmb_selected(const Vector2 &p_pos) { void ScriptEditorDebugger::_item_menu_id_pressed(int p_option) { TreeItem *ti = error_tree->get_selected(); - while (ti->get_parent() != error_tree->get_root()) + while (ti->get_parent() != error_tree->get_root()) { ti = ti->get_parent(); + } String type; @@ -1508,7 +1466,6 @@ void ScriptEditorDebugger::_tab_changed(int p_tab) { } void ScriptEditorDebugger::_bind_methods() { - ClassDB::bind_method(D_METHOD("live_debug_create_node"), &ScriptEditorDebugger::live_debug_create_node); ClassDB::bind_method(D_METHOD("live_debug_instance_node"), &ScriptEditorDebugger::live_debug_instance_node); ClassDB::bind_method(D_METHOD("live_debug_remove_node"), &ScriptEditorDebugger::live_debug_remove_node); @@ -1533,7 +1490,6 @@ void ScriptEditorDebugger::_bind_methods() { } ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { - editor = p_editor; tabs = memnew(TabContainer); @@ -1729,7 +1685,6 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { TreeItem *root = perf_monitors->create_item(); perf_monitors->set_hide_root(true); for (int i = 0; i < Performance::MONITOR_MAX; i++) { - String n = Performance::get_singleton()->get_monitor_name(Performance::Monitor(i)); Performance::MonitorType mtype = Performance::get_singleton()->get_monitor_type(Performance::Monitor(i)); String base = n.get_slice("/", 0); @@ -1866,7 +1821,6 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { } ScriptEditorDebugger::~ScriptEditorDebugger() { - if (peer.is_valid()) { peer->close(); peer.unref(); diff --git a/editor/debugger/script_editor_debugger.h b/editor/debugger/script_editor_debugger.h index a08a7c67c2..2984051aa1 100644 --- a/editor/debugger/script_editor_debugger.h +++ b/editor/debugger/script_editor_debugger.h @@ -55,7 +55,6 @@ class EditorNetworkProfiler; class SceneDebuggerTree; class ScriptEditorDebugger : public MarginContainer { - GDCLASS(ScriptEditorDebugger, MarginContainer); friend class EditorDebuggerNode; |