From a401812fbff7cebc4a26cbd1f9229c16be0f904b Mon Sep 17 00:00:00 2001 From: Michael Alexsander Date: Fri, 1 Nov 2024 16:25:18 -0300 Subject: [PATCH] Compile `CanvasItem._edit_*()` functions with `DEBUG_ENABLED` --- scene/2d/animated_sprite_2d.cpp | 2 +- scene/2d/animated_sprite_2d.h | 2 +- scene/2d/back_buffer_copy.cpp | 2 +- scene/2d/back_buffer_copy.h | 2 +- scene/2d/light_2d.cpp | 3 +-- scene/2d/light_2d.h | 2 +- scene/2d/light_occluder_2d.cpp | 4 ++-- scene/2d/light_occluder_2d.h | 4 ++-- scene/2d/line_2d.cpp | 2 +- scene/2d/line_2d.h | 2 +- scene/2d/marker_2d.cpp | 2 +- scene/2d/marker_2d.h | 2 +- scene/2d/mesh_instance_2d.cpp | 2 +- scene/2d/mesh_instance_2d.h | 2 +- scene/2d/multimesh_instance_2d.cpp | 2 +- scene/2d/multimesh_instance_2d.h | 2 +- scene/2d/navigation_link_2d.cpp | 4 ++-- scene/2d/navigation_link_2d.h | 2 +- scene/2d/navigation_region_2d.cpp | 2 +- scene/2d/navigation_region_2d.h | 2 +- scene/2d/node_2d.cpp | 2 +- scene/2d/node_2d.h | 2 +- scene/2d/path_2d.cpp | 2 +- scene/2d/path_2d.h | 2 +- scene/2d/physics/collision_polygon_2d.cpp | 2 +- scene/2d/physics/collision_polygon_2d.h | 2 +- scene/2d/polygon_2d.cpp | 2 +- scene/2d/polygon_2d.h | 2 +- scene/2d/sprite_2d.cpp | 2 +- scene/2d/sprite_2d.h | 2 +- scene/2d/tile_map.cpp | 2 +- scene/2d/tile_map.h | 2 +- scene/2d/touch_screen_button.cpp | 2 +- scene/2d/touch_screen_button.h | 2 +- scene/2d/visible_on_screen_notifier_2d.cpp | 2 +- scene/2d/visible_on_screen_notifier_2d.h | 2 +- scene/gui/control.cpp | 6 +++++- scene/gui/control.h | 2 +- scene/main/canvas_item.cpp | 4 ++-- scene/main/canvas_item.h | 4 ++-- scene/resources/2d/navigation_polygon.cpp | 2 +- scene/resources/2d/navigation_polygon.h | 2 +- 42 files changed, 51 insertions(+), 48 deletions(-) diff --git a/scene/2d/animated_sprite_2d.cpp b/scene/2d/animated_sprite_2d.cpp index 1cab29f38359..4dd176cc01e0 100644 --- a/scene/2d/animated_sprite_2d.cpp +++ b/scene/2d/animated_sprite_2d.cpp @@ -32,7 +32,7 @@ #include "scene/main/viewport.h" -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED Dictionary AnimatedSprite2D::_edit_get_state() const { Dictionary state = Node2D::_edit_get_state(); state["offset"] = offset; diff --git a/scene/2d/animated_sprite_2d.h b/scene/2d/animated_sprite_2d.h index 914dc405ab46..3cf61dd15bc3 100644 --- a/scene/2d/animated_sprite_2d.h +++ b/scene/2d/animated_sprite_2d.h @@ -72,7 +72,7 @@ class AnimatedSprite2D : public Node2D { void _validate_property(PropertyInfo &p_property) const; public: -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED virtual Dictionary _edit_get_state() const override; virtual void _edit_set_state(const Dictionary &p_state) override; diff --git a/scene/2d/back_buffer_copy.cpp b/scene/2d/back_buffer_copy.cpp index 4cae1affc36e..85516f2c16ea 100644 --- a/scene/2d/back_buffer_copy.cpp +++ b/scene/2d/back_buffer_copy.cpp @@ -45,7 +45,7 @@ void BackBufferCopy::_update_copy_mode() { } } -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED Rect2 BackBufferCopy::_edit_get_rect() const { return rect; } diff --git a/scene/2d/back_buffer_copy.h b/scene/2d/back_buffer_copy.h index e91899570818..b2548707d907 100644 --- a/scene/2d/back_buffer_copy.h +++ b/scene/2d/back_buffer_copy.h @@ -54,7 +54,7 @@ class BackBufferCopy : public Node2D { void _validate_property(PropertyInfo &p_property) const; public: -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED Rect2 _edit_get_rect() const override; virtual bool _edit_use_rect() const override; #endif diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp index 50c5873781e7..0a97fe56694b 100644 --- a/scene/2d/light_2d.cpp +++ b/scene/2d/light_2d.cpp @@ -342,8 +342,7 @@ Light2D::~Light2D() { ////////////////////////////// -#ifdef TOOLS_ENABLED - +#ifdef DEBUG_ENABLED Dictionary PointLight2D::_edit_get_state() const { Dictionary state = Node2D::_edit_get_state(); state["offset"] = get_texture_offset(); diff --git a/scene/2d/light_2d.h b/scene/2d/light_2d.h index 8a0c2a2a926b..d0f32eb639f9 100644 --- a/scene/2d/light_2d.h +++ b/scene/2d/light_2d.h @@ -153,7 +153,7 @@ class PointLight2D : public Light2D { static void _bind_methods(); public: -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED virtual Dictionary _edit_get_state() const override; virtual void _edit_set_state(const Dictionary &p_state) override; diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp index 199384556423..09933af1b2b6 100644 --- a/scene/2d/light_occluder_2d.cpp +++ b/scene/2d/light_occluder_2d.cpp @@ -35,7 +35,7 @@ #define LINE_GRAB_WIDTH 8 -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED Rect2 OccluderPolygon2D::_edit_get_rect() const { if (rect_cache_dirty) { if (closed) { @@ -218,7 +218,7 @@ void LightOccluder2D::_notification(int p_what) { } } -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED Rect2 LightOccluder2D::_edit_get_rect() const { return occluder_polygon.is_valid() ? occluder_polygon->_edit_get_rect() : Rect2(); } diff --git a/scene/2d/light_occluder_2d.h b/scene/2d/light_occluder_2d.h index 4c499d0465cf..6fac55c2abb0 100644 --- a/scene/2d/light_occluder_2d.h +++ b/scene/2d/light_occluder_2d.h @@ -56,7 +56,7 @@ class OccluderPolygon2D : public Resource { static void _bind_methods(); public: -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED virtual Rect2 _edit_get_rect() const; virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const; #endif @@ -93,7 +93,7 @@ class LightOccluder2D : public Node2D { static void _bind_methods(); public: -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED virtual Rect2 _edit_get_rect() const override; virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const override; #endif diff --git a/scene/2d/line_2d.cpp b/scene/2d/line_2d.cpp index be58875e0e7c..734db2ea2b3c 100644 --- a/scene/2d/line_2d.cpp +++ b/scene/2d/line_2d.cpp @@ -36,7 +36,7 @@ Line2D::Line2D() { } -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED Rect2 Line2D::_edit_get_rect() const { if (_points.size() == 0) { return Rect2(0, 0, 0, 0); diff --git a/scene/2d/line_2d.h b/scene/2d/line_2d.h index 1d750ca456c9..01563364038d 100644 --- a/scene/2d/line_2d.h +++ b/scene/2d/line_2d.h @@ -55,7 +55,7 @@ class Line2D : public Node2D { LINE_TEXTURE_STRETCH }; -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED virtual Rect2 _edit_get_rect() const override; virtual bool _edit_use_rect() const override; virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const override; diff --git a/scene/2d/marker_2d.cpp b/scene/2d/marker_2d.cpp index b1b9705bf8fe..715d518540f2 100644 --- a/scene/2d/marker_2d.cpp +++ b/scene/2d/marker_2d.cpp @@ -61,7 +61,7 @@ void Marker2D::_draw_cross() { draw_multiline_colors(points, colors); } -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED Rect2 Marker2D::_edit_get_rect() const { real_t extents = get_gizmo_extents(); return Rect2(Point2(-extents, -extents), Size2(extents * 2, extents * 2)); diff --git a/scene/2d/marker_2d.h b/scene/2d/marker_2d.h index e81454797b66..ca729e20d256 100644 --- a/scene/2d/marker_2d.h +++ b/scene/2d/marker_2d.h @@ -45,7 +45,7 @@ class Marker2D : public Node2D { static void _bind_methods(); public: -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED virtual Rect2 _edit_get_rect() const override; virtual bool _edit_use_rect() const override; #endif diff --git a/scene/2d/mesh_instance_2d.cpp b/scene/2d/mesh_instance_2d.cpp index 1031a67343d4..852a1c889a26 100644 --- a/scene/2d/mesh_instance_2d.cpp +++ b/scene/2d/mesh_instance_2d.cpp @@ -88,7 +88,7 @@ Ref MeshInstance2D::get_texture() const { return texture; } -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED Rect2 MeshInstance2D::_edit_get_rect() const { if (mesh.is_valid()) { AABB aabb = mesh->get_aabb(); diff --git a/scene/2d/mesh_instance_2d.h b/scene/2d/mesh_instance_2d.h index c914f13ade6a..f79f429ded79 100644 --- a/scene/2d/mesh_instance_2d.h +++ b/scene/2d/mesh_instance_2d.h @@ -45,7 +45,7 @@ class MeshInstance2D : public Node2D { static void _bind_methods(); public: -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED virtual Rect2 _edit_get_rect() const override; virtual bool _edit_use_rect() const override; #endif diff --git a/scene/2d/multimesh_instance_2d.cpp b/scene/2d/multimesh_instance_2d.cpp index 417e628517a2..8866dae31fff 100644 --- a/scene/2d/multimesh_instance_2d.cpp +++ b/scene/2d/multimesh_instance_2d.cpp @@ -84,7 +84,7 @@ Ref MultiMeshInstance2D::get_texture() const { return texture; } -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED Rect2 MultiMeshInstance2D::_edit_get_rect() const { if (multimesh.is_valid()) { AABB aabb = multimesh->get_aabb(); diff --git a/scene/2d/multimesh_instance_2d.h b/scene/2d/multimesh_instance_2d.h index 064741229470..fa6a1330312d 100644 --- a/scene/2d/multimesh_instance_2d.h +++ b/scene/2d/multimesh_instance_2d.h @@ -46,7 +46,7 @@ class MultiMeshInstance2D : public Node2D { static void _bind_methods(); public: -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED virtual Rect2 _edit_get_rect() const override; #endif diff --git a/scene/2d/navigation_link_2d.cpp b/scene/2d/navigation_link_2d.cpp index 4961e18dc910..d90793a4c563 100644 --- a/scene/2d/navigation_link_2d.cpp +++ b/scene/2d/navigation_link_2d.cpp @@ -132,7 +132,7 @@ void NavigationLink2D::_notification(int p_what) { } } -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED Rect2 NavigationLink2D::_edit_get_rect() const { if (!is_inside_tree()) { return Rect2(); @@ -152,7 +152,7 @@ bool NavigationLink2D::_edit_is_selected_on_click(const Point2 &p_point, double Vector2 closest_point = Geometry2D::get_closest_point_to_segment(p_point, segment); return p_point.distance_to(closest_point) < p_tolerance; } -#endif // TOOLS_ENABLED +#endif // DEBUG_ENABLED RID NavigationLink2D::get_rid() const { return link; diff --git a/scene/2d/navigation_link_2d.h b/scene/2d/navigation_link_2d.h index c724096607d9..de16dc64cbb4 100644 --- a/scene/2d/navigation_link_2d.h +++ b/scene/2d/navigation_link_2d.h @@ -62,7 +62,7 @@ class NavigationLink2D : public Node2D { #endif // DISABLE_DEPRECATED public: -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED virtual Rect2 _edit_get_rect() const override; virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const override; #endif diff --git a/scene/2d/navigation_region_2d.cpp b/scene/2d/navigation_region_2d.cpp index f65a3c0eccab..d766626e7c8c 100644 --- a/scene/2d/navigation_region_2d.cpp +++ b/scene/2d/navigation_region_2d.cpp @@ -142,7 +142,7 @@ RID NavigationRegion2D::get_region_rid() const { return get_rid(); } -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED Rect2 NavigationRegion2D::_edit_get_rect() const { return navigation_polygon.is_valid() ? navigation_polygon->_edit_get_rect() : Rect2(); } diff --git a/scene/2d/navigation_region_2d.h b/scene/2d/navigation_region_2d.h index 52101cb93e0a..54a4035a9f0a 100644 --- a/scene/2d/navigation_region_2d.h +++ b/scene/2d/navigation_region_2d.h @@ -75,7 +75,7 @@ class NavigationRegion2D : public Node2D { #endif // DISABLE_DEPRECATED public: -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED virtual Rect2 _edit_get_rect() const override; virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const override; #endif diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp index aae7eff7bd0b..ee967c8bef6e 100644 --- a/scene/2d/node_2d.cpp +++ b/scene/2d/node_2d.cpp @@ -32,7 +32,7 @@ #include "scene/main/viewport.h" -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED Dictionary Node2D::_edit_get_state() const { Dictionary state; state["position"] = get_position(); diff --git a/scene/2d/node_2d.h b/scene/2d/node_2d.h index de46dbd7d67e..9bd71528856c 100644 --- a/scene/2d/node_2d.h +++ b/scene/2d/node_2d.h @@ -56,7 +56,7 @@ class Node2D : public CanvasItem { static void _bind_methods(); public: -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED virtual Dictionary _edit_get_state() const override; virtual void _edit_set_state(const Dictionary &p_state) override; diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp index 7d645ba44845..fe0cb770e0b0 100644 --- a/scene/2d/path_2d.cpp +++ b/scene/2d/path_2d.cpp @@ -37,7 +37,7 @@ #include "editor/themes/editor_scale.h" #endif -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED Rect2 Path2D::_edit_get_rect() const { if (!curve.is_valid() || curve->get_point_count() == 0) { return Rect2(0, 0, 0, 0); diff --git a/scene/2d/path_2d.h b/scene/2d/path_2d.h index bfd5cde5e9cb..5162f5144ab4 100644 --- a/scene/2d/path_2d.h +++ b/scene/2d/path_2d.h @@ -48,7 +48,7 @@ class Path2D : public Node2D { static void _bind_methods(); public: -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED virtual Rect2 _edit_get_rect() const override; virtual bool _edit_use_rect() const override; virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const override; diff --git a/scene/2d/physics/collision_polygon_2d.cpp b/scene/2d/physics/collision_polygon_2d.cpp index b49badac1f2b..a3e9fcce7e88 100644 --- a/scene/2d/physics/collision_polygon_2d.cpp +++ b/scene/2d/physics/collision_polygon_2d.cpp @@ -217,7 +217,7 @@ CollisionPolygon2D::BuildMode CollisionPolygon2D::get_build_mode() const { return build_mode; } -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED Rect2 CollisionPolygon2D::_edit_get_rect() const { return aabb; } diff --git a/scene/2d/physics/collision_polygon_2d.h b/scene/2d/physics/collision_polygon_2d.h index f1ee30babeb6..93920124feb7 100644 --- a/scene/2d/physics/collision_polygon_2d.h +++ b/scene/2d/physics/collision_polygon_2d.h @@ -65,7 +65,7 @@ class CollisionPolygon2D : public Node2D { static void _bind_methods(); public: -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED virtual Rect2 _edit_get_rect() const override; virtual bool _edit_use_rect() const override; virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const override; diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp index 42f7a75c0a7c..c4358f0d06e1 100644 --- a/scene/2d/polygon_2d.cpp +++ b/scene/2d/polygon_2d.cpp @@ -33,7 +33,7 @@ #include "core/math/geometry_2d.h" #include "skeleton_2d.h" -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED Dictionary Polygon2D::_edit_get_state() const { Dictionary state = Node2D::_edit_get_state(); state["offset"] = offset; diff --git a/scene/2d/polygon_2d.h b/scene/2d/polygon_2d.h index b2cd06de53f4..d0b379ece530 100644 --- a/scene/2d/polygon_2d.h +++ b/scene/2d/polygon_2d.h @@ -80,7 +80,7 @@ class Polygon2D : public Node2D { void _validate_property(PropertyInfo &p_property) const; public: -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED virtual Dictionary _edit_get_state() const override; virtual void _edit_set_state(const Dictionary &p_state) override; diff --git a/scene/2d/sprite_2d.cpp b/scene/2d/sprite_2d.cpp index 2b5c40f212f5..acda87bb9496 100644 --- a/scene/2d/sprite_2d.cpp +++ b/scene/2d/sprite_2d.cpp @@ -32,7 +32,7 @@ #include "scene/main/window.h" -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED Dictionary Sprite2D::_edit_get_state() const { Dictionary state = Node2D::_edit_get_state(); state["offset"] = offset; diff --git a/scene/2d/sprite_2d.h b/scene/2d/sprite_2d.h index d084e9575df6..74be11201f59 100644 --- a/scene/2d/sprite_2d.h +++ b/scene/2d/sprite_2d.h @@ -67,7 +67,7 @@ class Sprite2D : public Node2D { void _validate_property(PropertyInfo &p_property) const; public: -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED virtual Dictionary _edit_get_state() const override; virtual void _edit_set_state(const Dictionary &p_state) override; diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 45cfb8cf33f8..91f9aa572a0f 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -649,7 +649,7 @@ void TileMap::notify_runtime_tile_data_update(int p_layer) { } } -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED Rect2 TileMap::_edit_get_rect() const { // Return the visible rect of the tilemap. if (layers.is_empty()) { diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h index 142dc1193f8a..12f243874c09 100644 --- a/scene/2d/tile_map.h +++ b/scene/2d/tile_map.h @@ -110,7 +110,7 @@ class TileMap : public Node2D { #endif public: -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED virtual Rect2 _edit_get_rect() const override; #endif diff --git a/scene/2d/touch_screen_button.cpp b/scene/2d/touch_screen_button.cpp index cbfd7e38dc29..d6411c782864 100644 --- a/scene/2d/touch_screen_button.cpp +++ b/scene/2d/touch_screen_button.cpp @@ -330,7 +330,7 @@ void TouchScreenButton::_release(bool p_exiting_tree) { } } -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED Rect2 TouchScreenButton::_edit_get_rect() const { if (texture_normal.is_null()) { return CanvasItem::_edit_get_rect(); diff --git a/scene/2d/touch_screen_button.h b/scene/2d/touch_screen_button.h index 4467604e2b2a..3b992f2d041b 100644 --- a/scene/2d/touch_screen_button.h +++ b/scene/2d/touch_screen_button.h @@ -76,7 +76,7 @@ class TouchScreenButton : public Node2D { #endif // DISABLE_DEPRECATED public: -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED virtual Rect2 _edit_get_rect() const override; virtual bool _edit_use_rect() const override; #endif diff --git a/scene/2d/visible_on_screen_notifier_2d.cpp b/scene/2d/visible_on_screen_notifier_2d.cpp index c64507fe32f6..cc36e4684075 100644 --- a/scene/2d/visible_on_screen_notifier_2d.cpp +++ b/scene/2d/visible_on_screen_notifier_2d.cpp @@ -30,7 +30,7 @@ #include "visible_on_screen_notifier_2d.h" -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED Rect2 VisibleOnScreenNotifier2D::_edit_get_rect() const { return rect; } diff --git a/scene/2d/visible_on_screen_notifier_2d.h b/scene/2d/visible_on_screen_notifier_2d.h index df2832a9768b..bebf70878890 100644 --- a/scene/2d/visible_on_screen_notifier_2d.h +++ b/scene/2d/visible_on_screen_notifier_2d.h @@ -54,7 +54,7 @@ class VisibleOnScreenNotifier2D : public Node2D { static void _bind_methods(); public: -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED virtual Rect2 _edit_get_rect() const override; virtual bool _edit_use_rect() const override; #endif diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 4b3007543bc2..71ae92097005 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -49,7 +49,7 @@ // Editor plugin interoperability. // TODO: Decouple controls from their editor plugin and get rid of this. -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED Dictionary Control::_edit_get_state() const { Dictionary s; s["rotation"] = get_rotation(); @@ -119,7 +119,9 @@ void Control::_edit_set_state(const Dictionary &p_state) { void Control::_edit_set_position(const Point2 &p_position) { ERR_FAIL_COND_MSG(!Engine::get_singleton()->is_editor_hint(), "This function can only be used from editor plugins."); +#ifdef TOOLS_ENABLED set_position(p_position, ControlEditorToolbar::get_singleton()->is_anchors_mode_enabled() && get_parent_control()); +#endif } Point2 Control::_edit_get_position() const { @@ -136,8 +138,10 @@ Size2 Control::_edit_get_scale() const { void Control::_edit_set_rect(const Rect2 &p_edit_rect) { ERR_FAIL_COND_MSG(!Engine::get_singleton()->is_editor_hint(), "This function can only be used from editor plugins."); +#ifdef TOOLS_ENABLED set_position((get_position() + get_transform().basis_xform(p_edit_rect.position)).snappedf(1), ControlEditorToolbar::get_singleton()->is_anchors_mode_enabled()); set_size(p_edit_rect.size.snappedf(1), ControlEditorToolbar::get_singleton()->is_anchors_mode_enabled()); +#endif } Rect2 Control::_edit_get_rect() const { diff --git a/scene/gui/control.h b/scene/gui/control.h index 6cabf10971ad..b31b1b644610 100644 --- a/scene/gui/control.h +++ b/scene/gui/control.h @@ -385,7 +385,7 @@ class Control : public CanvasItem { // Editor plugin interoperability. // TODO: Decouple controls from their editor plugin and get rid of this. -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED virtual Dictionary _edit_get_state() const override; virtual void _edit_set_state(const Dictionary &p_state) override; diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp index 7c8bf9c80945..162d95e28fbf 100644 --- a/scene/main/canvas_item.cpp +++ b/scene/main/canvas_item.cpp @@ -44,7 +44,7 @@ #define ERR_DRAW_GUARD \ ERR_FAIL_COND_MSG(!drawing, "Drawing is only allowed inside this node's `_draw()`, functions connected to its `draw` signal, or when it receives NOTIFICATION_DRAW.") -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED bool CanvasItem::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const { if (_edit_use_rect()) { return _edit_get_rect().has_point(p_point); @@ -1141,7 +1141,7 @@ void CanvasItem::_validate_property(PropertyInfo &p_property) const { void CanvasItem::_bind_methods() { ClassDB::bind_method(D_METHOD("_top_level_raise_self"), &CanvasItem::_top_level_raise_self); -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED ClassDB::bind_method(D_METHOD("_edit_set_state", "state"), &CanvasItem::_edit_set_state); ClassDB::bind_method(D_METHOD("_edit_get_state"), &CanvasItem::_edit_get_state); ClassDB::bind_method(D_METHOD("_edit_set_position", "position"), &CanvasItem::_edit_set_position); diff --git a/scene/main/canvas_item.h b/scene/main/canvas_item.h index 5c4477234bbe..b94e943e2f66 100644 --- a/scene/main/canvas_item.h +++ b/scene/main/canvas_item.h @@ -193,8 +193,8 @@ class CanvasItem : public Node { NOTIFICATION_WORLD_2D_CHANGED = 36, }; - /* EDITOR */ -#ifdef TOOLS_ENABLED + /* EDITOR AND DEBUGGING */ +#ifdef DEBUG_ENABLED // Select the node virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const; diff --git a/scene/resources/2d/navigation_polygon.cpp b/scene/resources/2d/navigation_polygon.cpp index 3dfa906e3b4f..0d80b36ab843 100644 --- a/scene/resources/2d/navigation_polygon.cpp +++ b/scene/resources/2d/navigation_polygon.cpp @@ -36,7 +36,7 @@ #include "thirdparty/misc/polypartition.h" -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED Rect2 NavigationPolygon::_edit_get_rect() const { RWLockRead read_lock(rwlock); if (rect_cache_dirty) { diff --git a/scene/resources/2d/navigation_polygon.h b/scene/resources/2d/navigation_polygon.h index ed2c606c556d..c7412914335a 100644 --- a/scene/resources/2d/navigation_polygon.h +++ b/scene/resources/2d/navigation_polygon.h @@ -68,7 +68,7 @@ class NavigationPolygon : public Resource { TypedArray> _get_outlines() const; public: -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED Rect2 _edit_get_rect() const; bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const; #endif