diff options
Diffstat (limited to 'editor/debugger')
-rw-r--r-- | editor/debugger/editor_debugger_inspector.cpp | 4 | ||||
-rw-r--r-- | editor/debugger/editor_debugger_inspector.h | 2 | ||||
-rw-r--r-- | editor/debugger/editor_profiler.cpp | 22 | ||||
-rw-r--r-- | editor/debugger/editor_profiler.h | 3 | ||||
-rw-r--r-- | editor/debugger/script_editor_debugger.cpp | 9 |
5 files changed, 28 insertions, 12 deletions
diff --git a/editor/debugger/editor_debugger_inspector.cpp b/editor/debugger/editor_debugger_inspector.cpp index 6c0ba55ec8..7ea6cedd2b 100644 --- a/editor/debugger/editor_debugger_inspector.cpp +++ b/editor/debugger/editor_debugger_inspector.cpp @@ -36,7 +36,7 @@ #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 (!prop_values.has(p_name) || String(p_name).begins_with("Constants/")) { return false; } @@ -85,14 +85,12 @@ void EditorDebuggerRemoteObject::_bind_methods() { ClassDB::bind_method(D_METHOD("get_variant"), &EditorDebuggerRemoteObject::get_variant); ClassDB::bind_method(D_METHOD("clear"), &EditorDebuggerRemoteObject::clear); ClassDB::bind_method(D_METHOD("get_remote_object_id"), &EditorDebuggerRemoteObject::get_remote_object_id); - ClassDB::bind_method(D_METHOD("_is_read_only"), &EditorDebuggerRemoteObject::_is_read_only); ADD_SIGNAL(MethodInfo("value_edited", PropertyInfo(Variant::INT, "object_id"), PropertyInfo(Variant::STRING, "property"), PropertyInfo("value"))); } EditorDebuggerInspector::EditorDebuggerInspector() { variables = memnew(EditorDebuggerRemoteObject); - variables->editable = false; } EditorDebuggerInspector::~EditorDebuggerInspector() { diff --git a/editor/debugger/editor_debugger_inspector.h b/editor/debugger/editor_debugger_inspector.h index c595e0acaa..d835f5fa42 100644 --- a/editor/debugger/editor_debugger_inspector.h +++ b/editor/debugger/editor_debugger_inspector.h @@ -43,14 +43,12 @@ protected: static void _bind_methods(); public: - bool editable = false; ObjectID remote_object_id; String type_name; List<PropertyInfo> prop_list; HashMap<StringName, Variant> prop_values; ObjectID get_remote_object_id() { return remote_object_id; }; - bool _is_read_only() { return true; }; String get_title(); Variant get_variant(const StringName &p_name); diff --git a/editor/debugger/editor_profiler.cpp b/editor/debugger/editor_profiler.cpp index cf48366bd3..a882275375 100644 --- a/editor/debugger/editor_profiler.cpp +++ b/editor/debugger/editor_profiler.cpp @@ -104,6 +104,10 @@ void EditorProfiler::clear() { updating_frame = false; hover_metric = -1; seeking = false; + + // Ensure button text (start, stop) is correct + _set_button_text(); + emit_signal(SNAME("enable_profiling"), activate->is_pressed()); } static String _get_percent_txt(float p_value, float p_total) { @@ -374,15 +378,23 @@ void EditorProfiler::_update_frame() { updating_frame = false; } -void EditorProfiler::_activate_pressed() { +void EditorProfiler::_set_button_text() { if (activate->is_pressed()) { activate->set_icon(get_theme_icon(SNAME("Stop"), SNAME("EditorIcons"))); activate->set_text(TTR("Stop")); - _clear_pressed(); } else { activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons"))); activate->set_text(TTR("Start")); } +} + +void EditorProfiler::_activate_pressed() { + _set_button_text(); + + if (activate->is_pressed()) { + _clear_pressed(); + } + emit_signal(SNAME("enable_profiling"), activate->is_pressed()); } @@ -499,8 +511,12 @@ void EditorProfiler::_bind_methods() { ADD_SIGNAL(MethodInfo("break_request")); } -void EditorProfiler::set_enabled(bool p_enable) { +void EditorProfiler::set_enabled(bool p_enable, bool p_clear) { + activate->set_pressed(false); activate->set_disabled(!p_enable); + if (p_clear) { + clear(); + } } bool EditorProfiler::is_profiling() { diff --git a/editor/debugger/editor_profiler.h b/editor/debugger/editor_profiler.h index df92125258..e9ecc285ed 100644 --- a/editor/debugger/editor_profiler.h +++ b/editor/debugger/editor_profiler.h @@ -122,6 +122,7 @@ private: Timer *frame_delay = nullptr; Timer *plot_delay = nullptr; + void _set_button_text(); void _update_frame(); void _activate_pressed(); @@ -153,7 +154,7 @@ protected: public: void add_frame_metric(const Metric &p_metric, bool p_final = false); - void set_enabled(bool p_enable); + void set_enabled(bool p_enable, bool p_clear = true); bool is_profiling(); bool is_seeking() { return seeking; } void disable_seeking(); diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index 5baa9970af..6bc1536cb9 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -52,7 +52,6 @@ #include "editor/plugins/node_3d_editor_plugin.h" #include "main/performance.h" #include "scene/3d/camera_3d.h" -#include "scene/debugger/scene_debugger.h" #include "scene/gui/dialogs.h" #include "scene/gui/label.h" #include "scene/gui/line_edit.h" @@ -317,7 +316,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da if (!error.is_empty()) { tabs->set_current_tab(0); } - profiler->set_enabled(false); + profiler->set_enabled(false, false); inspector->clear_cache(); // Take a chance to force remote objects update. } else if (p_msg == "debug_exit") { @@ -327,7 +326,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da _update_buttons_state(); _set_reason_text(TTR("Execution resumed."), MESSAGE_SUCCESS); emit_signal(SNAME("breaked"), false, false, "", false); - profiler->set_enabled(true); + profiler->set_enabled(true, false); profiler->disable_seeking(); } else if (p_msg == "set_pid") { ERR_FAIL_COND(p_data.size() < 1); @@ -916,6 +915,8 @@ void ScriptEditorDebugger::start(Ref<RemoteDebuggerPeer> p_peer) { _clear_errors_list(); stop(); + profiler->set_enabled(true, true); + peer = p_peer; ERR_FAIL_COND(p_peer.is_null()); @@ -971,6 +972,8 @@ void ScriptEditorDebugger::stop() { res_path_cache.clear(); profiler_signature.clear(); + profiler->set_enabled(true, false); + inspector->edit(nullptr); _update_buttons_state(); } |