diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2024-11-06 16:47:36 +0100 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2024-11-07 15:03:17 +0100 |
commit | 7cd850b90989d032a9b4942514252eb9f607c4e7 (patch) | |
tree | 3c3a2e6692260d86b08bd5363e241e3d62bca7fa /scene/debugger | |
parent | 87318a2fb7fffeb72adca934e31915be077c3d1f (diff) | |
download | redot-engine-7cd850b90989d032a9b4942514252eb9f607c4e7.tar.gz |
[Debugger] Move quit shortcut configuration to the SceneDebugger
Diffstat (limited to 'scene/debugger')
-rw-r--r-- | scene/debugger/scene_debugger.cpp | 13 | ||||
-rw-r--r-- | scene/debugger/scene_debugger.h | 2 |
2 files changed, 14 insertions, 1 deletions
diff --git a/scene/debugger/scene_debugger.cpp b/scene/debugger/scene_debugger.cpp index b87285ed74..bcad4e966a 100644 --- a/scene/debugger/scene_debugger.cpp +++ b/scene/debugger/scene_debugger.cpp @@ -30,6 +30,7 @@ #include "scene_debugger.h" +#include "core/debugger/debugger_marshalls.h" #include "core/debugger/engine_debugger.h" #include "core/io/marshalls.h" #include "core/object/script_language.h" @@ -93,6 +94,13 @@ void SceneDebugger::deinitialize() { } #ifdef DEBUG_ENABLED +void SceneDebugger::_handle_input(const Ref<InputEvent> &p_event, const Ref<Shortcut> &p_shortcut) { + Ref<InputEventKey> k = p_event; + if (k.is_valid() && k->is_pressed() && !k->is_echo() && p_shortcut->matches_event(k)) { + EngineDebugger::get_singleton()->send_message("request_quit", Array()); + } +} + Error SceneDebugger::parse_message(void *p_user, const String &p_msg, const Array &p_args, bool &r_captured) { SceneTree *scene_tree = SceneTree::get_singleton(); if (!scene_tree) { @@ -109,7 +117,10 @@ Error SceneDebugger::parse_message(void *p_user, const String &p_msg, const Arra } r_captured = true; - if (p_msg == "request_scene_tree") { // Scene tree + if (p_msg == "setup_scene") { + SceneTree::get_singleton()->get_root()->connect(SceneStringName(window_input), callable_mp_static(SceneDebugger::_handle_input).bind(DebuggerMarshalls::deserialize_key_shortcut(p_args))); + + } else if (p_msg == "request_scene_tree") { // Scene tree live_editor->_send_tree(); } else if (p_msg == "save_node") { // Save node. diff --git a/scene/debugger/scene_debugger.h b/scene/debugger/scene_debugger.h index f9dd6161aa..1da3d52632 100644 --- a/scene/debugger/scene_debugger.h +++ b/scene/debugger/scene_debugger.h @@ -57,6 +57,8 @@ public: #ifdef DEBUG_ENABLED private: + static void _handle_input(const Ref<InputEvent> &p_event, const Ref<Shortcut> &p_shortcut); + static void _save_node(ObjectID id, const String &p_path); static void _set_node_owner_recursive(Node *p_node, Node *p_owner); static void _set_object_property(ObjectID p_id, const String &p_property, const Variant &p_value); |