summaryrefslogtreecommitdiffstats
path: root/scene/debugger
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2024-11-06 04:01:58 +0100
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2024-11-07 15:03:17 +0100
commitc3e2e468554881c021aa2123efe295c147df3f46 (patch)
tree6fd209de7b8ba414ef78fcb3c0226b685e787a52 /scene/debugger
parent7cd850b90989d032a9b4942514252eb9f607c4e7 (diff)
downloadredot-engine-c3e2e468554881c021aa2123efe295c147df3f46.tar.gz
[Debugger] Add configuration to the GameView debugger plugin
Diffstat (limited to 'scene/debugger')
-rw-r--r--scene/debugger/scene_debugger.cpp15
-rw-r--r--scene/debugger/scene_debugger.h3
2 files changed, 14 insertions, 4 deletions
diff --git a/scene/debugger/scene_debugger.cpp b/scene/debugger/scene_debugger.cpp
index bcad4e966a..35b8e3fe27 100644
--- a/scene/debugger/scene_debugger.cpp
+++ b/scene/debugger/scene_debugger.cpp
@@ -280,7 +280,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 +1222,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 +1239,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 +1356,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 1da3d52632..efdf3efa0f 100644
--- a/scene/debugger/scene_debugger.h
+++ b/scene/debugger/scene_debugger.h
@@ -202,6 +202,7 @@ private:
PopupMenu *selection_list = nullptr;
bool selection_visible = true;
bool selection_update_queued = false;
+ bool warped_panning = false;
bool camera_override = false;
@@ -272,7 +273,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);