Godot Engine – Multi-platform 2D and 3D game engine
Disable `CanvasItem` manipulation for native debug builds
Michael Alexsander2c67f582ccd9
diff --git a/editor/run/editor_run_bar.cpp b/editor/run/editor_run_bar.cppindex 046b6d3e893..7f8a4c04a3a 100644--- a/editor/run/editor_run_bar.cpp+++ b/editor/run/editor_run_bar.cpp@@ -384,6 +384,8 @@ void EditorRunBar::_run_native(const Ref<EditorExportPreset> &p_preset) {return; // Build failed.}+ is_native = true;+EditorDebuggerNode::get_singleton()->start(p_preset->get_platform()->get_debug_protocol());emit_signal(SNAME("play_pressed"));editor_run.run_native_notify();@@ -464,6 +466,8 @@ void EditorRunBar::stop_playing() {return;}+ is_native = false;+current_mode = RunMode::STOPPED;editor_run.stop();EditorDebuggerNode::get_singleton()->stop();@@ -495,6 +499,10 @@ Error EditorRunBar::start_native_device(int p_device_id) const {return run_native->start_run_native(p_device_id);}+bool EditorRunBar::is_running_natively() const {+ return is_native && is_playing();+}+ProcessID EditorRunBar::has_child_process(ProcessID p_pid) const {return editor_run.has_child_process(p_pid);}diff --git a/editor/run/editor_run_bar.h b/editor/run/editor_run_bar.hindex 98df6e1f38b..2b858f0ed6d 100644--- a/editor/run/editor_run_bar.h+++ b/editor/run/editor_run_bar.h@@ -79,6 +79,7 @@ class EditorRunBar : public MarginContainer {EditorRun editor_run;EditorRunNative *run_native = nullptr;+ bool is_native = false;enum MovieMakerMenuItem {MOVIE_MAKER_TOGGLE,@@ -129,6 +130,7 @@ public:String get_playing_scene() const;Error start_native_device(int p_device_id) const;+ bool is_running_natively() const;ProcessID has_child_process(ProcessID p_pid) const;void stop_child_process(ProcessID p_pid);diff --git a/editor/run/game_view_plugin.cpp b/editor/run/game_view_plugin.cppindex 6d3c00e3c58..e3de95d59ad 100644--- a/editor/run/game_view_plugin.cpp+++ b/editor/run/game_view_plugin.cpp@@ -72,6 +72,8 @@ void GameViewDebugger::_session_started(Ref<EditorDebuggerSession> p_session) {return;}+ bool is_native = EditorRunBar::get_singleton()->is_running_natively();+Dictionary settings;settings["debugger/max_node_selection"] = EDITOR_GET("debugger/max_node_selection");settings["editors/2d/selection_rectangle_color"] = EDITOR_GET("editors/2d/selection_rectangle_color");@@ -83,11 +85,14 @@ void GameViewDebugger::_session_started(Ref<EditorDebuggerSession> p_session) {settings["editors/polygon_editor/point_grab_radius"] = EDITOR_GET("editors/polygon_editor/point_grab_radius");settings["canvas_item_editor/pan_view"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("canvas_item_editor/pan_view"));settings["canvas_item_editor/cancel_transform"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("canvas_item_editor/cancel_transform"));- settings["accent_color"] = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("accent_color"), EditorStringName(Editor));settings["box_selection_fill_color"] = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("box_selection_fill_color"), EditorStringName(Editor));settings["box_selection_stroke_color"] = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("box_selection_stroke_color"), EditorStringName(Editor));- settings["axis_x_color"] = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("axis_x_color"), EditorStringName(Editor));- settings["axis_y_color"] = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("axis_y_color"), EditorStringName(Editor));+ if (!is_native) {+ settings["accent_color"] = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("accent_color"), EditorStringName(Editor));+ settings["axis_x_color"] = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("axis_x_color"), EditorStringName(Editor));+ settings["axis_y_color"] = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("axis_y_color"), EditorStringName(Editor));+ }+#ifndef _3D_DISABLEDsettings["editors/3d/default_fov"] = EDITOR_GET("editors/3d/default_fov");settings["editors/3d/default_z_near"] = EDITOR_GET("editors/3d/default_z_near");@@ -141,7 +146,9 @@ void GameViewDebugger::_session_started(Ref<EditorDebuggerSession> p_session) {p_session->send_message("scene:runtime_node_select_set_node_type", { node_type });p_session->send_message("scene:runtime_node_select_set_selection_visible", { selection_visible });p_session->send_message("scene:runtime_node_select_set_ci_tool", { ci_tool });- p_session->send_message("scene:runtime_node_select_set_ci_local_space", { ci_local_space });+ if (!is_native) {+ p_session->send_message("scene:runtime_node_select_set_ci_local_space", { ci_local_space });+ }p_session->send_message("scene:runtime_node_select_set_n3d_tool", { n3d_tool });p_session->send_message("scene:runtime_node_select_set_avoid_locked", { selection_avoid_locked });p_session->send_message("scene:runtime_node_select_set_prefer_group", { selection_prefer_group });@@ -151,12 +158,14 @@ void GameViewDebugger::_session_started(Ref<EditorDebuggerSession> p_session) {shortcut_settings["editor/suspend_resume_embedded_project"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("editor/suspend_resume_embedded_project"));shortcut_settings["editor/next_frame_embedded_project"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("editor/next_frame_embedded_project"));shortcut_settings["canvas_item_editor/select_mode"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("canvas_item_editor/select_mode"));- shortcut_settings["canvas_item_editor/move_mode"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("canvas_item_editor/move_mode"));- shortcut_settings["canvas_item_editor/rotate_mode"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("canvas_item_editor/rotate_mode"));- shortcut_settings["canvas_item_editor/scale_mode"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("canvas_item_editor/scale_mode"));shortcut_settings["canvas_item_editor/pan_mode"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("canvas_item_editor/pan_mode"));- shortcut_settings["ui_undo"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("ui_undo"));- shortcut_settings["ui_redo"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("ui_redo"));+ if (!is_native) {+ shortcut_settings["canvas_item_editor/move_mode"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("canvas_item_editor/move_mode"));+ shortcut_settings["canvas_item_editor/rotate_mode"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("canvas_item_editor/rotate_mode"));+ shortcut_settings["canvas_item_editor/scale_mode"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("canvas_item_editor/scale_mode"));+ shortcut_settings["ui_undo"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("ui_undo"));+ shortcut_settings["ui_redo"] = DebuggerMarshalls::serialize_key_shortcut(ED_GET_SHORTCUT("ui_redo"));+ }p_session->send_message("scene:setup_embedded_shortcuts", { shortcut_settings });@@ -498,6 +507,7 @@ void GameView::_sessions_changed() {}}+ _update_ui();_update_debugger_buttons();#ifdef MACOS_ENABLED@@ -655,7 +665,9 @@ void GameView::_stop_pressed() {screen_index_before_start = -1;- InspectorDock::get_inspector_singleton()->disconnect(SNAME("edited_object_changed"), callable_mp(this, &GameView::_inspector_object_changed));+ if (InspectorDock::get_inspector_singleton()->is_connected(SNAME("edited_object_changed"), callable_mp(this, &GameView::_inspector_object_changed))) {+ InspectorDock::get_inspector_singleton()->disconnect(SNAME("edited_object_changed"), callable_mp(this, &GameView::_inspector_object_changed));+ }}void GameView::_embedding_completed() {@@ -700,7 +712,8 @@ void GameView::_inspector_object_changed() {EditorDebuggerRemoteObjects *robjs = nullptr;Object *obj = InspectorDock::get_inspector_singleton()->get_edited_object();robjs = Object::cast_to<EditorDebuggerRemoteObjects>(obj);- ci_button[CanvasItemManipulator::TOOL_EDIT_PIVOT]->set_disabled(!robjs || !robjs->has_canvas_items);+ bool is_native = (active_sessions && EditorRunBar::get_singleton()->is_running_natively());+ ci_button[CanvasItemManipulator::TOOL_EDIT_PIVOT]->set_disabled(!robjs || !robjs->has_canvas_items || is_native);}void GameView::_update_debugger_buttons() {@@ -730,6 +743,19 @@ void GameView::_update_debugger_buttons() {next_frame_button->set_disabled(!suspend_button->is_pressed());+ // Node manipulation is disabled for native debug builds.+ bool is_native = !empty && EditorRunBar::get_singleton()->is_running_natively();+ for (int i = 0; i < CanvasItemManipulator::TOOL_MAX; i++) {+ if (ci_button[i] &&+ i != CanvasItemManipulator::TOOL_SELECT &&+ i != CanvasItemManipulator::TOOL_LIST_SELECT &&+ i != CanvasItemManipulator::TOOL_EDIT_PIVOT &&+ i != CanvasItemManipulator::TOOL_PAN) {+ ci_button[i]->set_disabled(is_native);+ }+ }+ ci_local_space->set_disabled(is_native);+menu = game_window_options_menu->get_popup();if (empty) {int menu_item_index = menu->get_item_index(WINDOW_SEPARATOR_DYNAMIC_RANGE);@@ -843,8 +869,8 @@ void GameView::_game_window_options_menu_menu_id_pressed(int p_id) {debugger->toggle_hdr_output_requested();} break;}+_update_embed_menu_options();- _update_ui();}void GameView::_reset_time_scales() {@@ -1716,7 +1742,7 @@ GameView::GameView(Ref<GameViewDebugger> p_debugger, EmbeddedProcessBase *p_embevsep->set_theme_type_variation("VSeparatorButtonGroup");ci_bar->get_hbox()->add_child(vsep);- Button *ci_local_space = memnew(Button);+ ci_local_space = memnew(Button);ci_bar->get_hbox()->add_child(ci_local_space);ci_local_space->set_button_icon(EditorIconManager::get_icon(SNAME("Object")));ci_local_space->set_toggle_mode(true);diff --git a/editor/run/game_view_plugin.h b/editor/run/game_view_plugin.hindex c4ffc17469d..6da472c5400 100644--- a/editor/run/game_view_plugin.h+++ b/editor/run/game_view_plugin.h@@ -213,7 +213,9 @@ class GameView : public VBoxContainer {Ref<ButtonGroup> n3d_group;Button *node_type_button[RuntimeNodeSelect::NODE_TYPE_MAX];- Button *ci_button[CanvasItemManipulator::TOOL_MAX];+ // Not all CI tools have buttons, so make sure the gaps are at least initialized with null.+ Button *ci_button[CanvasItemManipulator::TOOL_MAX] = {};+ Button *ci_local_space = nullptr;Button *n3d_button[RuntimeNodeSelect::SELECT_MODE_MAX];MenuButton *n3d_options_menu = nullptr;diff --git a/editor/scene/canvas_item_editor_plugin.cpp b/editor/scene/canvas_item_editor_plugin.cppindex 4b44425695e..056857fa5d1 100644--- a/editor/scene/canvas_item_editor_plugin.cpp+++ b/editor/scene/canvas_item_editor_plugin.cpp@@ -4046,7 +4046,6 @@ CanvasItemEditor::CanvasItemEditor() {ci_manipulator.instantiate();ci_manipulator->set_editor_mode_enabled(true);ci_manipulator->set_scale(EDSCALE);- ci_manipulator->set_drag_threshold(8);// Enable pixel snapping even if pixel snap rendering is disabled in the Project Settings.// This results in crisper visuals by preventing 2D nodes from being placed at subpixel coordinates.ci_manipulator->set_snap_mode(SNAP_NODE_PARENT | SNAP_NODE_ANCHORS | SNAP_NODE_SIDES | SNAP_NODE_CENTER | SNAP_OTHER_NODES | SNAP_GUIDES | SNAP_PIXEL);diff --git a/scene/debugger/canvas_item_manipulator.cpp b/scene/debugger/canvas_item_manipulator.cppindex 161fb81b734..f7521f1a6a8 100644--- a/scene/debugger/canvas_item_manipulator.cpp+++ b/scene/debugger/canvas_item_manipulator.cpp@@ -33,12 +33,14 @@#include "core/config/engine.h"#include "core/input/shortcut.h"-#include "scene/2d/node_2d.h"#include "scene/gui/container.h"#include "scene/main/canvas_layer.h"#include "scene/main/scene_tree.h"#include "scene/main/window.h"+#ifdef TOOLS_ENABLED+#include "scene/2d/node_2d.h"+bool CanvasItemManipulator::_gui_input_rulers_and_guides(const Ref<InputEvent> &p_event) {Ref<InputEventMouseButton> b = p_event;Ref<InputEventMouseMotion> m = p_event;@@ -209,25 +211,6 @@ bool CanvasItemManipulator::_gui_input_rulers_and_guides(const Ref<InputEvent> &return false;}-bool CanvasItemManipulator::_gui_input_open_scene_on_double_click(const Ref<InputEvent> &p_event) {- Ref<InputEventMouseButton> b = p_event;-- // Open a sub-scene on double-click.- if (b.is_valid() && b->get_button_index() == MouseButton::LEFT && b->is_pressed() && b->is_double_click() && tool == TOOL_SELECT) {- Array selection;- get_selection_callback.call(selection);- if (selection.size() == 1) {- CanvasItem *ci = Object::cast_to<CanvasItem>(selection.front());- if (ci->is_instance() && ci != find_items_start_callback.call()) {- emit_signal("scene_double_clicked", ci->get_scene_file_path());- return true;- }- }- }-- return false;-}-bool CanvasItemManipulator::_gui_input_scale(const Ref<InputEvent> &p_event) {Ref<InputEventMouseButton> b = p_event;Ref<InputEventMouseMotion> m = p_event;@@ -1249,6 +1232,44 @@ bool CanvasItemManipulator::_gui_input_ruler_tool(const Ref<InputEvent> &p_eventreturn false;}+bool CanvasItemManipulator::_gui_input_cancel_drag(const Ref<InputEvent> &p_event, bool p_reset_snap_targets, bool p_restore_bones) {+ Ref<InputEventMouseButton> b = p_event;+ if ((b.is_valid() && b->is_pressed() && b->get_button_index() == MouseButton::RIGHT) || DebuggerHelpers::is_shortcut_pressed(SHORTCUT_CANCEL_TRANSFORM, inputs)) {+ if (p_reset_snap_targets) {+ snap_target[0] = SNAP_TARGET_NONE;+ snap_target[1] = SNAP_TARGET_NONE;+ }++ emit_signal("restore_canvas_state_requested", drag_selection, p_restore_bones);+ reset_drag();+ emit_signal(update_canvas_signal);++ return true;+ }++ return false;+}+#endif // TOOLS_ENABLED++bool CanvasItemManipulator::_gui_input_open_scene_on_double_click(const Ref<InputEvent> &p_event) {+ Ref<InputEventMouseButton> b = p_event;++ // Open a sub-scene on double-click.+ if (b.is_valid() && b->get_button_index() == MouseButton::LEFT && b->is_pressed() && b->is_double_click() && tool == TOOL_SELECT) {+ Array selection;+ get_selection_callback.call(selection);+ if (selection.size() == 1) {+ CanvasItem *ci = Object::cast_to<CanvasItem>(selection.front());+ if (ci->is_instance() && ci != find_items_start_callback.call()) {+ emit_signal("scene_double_clicked", ci->get_scene_file_path());+ return true;+ }+ }+ }++ return false;+}+bool CanvasItemManipulator::_gui_input_select(const Ref<InputEvent> &p_event) {Ref<InputEventMouseButton> b = p_event;Ref<InputEventMouseMotion> m = p_event;@@ -1290,7 +1311,7 @@ bool CanvasItemManipulator::_gui_input_select(const Ref<InputEvent> &p_event) {if (b.is_valid() && b->get_button_index() == MouseButton::LEFT && (tool == TOOL_SELECT || tool == TOOL_MOVE || tool == TOOL_SCALE || tool == TOOL_ROTATE)) {Point2 pos = Transform2D(global_transform_callback.call()).affine_inverse().xform(b->get_position());// Allow selecting on release when performed very small box selection (necessary when Shift is pressed, see below).- if (b->is_pressed() || (drag_type == DRAG_BOX_SELECTION && pos.distance_to(drag_from) <= drag_threshold * scale)) {+ if (b->is_pressed() || (drag_type == DRAG_BOX_SELECTION && pos.distance_to(drag_from) <= DRAG_THRESHOLD * scale)) {Vector<DebuggerHelpers::SelectResult> items;get_canvas_items_at_pos(pos, items);@@ -1321,8 +1342,10 @@ bool CanvasItemManipulator::_gui_input_select(const Ref<InputEvent> &p_event) {// Start dragging.if (selected && (tool == TOOL_SELECT || tool == TOOL_MOVE) && b->is_pressed()) {// Drag the node(s) if requested.- drag_start_origin = pos;drag_type = DRAG_QUEUED;+#ifdef TOOLS_ENABLED+ drag_start_origin = pos;+#endif} else if (!b->is_pressed()) {reset_drag();}@@ -1339,6 +1362,7 @@ bool CanvasItemManipulator::_gui_input_select(const Ref<InputEvent> &p_event) {return true;}+#ifdef TOOLS_ENABLEDif (m.is_valid()) {Point2 pos = Transform2D(global_transform_callback.call()).affine_inverse().xform(m->get_position());bool movement_threshold_passed = drag_start_origin.distance_to(pos) > (8 * MAX(1, scale)) / zoom;@@ -1363,6 +1387,7 @@ bool CanvasItemManipulator::_gui_input_select(const Ref<InputEvent> &p_event) {return true;}}+#endif}if (drag_type == DRAG_BOX_SELECTION) {@@ -1421,36 +1446,6 @@ bool CanvasItemManipulator::_gui_input_select(const Ref<InputEvent> &p_event) {return false;}-bool CanvasItemManipulator::_gui_input_cancel_drag(const Ref<InputEvent> &p_event, bool p_reset_snap_targets, bool p_restore_bones) {- Ref<InputEventMouseButton> b = p_event;- if ((b.is_valid() && b->is_pressed() && b->get_button_index() == MouseButton::RIGHT) || DebuggerHelpers::is_shortcut_pressed(SHORTCUT_CANCEL_TRANSFORM, inputs)) {- if (p_reset_snap_targets) {- snap_target[0] = SNAP_TARGET_NONE;- snap_target[1] = SNAP_TARGET_NONE;- }-- emit_signal("restore_canvas_state_requested", drag_selection, p_restore_bones);- reset_drag();- emit_signal(update_canvas_signal);-- return true;- }-- return false;-}--bool CanvasItemManipulator::_validate_drag_selection() {- // Check if all nodes are still available.- for (int i = 0; i < drag_selection.size(); i++) {- if (!drag_selection[i]) {- drag_selection.remove_at(i);- i--;- }- }-- return !drag_selection.is_empty();-}-Rect2 CanvasItemManipulator::_encompass_selection_rect(const Array &p_selected) {ERR_FAIL_COND_V(p_selected.is_empty(), Rect2());@@ -1473,6 +1468,19 @@ Rect2 CanvasItemManipulator::_encompass_selection_rect(const Array &p_selected)return rect;}+#ifdef TOOLS_ENABLED+bool CanvasItemManipulator::_validate_drag_selection() {+ // Check if all nodes are still available.+ for (int i = 0; i < drag_selection.size(); i++) {+ if (!drag_selection[i]) {+ drag_selection.remove_at(i);+ i--;+ }+ }++ return !drag_selection.is_empty();+}+Point2 CanvasItemManipulator::anchor_to_position(const Control *p_control, const Vector2 p_anchor) {ERR_FAIL_NULL_V(p_control, Point2());@@ -1876,8 +1884,18 @@ void CanvasItemManipulator::commit_drag() {emit_signal(update_canvas_signal);}-bool CanvasItemManipulator::is_node_locked(const Node *p_node) {- return p_node->get_meta("_edit_lock_", false);+bool CanvasItemManipulator::reset_temp_pivot() {+ if (temp_pivot != Vector2(Math::INF, Math::INF)) {+ temp_pivot = Vector2(Math::INF, Math::INF);+ return true;+ }++ return false;+}++void CanvasItemManipulator::set_shortcut(const ShortcutName p_name, const Ref<Shortcut> &p_shortcut) {+ ERR_FAIL_INDEX(0, SHORTCUT_MAX);+ inputs[p_name] = p_shortcut;}bool CanvasItemManipulator::is_node_movable(const Node *p_node, bool p_popup_warning) {@@ -1895,9 +1913,19 @@ bool CanvasItemManipulator::is_node_movable(const Node *p_node, bool p_popup_warreturn true;}+void CanvasItemManipulator::_emit_locked_warn_signal() {+ emit_signal("warning_emitted", TTRC("All selected CanvasItems are either invisible or locked in some way and can't be transformed."));+}+#endif // TOOLS_ENABLED++bool CanvasItemManipulator::is_node_locked(const Node *p_node) {+ return p_node->get_meta("_edit_lock_", false);+}+void CanvasItemManipulator::_update_cursor_shape() {Input::CursorShape new_cursor = Input::CursorShape::CURSOR_ARROW;switch (tool) {+#ifdef TOOLS_ENABLEDcase TOOL_MOVE: {new_cursor = Input::CursorShape::CURSOR_MOVE;} break;@@ -1906,18 +1934,20 @@ void CanvasItemManipulator::_update_cursor_shape() {new_cursor = Input::CursorShape::CURSOR_CROSS;} break;- case TOOL_PAN: {- new_cursor = Input::CursorShape::CURSOR_DRAG;- } break;-case TOOL_RULER: {new_cursor = Input::CursorShape::CURSOR_CROSS;} break;+#endif++ case TOOL_PAN: {+ new_cursor = Input::CursorShape::CURSOR_DRAG;+ } break;default:break;}+#ifdef TOOLS_ENABLEDif (drag_type == DRAG_NONE) {if (is_hovering_h_guide) {new_cursor = Input::CursorShape::CURSOR_VSIZE;@@ -1991,6 +2021,7 @@ void CanvasItemManipulator::_update_cursor_shape() {break;}}+#endif // TOOLS_ENABLEDif (cursor_shape != new_cursor) {cursor_shape = new_cursor;@@ -1998,10 +2029,6 @@ void CanvasItemManipulator::_update_cursor_shape() {}}-void CanvasItemManipulator::_emit_locked_warn_signal() {- emit_signal("warning_emitted", TTRC("All selected CanvasItems are either invisible or locked in some way and can't be transformed."));-}-void CanvasItemManipulator::get_canvas_items_at_pos(const Point2 &p_pos, Vector<DebuggerHelpers::SelectResult> &r_items, bool p_allow_locked) {Node *start = Object::cast_to<Node>(find_items_start_callback.call());if (!start) {@@ -2218,6 +2245,7 @@ void CanvasItemManipulator::find_canvas_items_in_rect(const Rect2 &p_rect, Node}bool CanvasItemManipulator::gui_input(const Ref<InputEvent> &p_event) {+#ifdef TOOLS_ENABLEDbool accepted = _gui_input_rulers_and_guides(p_event) ||plugin_input_callback.call(p_event) ||_gui_input_open_scene_on_double_click(p_event) ||@@ -2229,6 +2257,9 @@ bool CanvasItemManipulator::gui_input(const Ref<InputEvent> &p_event) {_gui_input_anchors(p_event) ||_gui_input_ruler_tool(p_event) ||_gui_input_select(p_event);+#else+ bool accepted = _gui_input_open_scene_on_double_click(p_event) || _gui_input_select(p_event);+#endif_update_cursor_shape();@@ -2240,16 +2271,8 @@ void CanvasItemManipulator::reset_drag() {drag_selection.clear();}-bool CanvasItemManipulator::reset_temp_pivot() {- if (temp_pivot != Vector2(Math::INF, Math::INF)) {- temp_pivot = Vector2(Math::INF, Math::INF);- return true;- }-- return false;-}-void CanvasItemManipulator::set_tool(Tool p_tool) {+#ifdef TOOLS_ENABLEDif (drag_type != DRAG_NONE) {commit_drag();}@@ -2270,21 +2293,21 @@ void CanvasItemManipulator::set_tool(Tool p_tool) {temp_pivot = center / selection.size();}}-}--void CanvasItemManipulator::set_shortcut(const ShortcutName p_name, const Ref<Shortcut> &p_shortcut) {- ERR_FAIL_INDEX(0, SHORTCUT_MAX);- inputs[p_name] = p_shortcut;+#else+ tool = p_tool;+#endif}void CanvasItemManipulator::set_callbacks(const Callable &p_find_items_start, const Callable &p_point_selected, const Callable &p_get_selection, const Callable &p_local_xform, const Callable &p_global_xform, const Callable &p_local_mouse_pos, const Callable &p_plugin_input) {find_items_start_callback = p_find_items_start;point_selected_callback = p_point_selected;get_selection_callback = p_get_selection;- local_transform_callback = p_local_xform;global_transform_callback = p_global_xform;+#ifdef TOOLS_ENABLED+ local_transform_callback = p_local_xform;local_mouse_pos_callback = p_local_mouse_pos;plugin_input_callback = p_plugin_input;+#endif}void CanvasItemManipulator::_bind_methods() {@@ -2298,14 +2321,16 @@ void CanvasItemManipulator::_bind_methods() {ADD_SIGNAL(MethodInfo("tool_menu_requested", PropertyInfo(Variant::VECTOR2, "position")));ADD_SIGNAL(MethodInfo("scene_double_clicked", PropertyInfo(Variant::STRING, "path")));+ ADD_SIGNAL(MethodInfo("cursor_shape_changed"));++#ifdef TOOLS_ENABLEDADD_SIGNAL(MethodInfo("save_canvas_state_requested", PropertyInfo(Variant::ARRAY, "selection"), PropertyInfo(Variant::BOOL, "save_bones")));ADD_SIGNAL(MethodInfo("restore_canvas_state_requested", PropertyInfo(Variant::ARRAY, "selection"), PropertyInfo(Variant::BOOL, "restore_bones")));ADD_SIGNAL(MethodInfo("commit_canvas_state_requested", PropertyInfo(Variant::ARRAY, "selection"), PropertyInfo(Variant::STRING, "message"), PropertyInfo(Variant::BOOL, "commit_bones")));ADD_SIGNAL(MethodInfo("commit_guide_meta_requested", PropertyInfo(Variant::STRING, "message"), PropertyInfo(Variant::DICTIONARY, "meta")));- ADD_SIGNAL(MethodInfo("cursor_shape_changed"));-ADD_SIGNAL(MethodInfo("warning_emitted", PropertyInfo(Variant::STRING, "message")));+#endif}#endif // DEBUG_ENABLEDdiff --git a/scene/debugger/canvas_item_manipulator.h b/scene/debugger/canvas_item_manipulator.hindex a8ad6cfd920..dc50719496f 100644--- a/scene/debugger/canvas_item_manipulator.h+++ b/scene/debugger/canvas_item_manipulator.h@@ -46,14 +46,6 @@ class CanvasItemManipulator : public RefCounted {GDCLASS(CanvasItemManipulator, RefCounted);public:- constexpr static real_t GIZMO_HANDLE_DISTANCE = 25;- constexpr static Rect2 GIZMO_HANDLE_X_RECT = Rect2(GIZMO_HANDLE_DISTANCE, -5, 10, 10);- constexpr static Rect2 GIZMO_HANDLE_Y_RECT = Rect2(-5, GIZMO_HANDLE_DISTANCE, 10, 10);-- constexpr static real_t RESIZE_HANDLE_DIAMETER = 10;-- constexpr static Size2 ANCHOR_HANDLE_SIZE = Size2(16, 16);-enum Tool {TOOL_SELECT,TOOL_SCENE_PAINT,@@ -99,6 +91,16 @@ public:DRAG_KEY_MOVE,};+ constexpr static real_t DRAG_THRESHOLD = 8;+#ifdef TOOLS_ENABLED+ constexpr static real_t GIZMO_HANDLE_DISTANCE = 25;+ constexpr static Rect2 GIZMO_HANDLE_X_RECT = Rect2(GIZMO_HANDLE_DISTANCE, -5, 10, 10);+ constexpr static Rect2 GIZMO_HANDLE_Y_RECT = Rect2(-5, GIZMO_HANDLE_DISTANCE, 10, 10);++ constexpr static real_t RESIZE_HANDLE_DIAMETER = 10;++ constexpr static Size2 ANCHOR_HANDLE_SIZE = Size2(16, 16);+enum ShortcutName {SHORTCUT_CANCEL_TRANSFORM,SHORTCUT_MAX,@@ -127,6 +129,7 @@ public:SNAP_DEFAULT = SNAP_GRID | SNAP_GUIDES | SNAP_PIXEL,};+#endifprivate:StringName update_canvas_signal = "update_canvas_requested";@@ -136,14 +139,10 @@ private:Input::CursorShape cursor_shape = Input::CursorShape::CURSOR_ARROW;bool editor_mode = false; // Set it manually instead of using the hint, to allow debugging the editor itself.- bool local_space = false;- bool show_transformation_gizmos = false;real_t grab_distance = 1;- real_t drag_threshold = 0;real_t scale = 1;real_t zoom = 1;Point2 view_offset;- bool anchors_mode = false;Viewport *viewport = nullptr;Point2 box_selecting_to;@@ -155,6 +154,23 @@ private:Point2 temp_pivot = Point2(Math::INF, Math::INF);Array drag_selection;+ Callable find_items_start_callback;+ Callable point_selected_callback;+ Callable get_selection_callback;+ Callable global_transform_callback;++ bool _gui_input_open_scene_on_double_click(const Ref<InputEvent> &p_event);+ bool _gui_input_select(const Ref<InputEvent> &p_event);++ Rect2 _encompass_selection_rect(const Array &p_selected);++ void _update_cursor_shape();++#ifdef TOOLS_ENABLED+ bool local_space = false;+ bool show_transformation_gizmos = false;+ bool anchors_mode = false;+int snap_mode = SNAP_DEFAULT;bool smart_snap = false;bool snap_relative = false;@@ -184,16 +200,11 @@ private:HashMap<int, Ref<Shortcut>> inputs;- Callable find_items_start_callback;- Callable point_selected_callback;- Callable get_selection_callback;Callable local_transform_callback;- Callable global_transform_callback;Callable local_mouse_pos_callback;Callable plugin_input_callback;bool _gui_input_rulers_and_guides(const Ref<InputEvent> &p_event);- bool _gui_input_open_scene_on_double_click(const Ref<InputEvent> &p_event);bool _gui_input_scale(const Ref<InputEvent> &p_event);bool _gui_input_pivot(const Ref<InputEvent> &p_event);bool _gui_input_resize(const Ref<InputEvent> &p_event);@@ -201,13 +212,10 @@ private:bool _gui_input_move(const Ref<InputEvent> &p_event);bool _gui_input_anchors(const Ref<InputEvent> &p_event);bool _gui_input_ruler_tool(const Ref<InputEvent> &p_event);- bool _gui_input_select(const Ref<InputEvent> &p_event);bool _gui_input_cancel_drag(const Ref<InputEvent> &p_event, bool p_reset_snap_targets = false, bool p_restore_bones = false);bool _validate_drag_selection();- Rect2 _encompass_selection_rect(const Array &p_selected);-void _snap_if_closer_float(const real_t p_value,real_t &r_current_snap, SnapTarget &r_current_snap_target,@@ -226,9 +234,8 @@ private:const SnapTarget p_snap_target, const Array &p_exceptions,const Node *p_current);- void _update_cursor_shape();-void _emit_locked_warn_signal();+#endifprotected:static void _bind_methods();@@ -236,34 +243,45 @@ protected:public:bool gui_input(const Ref<InputEvent> &p_event);- Point2 snap_point(Point2 p_target, unsigned int p_modes = SNAP_DEFAULT, unsigned int p_forced_modes = 0, const CanvasItem *p_self_canvas_item = nullptr, const Array &p_other_nodes_exceptions = Array());- static Point2 anchor_to_position(const Control *p_control, const Point2 p_anchor);- static Point2 position_to_anchor(const Control *p_control, const Point2 &p_position);-void get_canvas_items_at_pos(const Point2 &p_pos, Vector<DebuggerHelpers::SelectResult> &r_items, bool p_allow_locked = false);void find_canvas_items_at_pos(const Point2 &p_pos, Node *p_node, Vector<DebuggerHelpers::SelectResult> &r_items, const Transform2D &p_parent_xform = Transform2D(), const Transform2D &p_canvas_xform = Transform2D());void find_canvas_items_in_rect(const Rect2 &p_rect, Node *p_node, Vector<DebuggerHelpers::SelectResult> &r_items, const Transform2D &p_parent_xform = Transform2D(), const Transform2D &p_canvas_xform = Transform2D());Input::CursorShape get_cursor_shape() const { return cursor_shape; }- void commit_drag();void reset_drag();- bool reset_temp_pivot();-void set_editor_mode_enabled(bool p_enabled) { editor_mode = p_enabled; }void set_tool(Tool p_tool);void set_drag_type(DragType p_type) { drag_type = p_type; }- void set_local_space_enabled(bool p_enabled) { local_space = p_enabled; }void set_grab_distance(const real_t p_distance) { grab_distance = p_distance; }- void set_drag_threshold(const real_t p_threshold) { drag_threshold = p_threshold; }void set_scale(const real_t p_scale) { scale = p_scale; }void set_zoom(const real_t p_zoom) { zoom = p_zoom; }void set_view_offset(const Point2 p_offset) { view_offset = p_offset; }- void set_anchors_mode_enabled(bool p_enabled) { anchors_mode = p_enabled; }void set_viewport(Viewport *p_viewport) { viewport = p_viewport; }+ void set_callbacks(const Callable &p_find_items_start, const Callable &p_point_selected, const Callable &p_get_selection, const Callable &p_local_xform, const Callable &p_global_xform, const Callable &p_local_mouse_pos, const Callable &p_plugin_input);++ static bool is_node_locked(const Node *p_node);++ Tool get_tool() const { return tool; }+ DragType get_drag_type() const { return drag_type; }++ Point2 get_drag_from() const { return drag_from; }++#ifdef TOOLS_ENABLED+ Point2 snap_point(Point2 p_target, unsigned int p_modes = SNAP_DEFAULT, unsigned int p_forced_modes = 0, const CanvasItem *p_self_canvas_item = nullptr, const Array &p_other_nodes_exceptions = Array());+ static Point2 anchor_to_position(const Control *p_control, const Point2 p_anchor);+ static Point2 position_to_anchor(const Control *p_control, const Point2 &p_position);++ void commit_drag();++ bool reset_temp_pivot();++ void set_local_space_enabled(bool p_enabled) { local_space = p_enabled; }+ void set_anchors_mode_enabled(bool p_enabled) { anchors_mode = p_enabled; }+void set_grid_snap_enabled(bool p_enabled) { grid_snap = p_enabled; }void set_grid_step(const Point2 &p_step) { grid_step = p_step; }void set_grid_step_multiplier(const int &p_multiplier) { grid_step_multiplier = p_multiplier; }@@ -284,20 +302,15 @@ public:void set_ruler_width(const real_t p_width) { ruler_width = p_width; }void set_shortcut(const ShortcutName p_name, const Ref<Shortcut> &p_shortcut);- void set_callbacks(const Callable &p_find_items_start, const Callable &p_point_selected, const Callable &p_get_selection, const Callable &p_local_xform, const Callable &p_global_xform, const Callable &p_local_mouse_pos, const Callable &p_plugin_input);- static bool is_node_locked(const Node *p_node);bool is_node_movable(const Node *p_node, bool p_popup_warning = false);- Tool get_tool() const { return tool; }- DragType get_drag_type() const { return drag_type; }- bool is_local_space_enabled() { return local_space; }-Point2 get_drag_to() const { return drag_to; }- Point2 get_drag_from() const { return drag_from; }Point2 get_drag_rotation_center() const { return drag_rotation_center; }Array get_drag_selection() const { return drag_selection.duplicate(); }+ bool is_local_space_enabled() { return local_space; }+Point2 get_temp_pivot() const { return temp_pivot; }bool is_grid_snap_enabled() { return grid_snap; }@@ -326,5 +339,6 @@ public:bool is_ruler_tool_active() { return ruler_tool_active; }Point2 get_ruler_tool_origin() const { return ruler_tool_origin; }+#endif};#endif // DEBUG_ENABLEDdiff --git a/scene/debugger/runtime_node_select.cpp b/scene/debugger/runtime_node_select.cppindex 802e981ed41..c0717e2a3b1 100644--- a/scene/debugger/runtime_node_select.cpp+++ b/scene/debugger/runtime_node_select.cpp@@ -47,14 +47,17 @@#include "scene/main/canvas_layer.h"#include "scene/main/scene_tree.h"#include "scene/resources/mesh.h"-#include "scene/resources/texture.h"#include "scene/theme/theme_db.h"#include "servers/display/display_server.h"#include "servers/rendering/rendering_server.h"+#ifdef TOOLS_ENABLED+#include "scene/resources/texture.h"+#endif+#ifndef PHYSICS_2D_DISABLED#include "scene/2d/physics/collision_shape_2d.h"-#endif // PHYSICS_2D_DISABLED+#endif#ifndef _3D_DISABLED#include "scene/3d/camera_3d.h"@@ -94,6 +97,7 @@ void RuntimeNodeSelect::_setup(const Dictionary &p_settings) {max_selection = p_settings.get("debugger/max_node_selection", 1);scale = GLOBAL_GET("display/window/stretch/scale");+#ifdef TOOLS_ENABLEDaccent_color = p_settings.get("accent_color", Color());axis_x_color = p_settings.get("axis_x_color", Color());axis_y_color = p_settings.get("axis_y_color", Color());@@ -102,6 +106,7 @@ void RuntimeNodeSelect::_setup(const Dictionary &p_settings) {pivot_icon = theme->get_icon(SNAME("pivot"), SNAME("Debug"));resize_icon = theme->get_icon(SNAME("resize"), SNAME("Debug"));anchor_icon = theme->get_icon(SNAME("anchor"), SNAME("Debug"));+#endif// Panner Setup@@ -119,7 +124,6 @@ void RuntimeNodeSelect::_setup(const Dictionary &p_settings) {// CanvasItemManipulator Setupci_manipulator.instantiate();- ci_manipulator->set_show_transformation_gizmos(true);ci_manipulator->set_grab_distance(p_settings.get("editors/polygon_editor/point_grab_radius", 1));ci_manipulator->set_scale(scale);ci_manipulator->set_viewport(root);@@ -131,18 +135,24 @@ void RuntimeNodeSelect::_setup(const Dictionary &p_settings) {callable_mp((Viewport *)root, &Viewport::get_screen_transform),callable_mp(this, &RuntimeNodeSelect::_local_mouse_pos_callback),callable_mp(this, &RuntimeNodeSelect::_plugin_input_callback));- ci_manipulator->set_shortcut(CanvasItemManipulator::SHORTCUT_CANCEL_TRANSFORM, DebuggerMarshalls::deserialize_key_shortcut(p_settings.get("canvas_item_editor/cancel_transform", Array())));+ci_manipulator->connect("box_selected", callable_mp(this, &RuntimeNodeSelect::_box_selected_ci));ci_manipulator->connect("box_selection_updated", callable_mp(this, &RuntimeNodeSelect::_set_selection_area));ci_manipulator->connect("clear_selection_requested", callable_mp(this, &RuntimeNodeSelect::_clear_selection).bind(true).unbind(1));ci_manipulator->connect("selection_menu_requested", callable_mp(this, &RuntimeNodeSelect::_open_selection_list));ci_manipulator->connect("scene_double_clicked", callable_mp(this, &RuntimeNodeSelect::_scene_double_clicked));ci_manipulator->connect("update_canvas_requested", callable_mp(this, &RuntimeNodeSelect::_queue_selection_update));+ ci_manipulator->connect("cursor_shape_changed", callable_mp(this, &RuntimeNodeSelect::_update_cursor_shape));++#ifdef TOOLS_ENABLED+ ci_manipulator->set_show_transformation_gizmos(true);+ ci_manipulator->set_shortcut(CanvasItemManipulator::SHORTCUT_CANCEL_TRANSFORM, DebuggerMarshalls::deserialize_key_shortcut(p_settings.get("canvas_item_editor/cancel_transform", Array())));+ci_manipulator->connect("save_canvas_state_requested", callable_mp(this, &RuntimeNodeSelect::_save_canvas_state_requested));ci_manipulator->connect("restore_canvas_state_requested", callable_mp(this, &RuntimeNodeSelect::_restore_canvas_state_requested));ci_manipulator->connect("commit_canvas_state_requested", callable_mp(this, &RuntimeNodeSelect::_commit_canvas_state_requested));- ci_manipulator->connect("cursor_shape_changed", callable_mp(this, &RuntimeNodeSelect::_update_cursor_shape));ci_manipulator->connect("warning_emitted", callable_mp(this, &RuntimeNodeSelect::_show_toaster).bind(1));+#endif/// 2D Selection Rectangle Generation@@ -319,16 +329,17 @@ void RuntimeNodeSelect::_set_camera_override_enabled(bool p_enabled) {if (camera_first_override) {#ifndef _2D_DISABLED_reset_camera_2d();-#endif // _2D_DISABLED+#endif+#ifndef _3D_DISABLED_reset_camera_3d();-#endif // _3D_DISABLED+#endifcamera_first_override = false;} else if (p_enabled) {#ifndef _2D_DISABLED_update_view_2d();-#endif // _2D_DISABLED+#endif#ifndef _3D_DISABLEDWindow *root = SceneTree::get_singleton()->get_root();@@ -346,14 +357,12 @@ void RuntimeNodeSelect::_set_ci_tool(CanvasItemManipulator::Tool p_tool) {_queue_selection_update();}+#ifdef TOOLS_ENABLEDvoid RuntimeNodeSelect::_set_ci_local_space(bool p_enabled) {ci_manipulator->set_local_space_enabled(p_enabled);_queue_selection_update();}--void RuntimeNodeSelect::_set_ci_smart_snap(bool p_enabled) {- ci_manipulator->set_smart_snap_enabled(p_enabled);-}+#endifvoid RuntimeNodeSelect::_set_n3d_tool(SelectMode p_tool) {node_select_mode = p_tool;@@ -410,12 +419,14 @@ void RuntimeNodeSelect::_root_window_input(const Ref<InputEvent> &p_event) {return;}+#ifdef TOOLS_ENABLEDif (SceneTree::get_singleton()->is_suspended() && ci_manipulator->is_showing_transformation_gizmos()) {Ref<InputEventKey> k = p_event;if (k.is_valid() && !k->is_echo() && (k->get_keycode() == Key::CTRL || k->get_keycode() == Key::ALT || k->get_keycode() == Key::SHIFT)) {_queue_selection_update();}}+#endif_update_cursor_shape();@@ -915,7 +926,9 @@ void RuntimeNodeSelect::_set_selected_nodes(const Vector<Node *> &p_nodes) {selected_ci_nodes = nodes_ci;has_selection = !nodes_ci.is_empty();+#ifdef TOOLS_ENABLEDci_manipulator->reset_temp_pivot();+#endif#ifndef _3D_DISABLEDif (!nodes_3d.is_empty()) {@@ -941,22 +954,28 @@ void RuntimeNodeSelect::_update_selection() {RS::get_singleton()->canvas_item_clear(srect_ci);RS::get_singleton()->canvas_item_set_visible(srect_ci, selection_visible);+ bool nodes_missing = false;++#ifdef TOOLS_ENABLEDCanvasItemManipulator::Tool tool = ci_manipulator->get_tool();+ CanvasItemManipulator::DragType drag = ci_manipulator->get_drag_type();+ bool single = selected_ci_nodes.size() == 1;bool transform_tool = tool == CanvasItemManipulator::TOOL_SELECT ||tool == CanvasItemManipulator::TOOL_MOVE ||tool == CanvasItemManipulator::TOOL_SCALE ||tool == CanvasItemManipulator::TOOL_ROTATE ||tool == CanvasItemManipulator::TOOL_EDIT_PIVOT;- CanvasItemManipulator::DragType drag = ci_manipulator->get_drag_type();- bool single = selected_ci_nodes.size() == 1;- bool nodes_missing = false;+#endiffor (HashMap<ObjectID, Dictionary>::ConstIterator kv = selected_ci_nodes.begin(); kv != selected_ci_nodes.end(); ++kv) {CanvasItem *ci = ObjectDB::get_instance<CanvasItem>(kv->key);if (!ci) {selected_ci_nodes.erase(kv->key);- single = selected_ci_nodes.size() == 1;nodes_missing = true;+#ifdef TOOLS_ENABLED+ single = selected_ci_nodes.size() == 1;+#endif+--kv;continue;}@@ -968,6 +987,7 @@ void RuntimeNodeSelect::_update_selection() {Transform2D xform = ci->get_global_transform_with_canvas();bool item_locked = CanvasItemManipulator::is_node_locked(ci);+#ifdef TOOLS_ENABLEDif (single && node_select_type == NODE_TYPE_2D) {// Pivot@@ -1054,6 +1074,7 @@ void RuntimeNodeSelect::_update_selection() {}}}+#endif // TOOLS_ENABLED// 2D Selection Rectangle@@ -1087,6 +1108,7 @@ void RuntimeNodeSelect::_update_selection() {}}+#ifdef TOOLS_ENABLEDif (node_select_type == NODE_TYPE_2D && !selected_ci_nodes.is_empty()) {Point2 temp_pivot = ci_manipulator->get_temp_pivot();@@ -1202,6 +1224,7 @@ void RuntimeNodeSelect::_update_selection() {RS::get_singleton()->canvas_item_add_set_transform(srect_ci, Transform2D());}+#endif // TOOLS_ENABLED#ifndef _3D_DISABLEDfor (HashMap<ObjectID, Ref<SelectionBox>>::ConstIterator kv = selected_3d_nodes.begin(); kv != selected_3d_nodes.end(); ++kv) {@@ -1749,6 +1772,7 @@ void RuntimeNodeSelect::_box_selected_ci(const Array &p_selection) {_send_ids(nodes, true);}+#ifdef TOOLS_ENABLEDvoid RuntimeNodeSelect::_save_canvas_state_requested(const Array &p_selection, bool p_save_bones) {for (const Variant &var : p_selection) {CanvasItem *ci = Object::cast_to<CanvasItem>(var);@@ -1791,6 +1815,7 @@ void RuntimeNodeSelect::_commit_canvas_state_requested(const Array &p_selection,EngineDebugger::get_singleton()->send_message("remote_undo_redo_action", { p_message, ids });}}+#endif // TOOLS_ENABLED#ifndef _3D_DISABLEDvoid RuntimeNodeSelect::_fov_scaled() {diff --git a/scene/debugger/runtime_node_select.h b/scene/debugger/runtime_node_select.hindex 1954f9d0f4b..807aad86190 100644--- a/scene/debugger/runtime_node_select.h+++ b/scene/debugger/runtime_node_select.h@@ -115,12 +115,14 @@ private:Ref<Shortcut> pan_shortcut;Ref<CanvasItemManipulator> ci_manipulator;+#ifdef TOOLS_ENABLEDColor accent_color;Color axis_x_color;Color axis_y_color;Ref<Texture2D> pivot_icon;Ref<Texture2D> resize_icon;Ref<Texture2D> anchor_icon;+#endifHashMap<ObjectID, Dictionary> selected_ci_nodes; // The node's ID and its canvas state.int sel_2d_scale = 1;@@ -160,12 +162,12 @@ private:void _setup(const Dictionary &p_settings);void _set_node_type(NodeType p_type);-void _set_camera_override_enabled(bool p_enabled);void _set_ci_tool(CanvasItemManipulator::Tool p_tool);+#ifdef TOOLS_ENABLEDvoid _set_ci_local_space(bool p_enabled);- void _set_ci_smart_snap(bool p_enabled);+#endifvoid _set_n3d_tool(SelectMode p_tool);@@ -199,10 +201,11 @@ private:void _pan_callback(Vector2 p_scroll_vec, Ref<InputEvent> p_event);void _zoom_callback(float p_zoom_factor, Vector2 p_origin, Ref<InputEvent> p_event);+#ifndef _2D_DISABLEDvoid _reset_camera_2d();void _update_view_2d();-#endif // _2D_DISABLED+#endifVariant _find_ci_start_callback() const;bool _point_selected_ci_callback(const Variant &p_node, bool p_append);@@ -212,9 +215,12 @@ private:bool _plugin_input_callback(const Ref<InputEvent> &p_event) { return false; }void _box_selected_ci(const Array &p_nodes);++#ifdef TOOLS_ENABLEDvoid _save_canvas_state_requested(const Array &p_selection, bool p_save_bones);void _restore_canvas_state_requested(const Array &p_selection, bool p_restore_bones);void _commit_canvas_state_requested(const Array &p_selection, const String &p_message, bool p_commit_bones);+#endif#ifndef _3D_DISABLEDvoid _find_3d_items_at_pos(const Point2 &p_pos, Vector<DebuggerHelpers::SelectResult> &r_items);@@ -226,7 +232,7 @@ private:bool _handle_3d_input(const Ref<InputEvent> &p_event);void _reset_camera_3d();-#endif // _3D_DISABLED+#endifRuntimeNodeSelect() { singleton = this; }diff --git a/scene/debugger/scene_debugger.cpp b/scene/debugger/scene_debugger.cppindex a0dd64fef05..bd5fd30c046 100644--- a/scene/debugger/scene_debugger.cpp+++ b/scene/debugger/scene_debugger.cpp@@ -132,11 +132,13 @@ void SceneDebugger::_handle_embed_input(const Ref<InputEvent> &p_event, const DiLocalVector<String> shortcuts = {"editor/suspend_resume_embedded_project","canvas_item_editor/select_mode",+ "canvas_item_editor/pan_mode",+#ifdef TOOLS_ENABLED"canvas_item_editor/move_mode","canvas_item_editor/rotate_mode","canvas_item_editor/scale_mode",- "canvas_item_editor/pan_mode","canvas_item_editor/use_local_space",+#endif};for (const String &key : shortcuts) {Ref<Shortcut> shortcut = p_settings.get(key, Ref<Shortcut>());@@ -152,6 +154,7 @@ void SceneDebugger::_handle_embed_input(const Ref<InputEvent> &p_event, const Direturn;}+#ifdef TOOLS_ENABLEDif (RuntimeNodeSelect::get_singleton()->node_select_type == RuntimeNodeSelect::NODE_TYPE_NONE) {return; // Ignore undo/redo actions in Input mode, as it can result in unwanted edits.}@@ -193,6 +196,7 @@ void SceneDebugger::_handle_embed_input(const Ref<InputEvent> &p_event, const Di}EngineDebugger::get_singleton()->send_message("editor_shortcut_pressed", { action });+#endif}void SceneDebugger::_on_window_size_changed() {@@ -539,12 +543,14 @@ Error SceneDebugger::_msg_runtime_node_select_set_ci_tool(const Array &p_args) {return OK;}+#ifdef TOOLS_ENABLEDError SceneDebugger::_msg_runtime_node_select_set_ci_local_space(const Array &p_args) {ERR_FAIL_COND_V(p_args.is_empty(), ERR_INVALID_DATA);bool enabled = p_args[0];RuntimeNodeSelect::get_singleton()->_set_ci_local_space(enabled);return OK;}+#endifError SceneDebugger::_msg_runtime_node_select_set_n3d_tool(const Array &p_args) {ERR_FAIL_COND_V(p_args.is_empty(), ERR_INVALID_DATA);@@ -751,7 +757,9 @@ void SceneDebugger::_init_message_handlers() {message_handlers["runtime_node_select_set_node_type"] = _msg_runtime_node_select_set_node_type;message_handlers["runtime_node_select_set_selection_visible"] = _msg_runtime_node_select_set_selection_visible;message_handlers["runtime_node_select_set_ci_tool"] = _msg_runtime_node_select_set_ci_tool;+#ifdef TOOLS_ENABLEDmessage_handlers["runtime_node_select_set_ci_local_space"] = _msg_runtime_node_select_set_ci_local_space;+#endif // TOOLS_ENABLEDmessage_handlers["runtime_node_select_set_n3d_tool"] = _msg_runtime_node_select_set_n3d_tool;message_handlers["runtime_node_select_set_avoid_locked"] = _msg_runtime_node_select_set_avoid_locked;message_handlers["runtime_node_select_set_prefer_group"] = _msg_runtime_node_select_set_prefer_group;diff --git a/scene/debugger/scene_debugger.h b/scene/debugger/scene_debugger.hindex 36eceb118ff..29d6a7af185 100644--- a/scene/debugger/scene_debugger.h+++ b/scene/debugger/scene_debugger.h@@ -110,7 +110,9 @@ private:static Error _msg_runtime_node_select_setup(const Array &p_args);static Error _msg_runtime_node_select_set_node_type(const Array &p_args);static Error _msg_runtime_node_select_set_ci_tool(const Array &p_args);+#ifdef TOOLS_ENABLEDstatic Error _msg_runtime_node_select_set_ci_local_space(const Array &p_args);+#endif // TOOLS_ENABLEDstatic Error _msg_runtime_node_select_set_n3d_tool(const Array &p_args);static Error _msg_runtime_node_select_set_selection_visible(const Array &p_args);static Error _msg_runtime_node_select_set_avoid_locked(const Array &p_args);diff --git a/scene/theme/default_theme.cpp b/scene/theme/default_theme.cppindex eb4599cf48f..b8348f0e641 100644--- a/scene/theme/default_theme.cpp+++ b/scene/theme/default_theme.cpp@@ -1386,9 +1386,9 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, consttheme->set_icon("resizer", "GraphEditMinimap", icons["resizer_nw"]);theme->set_color("resizer_color", "GraphEditMinimap", Color(1, 1, 1, 0.85));- // Debug+ // Runtime Node Manipulation-#ifdef DEBUG_ENABLED+#ifdef TOOLS_ENABLEDtheme->set_icon("pivot", "Debug", icons["debug_pivot"]);theme->set_icon("resize", "Debug", icons["debug_resize"]);theme->set_icon("anchor", "Debug", icons["debug_anchor"]);diff --git a/scene/theme/icons/SCsub b/scene/theme/icons/SCsubindex bbb45ae016a..2f76c244c84 100644--- a/scene/theme/icons/SCsub+++ b/scene/theme/icons/SCsub@@ -6,7 +6,7 @@ Import("env")import default_theme_icons_builderssources = Glob("*.svg")-if env["target"] in ["editor", "template_debug"]:+if env["target"] in ["editor"]:# These are only needed for remote debugging.sources += Glob("debug_icons/*.svg")