summaryrefslogtreecommitdiffstats
path: root/scene/debugger
diff options
context:
space:
mode:
authorThaddeus Crews <repiteo@outlook.com>2024-11-10 12:12:46 -0600
committerThaddeus Crews <repiteo@outlook.com>2024-11-10 12:12:46 -0600
commitf3294e59e10b2d408367ea236e4d35a3590e6bfe (patch)
treebf9ca64d51f3b37d09a217babfcd0d421a2a637f /scene/debugger
parent1cad5525d60f7b1ac45dc82788cf4bd9a4ddcb1b (diff)
parentc3e2e468554881c021aa2123efe295c147df3f46 (diff)
downloadredot-engine-f3294e59e10b2d408367ea236e4d35a3590e6bfe.tar.gz
Merge pull request #98891 from Faless/debugger/game_view_settings
[Debugger] Better settings configuration for RuntimeNodeSelect and Window quit
Diffstat (limited to 'scene/debugger')
-rw-r--r--scene/debugger/scene_debugger.cpp28
-rw-r--r--scene/debugger/scene_debugger.h5
2 files changed, 28 insertions, 5 deletions
diff --git a/scene/debugger/scene_debugger.cpp b/scene/debugger/scene_debugger.cpp
index 1c05271daa..e116fd6373 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.
@@ -271,7 +282,8 @@ Error SceneDebugger::parse_message(void *p_user, const String &p_msg, const Arra
} else if (p_msg.begins_with("runtime_node_select_")) { /// Runtime Node Selection
if (p_msg == "runtime_node_select_setup") {
- runtime_node_select->_setup();
+ ERR_FAIL_COND_V(p_args.is_empty() || p_args[0].get_type() != Variant::DICTIONARY, ERR_INVALID_DATA);
+ runtime_node_select->_setup(p_args[0]);
} else if (p_msg == "runtime_node_select_set_type") {
ERR_FAIL_COND_V(p_args.is_empty(), ERR_INVALID_DATA);
@@ -1221,7 +1233,7 @@ RuntimeNodeSelect::~RuntimeNodeSelect() {
#endif // _3D_DISABLED
}
-void RuntimeNodeSelect::_setup() {
+void RuntimeNodeSelect::_setup(const Dictionary &p_settings) {
Window *root = SceneTree::get_singleton()->get_root();
ERR_FAIL_COND(root->is_connected(SceneStringName(window_input), callable_mp(this, &RuntimeNodeSelect::_root_window_input)));
@@ -1238,6 +1250,14 @@ void RuntimeNodeSelect::_setup() {
panner.instantiate();
panner->set_callbacks(callable_mp(this, &RuntimeNodeSelect::_pan_callback), callable_mp(this, &RuntimeNodeSelect::_zoom_callback));
+ ViewPanner::ControlScheme panning_scheme = (ViewPanner::ControlScheme)p_settings.get("editors/panning/2d_editor_panning_scheme", 0).operator int();
+ bool simple_panning = p_settings.get("editors/panning/simple_panning", false);
+ int pan_speed = p_settings.get("editors/panning/2d_editor_pan_speed", 20);
+ Array keys = p_settings.get("canvas_item_editor/pan_view", Array()).operator Array();
+ panner->setup(panning_scheme, DebuggerMarshalls::deserialize_key_shortcut(keys), simple_panning);
+ panner->set_scroll_speed(pan_speed);
+ warped_panning = p_settings.get("editors/panning/warped_mouse_panning", false);
+
/// 2D Selection Box Generation
sbox_2d_canvas = RS::get_singleton()->canvas_create();
@@ -1347,7 +1367,7 @@ void RuntimeNodeSelect::_root_window_input(const Ref<InputEvent> &p_event) {
if (camera_override) {
if (node_select_type == NODE_TYPE_2D) {
- if (panner->gui_input(p_event, Rect2(Vector2(), root->get_size()))) {
+ if (panner->gui_input(p_event, warped_panning ? Rect2(Vector2(), root->get_size()) : Rect2())) {
return;
}
} else if (node_select_type == NODE_TYPE_3D) {
diff --git a/scene/debugger/scene_debugger.h b/scene/debugger/scene_debugger.h
index 9e9f61aac5..90c8000eb4 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);
@@ -201,6 +203,7 @@ private:
PopupMenu *selection_list = nullptr;
bool selection_visible = true;
bool selection_update_queued = false;
+ bool warped_panning = false;
bool camera_override = false;
@@ -271,7 +274,7 @@ private:
NodeType node_select_type = NODE_TYPE_2D;
SelectMode node_select_mode = SELECT_MODE_SINGLE;
- void _setup();
+ void _setup(const Dictionary &p_settings);
void _node_set_type(NodeType p_type);
void _select_set_mode(SelectMode p_mode);