diff --git a/editor/plugins/game_view_plugin.cpp b/editor/plugins/game_view_plugin.cpp index f45af72e909..5c1f81ee94e 100644 --- a/editor/plugins/game_view_plugin.cpp +++ b/editor/plugins/game_view_plugin.cpp @@ -30,6 +30,7 @@ #include "game_view_plugin.h" +#include "core/debugger/debugger_marshalls.h" #include "editor/editor_main_screen.h" #include "editor/editor_node.h" #include "editor/editor_settings.h" @@ -40,7 +41,15 @@ #include "scene/gui/separator.h" void GameViewDebugger::_session_started(Ref p_session) { - p_session->send_message("scene:runtime_node_select_setup", Array()); + Array setup_data; + Dictionary settings; + settings["editors/panning/2d_editor_panning_scheme"] = EDITOR_GET("editors/panning/2d_editor_panning_scheme"); + settings["editors/panning/simple_panning"] = EDITOR_GET("editors/panning/simple_panning"); + settings["editors/panning/warped_mouse_panning"] = EDITOR_GET("editors/panning/warped_mouse_panning"); + settings["editors/panning/2d_editor_pan_speed"] = EDITOR_GET("editors/panning/2d_editor_pan_speed"); + settings["canvas_item_editor/pan_view"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("canvas_item_editor/pan_view")); + setup_data.append(settings); + p_session->send_message("scene:runtime_node_select_setup", setup_data); Array type; type.append(node_type); diff --git a/scene/debugger/scene_debugger.cpp b/scene/debugger/scene_debugger.cpp index bcad4e966a2..35b8e3fe27a 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 &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 1da3d526320..efdf3efa0fe 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);