diff --git a/scene/2d/animated_sprite_2d.cpp b/scene/2d/animated_sprite_2d.cpp index 1cab29f38359..108f2006135d 100644 --- a/scene/2d/animated_sprite_2d.cpp +++ b/scene/2d/animated_sprite_2d.cpp @@ -56,7 +56,9 @@ Point2 AnimatedSprite2D::_edit_get_pivot() const { bool AnimatedSprite2D::_edit_use_pivot() const { return true; } +#endif // TOOLS_ENABLED +#ifdef DEBUG_ENABLED Rect2 AnimatedSprite2D::_edit_get_rect() const { return _get_rect(); } @@ -75,7 +77,7 @@ bool AnimatedSprite2D::_edit_use_rect() const { } return t.is_valid(); } -#endif +#endif // DEBUG_ENABLED Rect2 AnimatedSprite2D::get_anchorable_rect() const { return _get_rect(); @@ -593,7 +595,7 @@ void AnimatedSprite2D::get_argument_options(const StringName &p_function, int p_ } Node2D::get_argument_options(p_function, p_idx, r_options); } -#endif +#endif // TOOLS_ENABLED #ifndef DISABLE_DEPRECATED bool AnimatedSprite2D::_set(const StringName &p_name, const Variant &p_value) { diff --git a/scene/2d/animated_sprite_2d.h b/scene/2d/animated_sprite_2d.h index 914dc405ab46..3de36e7cab8a 100644 --- a/scene/2d/animated_sprite_2d.h +++ b/scene/2d/animated_sprite_2d.h @@ -66,7 +66,7 @@ class AnimatedSprite2D : public Node2D { protected: #ifndef DISABLE_DEPRECATED bool _set(const StringName &p_name, const Variant &p_value); -#endif +#endif // DISABLE_DEPRECATED static void _bind_methods(); void _notification(int p_what); void _validate_property(PropertyInfo &p_property) const; @@ -79,9 +79,12 @@ class AnimatedSprite2D : public Node2D { virtual void _edit_set_pivot(const Point2 &p_pivot) override; virtual Point2 _edit_get_pivot() const override; virtual bool _edit_use_pivot() const override; +#endif // TOOLS_ENABLED + +#ifdef DEBUG_ENABLED virtual Rect2 _edit_get_rect() const override; virtual bool _edit_use_rect() const override; -#endif +#endif // DEBUG_ENABLED virtual Rect2 get_anchorable_rect() const override; @@ -129,7 +132,7 @@ class AnimatedSprite2D : public Node2D { #ifdef TOOLS_ENABLED virtual void get_argument_options(const StringName &p_function, int p_idx, List *r_options) const override; -#endif +#endif // TOOLS_ENABLED AnimatedSprite2D(); }; diff --git a/scene/2d/back_buffer_copy.cpp b/scene/2d/back_buffer_copy.cpp index 4cae1affc36e..045dd3be025c 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; } @@ -53,7 +53,7 @@ Rect2 BackBufferCopy::_edit_get_rect() const { bool BackBufferCopy::_edit_use_rect() const { return true; } -#endif +#endif // DEBUG_ENABLED Rect2 BackBufferCopy::get_anchorable_rect() const { return rect; diff --git a/scene/2d/back_buffer_copy.h b/scene/2d/back_buffer_copy.h index e91899570818..9bcb731b509a 100644 --- a/scene/2d/back_buffer_copy.h +++ b/scene/2d/back_buffer_copy.h @@ -54,10 +54,10 @@ 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 +#endif // DEBUG_ENABLED void set_rect(const Rect2 &p_rect); Rect2 get_rect() const; diff --git a/scene/2d/light_2d.cpp b/scene/2d/light_2d.cpp index 50c5873781e7..21648bbc4956 100644 --- a/scene/2d/light_2d.cpp +++ b/scene/2d/light_2d.cpp @@ -54,7 +54,7 @@ void Light2D::_update_light_visibility() { if (editor_only) { editor_ok = false; } -#endif +#endif // TOOLS_ENABLED RS::get_singleton()->canvas_light_set_enabled(canvas_light, enabled && is_visible_in_tree() && editor_ok); } @@ -343,7 +343,6 @@ Light2D::~Light2D() { ////////////////////////////// #ifdef TOOLS_ENABLED - Dictionary PointLight2D::_edit_get_state() const { Dictionary state = Node2D::_edit_get_state(); state["offset"] = get_texture_offset(); @@ -367,7 +366,9 @@ Point2 PointLight2D::_edit_get_pivot() const { bool PointLight2D::_edit_use_pivot() const { return true; } +#endif // TOOLS_ENABLED +#ifdef DEBUG_ENABLED Rect2 PointLight2D::_edit_get_rect() const { if (texture.is_null()) { return Rect2(); @@ -380,7 +381,7 @@ Rect2 PointLight2D::_edit_get_rect() const { bool PointLight2D::_edit_use_rect() const { return !texture.is_null(); } -#endif +#endif // DEBUG_ENABLED Rect2 PointLight2D::get_anchorable_rect() const { if (texture.is_null()) { diff --git a/scene/2d/light_2d.h b/scene/2d/light_2d.h index 8a0c2a2a926b..0c1dae071c7b 100644 --- a/scene/2d/light_2d.h +++ b/scene/2d/light_2d.h @@ -160,9 +160,12 @@ class PointLight2D : public Light2D { virtual void _edit_set_pivot(const Point2 &p_pivot) override; virtual Point2 _edit_get_pivot() const override; virtual bool _edit_use_pivot() const override; +#endif // TOOLS_ENABLED + +#ifdef DEBUG_ENABLED virtual Rect2 _edit_get_rect() const override; virtual bool _edit_use_rect() const override; -#endif +#endif // DEBUG_ENABLED virtual Rect2 get_anchorable_rect() const override; diff --git a/scene/2d/light_occluder_2d.cpp b/scene/2d/light_occluder_2d.cpp index 199384556423..e2e4125d1f5b 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) { @@ -83,7 +83,7 @@ bool OccluderPolygon2D::_edit_is_selected_on_click(const Point2 &p_point, double return false; } } -#endif +#endif // DEBUG_ENABLED void OccluderPolygon2D::set_polygon(const Vector &p_polygon) { polygon = p_polygon; @@ -156,7 +156,7 @@ OccluderPolygon2D::~OccluderPolygon2D() { void LightOccluder2D::_poly_changed() { #ifdef DEBUG_ENABLED queue_redraw(); -#endif +#endif // DEBUG_ENABLED } void LightOccluder2D::_physics_interpolated_changed() { @@ -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(); } @@ -226,14 +226,14 @@ Rect2 LightOccluder2D::_edit_get_rect() const { bool LightOccluder2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const { return occluder_polygon.is_valid() ? occluder_polygon->_edit_is_selected_on_click(p_point, p_tolerance) : false; } -#endif +#endif // DEBUG_ENABLED void LightOccluder2D::set_occluder_polygon(const Ref &p_polygon) { #ifdef DEBUG_ENABLED if (occluder_polygon.is_valid()) { occluder_polygon->disconnect_changed(callable_mp(this, &LightOccluder2D::_poly_changed)); } -#endif +#endif // DEBUG_ENABLED occluder_polygon = p_polygon; if (occluder_polygon.is_valid()) { @@ -247,7 +247,7 @@ void LightOccluder2D::set_occluder_polygon(const Ref &p_polyg occluder_polygon->connect_changed(callable_mp(this, &LightOccluder2D::_poly_changed)); } queue_redraw(); -#endif +#endif // DEBUG_ENABLED } Ref LightOccluder2D::get_occluder_polygon() const { diff --git a/scene/2d/light_occluder_2d.h b/scene/2d/light_occluder_2d.h index 4c499d0465cf..b9f7eec33dee 100644 --- a/scene/2d/light_occluder_2d.h +++ b/scene/2d/light_occluder_2d.h @@ -56,11 +56,10 @@ 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 - +#endif // DEBUG_ENABLED void set_polygon(const Vector &p_polygon); Vector get_polygon() const; @@ -93,10 +92,10 @@ 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 +#endif // DEBUG_ENABLED void set_occluder_polygon(const Ref &p_polygon); Ref get_occluder_polygon() const; 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..1f4ea172e95e 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)); @@ -70,7 +70,7 @@ Rect2 Marker2D::_edit_get_rect() const { bool Marker2D::_edit_use_rect() const { return false; } -#endif +#endif // DEBUG_ENABLED void Marker2D::_notification(int p_what) { switch (p_what) { diff --git a/scene/2d/marker_2d.h b/scene/2d/marker_2d.h index e81454797b66..6a1dfb1cb2bb 100644 --- a/scene/2d/marker_2d.h +++ b/scene/2d/marker_2d.h @@ -45,10 +45,10 @@ 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 +#endif // DEBUG_ENABLED void set_gizmo_extents(real_t p_extents); real_t get_gizmo_extents() const; diff --git a/scene/2d/mesh_instance_2d.cpp b/scene/2d/mesh_instance_2d.cpp index 1031a67343d4..9b7a89fe3bae 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(); @@ -101,7 +101,7 @@ Rect2 MeshInstance2D::_edit_get_rect() const { bool MeshInstance2D::_edit_use_rect() const { return mesh.is_valid(); } -#endif +#endif // DEBUG_ENABLED MeshInstance2D::MeshInstance2D() { } diff --git a/scene/2d/mesh_instance_2d.h b/scene/2d/mesh_instance_2d.h index c914f13ade6a..b23b2ca90724 100644 --- a/scene/2d/mesh_instance_2d.h +++ b/scene/2d/mesh_instance_2d.h @@ -45,10 +45,10 @@ 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 +#endif // DEBUG_ENABLED void set_mesh(const Ref &p_mesh); Ref get_mesh() const; diff --git a/scene/2d/multimesh_instance_2d.cpp b/scene/2d/multimesh_instance_2d.cpp index 417e628517a2..811dccab4aac 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(); @@ -93,7 +93,7 @@ Rect2 MultiMeshInstance2D::_edit_get_rect() const { return Node2D::_edit_get_rect(); } -#endif +#endif // DEBUG_ENABLED MultiMeshInstance2D::MultiMeshInstance2D() { } diff --git a/scene/2d/multimesh_instance_2d.h b/scene/2d/multimesh_instance_2d.h index 064741229470..fec27a601a0e 100644 --- a/scene/2d/multimesh_instance_2d.h +++ b/scene/2d/multimesh_instance_2d.h @@ -46,9 +46,9 @@ class MultiMeshInstance2D : public Node2D { static void _bind_methods(); public: -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED virtual Rect2 _edit_get_rect() const override; -#endif +#endif // DEBUG_ENABLED void set_multimesh(const Ref &p_multimesh); Ref get_multimesh() const; 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..232efdd0e550 100644 --- a/scene/2d/navigation_link_2d.h +++ b/scene/2d/navigation_link_2d.h @@ -62,10 +62,10 @@ 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 +#endif // DEBUG_ENABLED RID get_rid() const; void set_enabled(bool p_enabled); diff --git a/scene/2d/navigation_region_2d.cpp b/scene/2d/navigation_region_2d.cpp index f65a3c0eccab..08fbf78c3385 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(); } @@ -150,7 +150,7 @@ Rect2 NavigationRegion2D::_edit_get_rect() const { bool NavigationRegion2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const { return navigation_polygon.is_valid() ? navigation_polygon->_edit_is_selected_on_click(p_point, p_tolerance) : false; } -#endif +#endif // DEBUG_ENABLED void NavigationRegion2D::_notification(int p_what) { switch (p_what) { diff --git a/scene/2d/navigation_region_2d.h b/scene/2d/navigation_region_2d.h index 52101cb93e0a..f2bed0c44f66 100644 --- a/scene/2d/navigation_region_2d.h +++ b/scene/2d/navigation_region_2d.h @@ -75,10 +75,10 @@ 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 +#endif // DEBUG_ENABLED RID get_rid() const; void set_enabled(bool p_enabled); 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/physics/collision_shape_2d.h b/scene/2d/physics/collision_shape_2d.h index 65436f1539eb..e4f04e77e408 100644 --- a/scene/2d/physics/collision_shape_2d.h +++ b/scene/2d/physics/collision_shape_2d.h @@ -59,11 +59,11 @@ class CollisionShape2D : public Node2D { static void _bind_methods(); public: -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const override; #else virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const; -#endif // TOOLS_ENABLED +#endif // DEBUG_ENABLED void set_shape(const Ref &p_shape); Ref get_shape() const; diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp index 42f7a75c0a7c..dc5a08142d19 100644 --- a/scene/2d/polygon_2d.cpp +++ b/scene/2d/polygon_2d.cpp @@ -57,7 +57,9 @@ Point2 Polygon2D::_edit_get_pivot() const { bool Polygon2D::_edit_use_pivot() const { return true; } +#endif // TOOLS_ENABLED +#ifdef DEBUG_ENABLED Rect2 Polygon2D::_edit_get_rect() const { if (rect_cache_dirty) { int l = polygon.size(); @@ -88,7 +90,7 @@ bool Polygon2D::_edit_is_selected_on_click(const Point2 &p_point, double p_toler } return Geometry2D::is_point_in_polygon(p_point - get_offset(), polygon2d); } -#endif +#endif // DEBUG_ENABLED void Polygon2D::_validate_property(PropertyInfo &p_property) const { if (!invert && p_property.name == "invert_border") { diff --git a/scene/2d/polygon_2d.h b/scene/2d/polygon_2d.h index b2cd06de53f4..0928fa150c6e 100644 --- a/scene/2d/polygon_2d.h +++ b/scene/2d/polygon_2d.h @@ -87,11 +87,14 @@ class Polygon2D : public Node2D { virtual void _edit_set_pivot(const Point2 &p_pivot) override; virtual Point2 _edit_get_pivot() const override; virtual bool _edit_use_pivot() const override; +#endif // 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; -#endif +#endif // DEBUG_ENABLED void set_polygon(const Vector &p_polygon); Vector get_polygon() const; diff --git a/scene/2d/sprite_2d.cpp b/scene/2d/sprite_2d.cpp index 2b5c40f212f5..a182f63171bf 100644 --- a/scene/2d/sprite_2d.cpp +++ b/scene/2d/sprite_2d.cpp @@ -56,7 +56,9 @@ Point2 Sprite2D::_edit_get_pivot() const { bool Sprite2D::_edit_use_pivot() const { return true; } +#endif // TOOLS_ENABLED +#ifdef DEBUG_ENABLED bool Sprite2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const { return is_pixel_opaque(p_point); } @@ -68,7 +70,7 @@ Rect2 Sprite2D::_edit_get_rect() const { bool Sprite2D::_edit_use_rect() const { return texture.is_valid(); } -#endif +#endif // DEBUG_ENABLED Rect2 Sprite2D::get_anchorable_rect() const { return get_rect(); diff --git a/scene/2d/sprite_2d.h b/scene/2d/sprite_2d.h index d084e9575df6..5198e5efcffd 100644 --- a/scene/2d/sprite_2d.h +++ b/scene/2d/sprite_2d.h @@ -74,11 +74,14 @@ class Sprite2D : public Node2D { virtual void _edit_set_pivot(const Point2 &p_pivot) override; virtual Point2 _edit_get_pivot() const override; virtual bool _edit_use_pivot() const override; +#endif // TOOLS_ENABLED + +#ifdef DEBUG_ENABLED virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const override; virtual Rect2 _edit_get_rect() const override; virtual bool _edit_use_rect() const override; -#endif +#endif // DEBUG_ENABLED bool is_pixel_opaque(const Point2 &p_point) const; diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 45cfb8cf33f8..ddb0635f6b26 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -89,8 +89,8 @@ void TileMap::_set_tile_map_data_using_compatibility_format(int p_layer, TileMap SWAP(local[8], local[11]); SWAP(local[9], local[10]); } -#endif - // Extracts position in TileMap. +#endif // BIG_ENDIAN_ENABLED + // Extracts position in TileMap. int16_t x = decode_uint16(&local[0]); int16_t y = decode_uint16(&local[2]); @@ -172,7 +172,7 @@ void TileMap::_notification(int p_what) { bool in_editor = false; #ifdef TOOLS_ENABLED in_editor = Engine::get_singleton()->is_editor_hint(); -#endif +#endif // TOOLS_ENABLED if (is_inside_tree() && collision_animatable && !in_editor) { // Update transform on the physics tick when in animatable mode. last_valid_transform = new_transform; @@ -188,7 +188,7 @@ void TileMap::_notification(int p_what) { bool in_editor = false; #ifdef TOOLS_ENABLED in_editor = Engine::get_singleton()->is_editor_hint(); -#endif +#endif // TOOLS_ENABLED if (is_inside_tree() && collision_animatable && !in_editor) { // Store last valid transform. @@ -209,7 +209,7 @@ void TileMap::force_update(int p_layer) { notify_runtime_tile_data_update(p_layer); update_internals(); } -#endif +#endif // DISABLE_DEPRECATED void TileMap::set_rendering_quadrant_size(int p_size) { ERR_FAIL_COND_MSG(p_size < 1, "TileMapQuadrant size cannot be smaller than 1."); @@ -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()) { @@ -667,7 +667,7 @@ Rect2 TileMap::_edit_get_rect() const { const_cast(this)->item_rect_changed(any_changed); return rect; } -#endif +#endif // DEBUG_ENABLED bool TileMap::_set(const StringName &p_name, const Variant &p_value) { int index; @@ -726,7 +726,7 @@ bool TileMap::_get(const StringName &p_name, Variant &r_ret) const { r_ret = get_rendering_quadrant_size(); return true; } -#endif +#endif // DISABLE_DEPRECATED else { return property_helper.property_get_value(sname, r_ret); } diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h index 142dc1193f8a..47f5c8d99619 100644 --- a/scene/2d/tile_map.h +++ b/scene/2d/tile_map.h @@ -107,16 +107,16 @@ class TileMap : public Node2D { VisibilityMode _get_navigation_visibility_mode_bind_compat_87115(); static void _bind_compatibility_methods(); -#endif +#endif // DISABLE_DEPRECATED public: -#ifdef TOOLS_ENABLED +#ifdef DEBUG_ENABLED virtual Rect2 _edit_get_rect() const override; -#endif +#endif // DEBUG_ENABLED #ifndef DISABLE_DEPRECATED void force_update(int p_layer); -#endif +#endif // DISABLE_DEPRECATED void set_rendering_quadrant_size(int p_size); int get_rendering_quadrant_size() const; diff --git a/scene/2d/touch_screen_button.cpp b/scene/2d/touch_screen_button.cpp index cbfd7e38dc29..b968f39ccbb3 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(); @@ -342,7 +342,7 @@ Rect2 TouchScreenButton::_edit_get_rect() const { bool TouchScreenButton::_edit_use_rect() const { return !texture_normal.is_null(); } -#endif +#endif // DEBUG_ENABLED Rect2 TouchScreenButton::get_anchorable_rect() const { if (texture_normal.is_null()) { diff --git a/scene/2d/touch_screen_button.h b/scene/2d/touch_screen_button.h index 4467604e2b2a..da75fabfa024 100644 --- a/scene/2d/touch_screen_button.h +++ b/scene/2d/touch_screen_button.h @@ -76,10 +76,10 @@ 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 +#endif // DEBUG_ENABLED void set_texture_normal(const Ref &p_texture); Ref get_texture_normal() const; diff --git a/scene/2d/visible_on_screen_notifier_2d.cpp b/scene/2d/visible_on_screen_notifier_2d.cpp index c64507fe32f6..7bf6371ee9a3 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; } @@ -38,7 +38,7 @@ Rect2 VisibleOnScreenNotifier2D::_edit_get_rect() const { bool VisibleOnScreenNotifier2D::_edit_use_rect() const { return true; } -#endif +#endif // DEBUG_ENABLED void VisibleOnScreenNotifier2D::_visibility_enter() { if (!is_inside_tree() || Engine::get_singleton()->is_editor_hint()) { diff --git a/scene/2d/visible_on_screen_notifier_2d.h b/scene/2d/visible_on_screen_notifier_2d.h index df2832a9768b..84545a2d6ad3 100644 --- a/scene/2d/visible_on_screen_notifier_2d.h +++ b/scene/2d/visible_on_screen_notifier_2d.h @@ -54,10 +54,10 @@ 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 +#endif // DEBUG_ENABLED void set_rect(const Rect2 &p_rect); Rect2 get_rect() const; diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 4b3007543bc2..4a3f7f241467 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -44,7 +44,7 @@ #ifdef TOOLS_ENABLED #include "editor/plugins/control_editor_plugin.h" -#endif +#endif // TOOLS_ENABLED // Editor plugin interoperability. @@ -140,14 +140,6 @@ void Control::_edit_set_rect(const Rect2 &p_edit_rect) { set_size(p_edit_rect.size.snappedf(1), ControlEditorToolbar::get_singleton()->is_anchors_mode_enabled()); } -Rect2 Control::_edit_get_rect() const { - return Rect2(Point2(), get_size()); -} - -bool Control::_edit_use_rect() const { - return true; -} - void Control::_edit_set_rotation(real_t p_rotation) { set_rotation(p_rotation); } @@ -178,7 +170,17 @@ bool Control::_edit_use_pivot() const { Size2 Control::_edit_get_minimum_size() const { return get_combined_minimum_size(); } -#endif +#endif // TOOLS_ENABLED + +#ifdef DEBUG_ENABLED +Rect2 Control::_edit_get_rect() const { + return Rect2(Point2(), get_size()); +} + +bool Control::_edit_use_rect() const { + return true; +} +#endif // DEBUG_ENABLED void Control::reparent(Node *p_parent, bool p_keep_global_transform) { ERR_MAIN_THREAD_GUARD; @@ -239,7 +241,7 @@ void Control::get_argument_options(const StringName &p_function, int p_idx, List } CanvasItem::get_argument_options(p_function, p_idx, r_options); } -#endif +#endif // TOOLS_ENABLED PackedStringArray Control::get_configuration_warnings() const { ERR_READ_THREAD_GUARD_V(PackedStringArray()); @@ -663,7 +665,7 @@ Rect2 Control::get_parent_anchorable_rect() const { #else parent_rect = get_viewport()->get_visible_rect(); -#endif +#endif // TOOLS_ENABLED } return parent_rect; @@ -1396,7 +1398,7 @@ void Control::set_position(const Point2 &p_point, bool p_keep_offsets) { data.pos_cache = p_point; return; } -#endif +#endif // TOOLS_ENABLED if (p_keep_offsets) { _compute_anchors(Rect2(p_point, data.size_cache), data.offset, data.anchor); @@ -1440,7 +1442,7 @@ void Control::_set_size(const Size2 &p_size) { if (data.size_warning && (data.anchor[SIDE_LEFT] != data.anchor[SIDE_RIGHT] || data.anchor[SIDE_TOP] != data.anchor[SIDE_BOTTOM])) { WARN_PRINT("Nodes with non-equal opposite anchors will have their size overridden after _ready(). \nIf you want to set size, change the anchors or consider using set_deferred()."); } -#endif +#endif // DEBUG_ENABLED set_size(p_size); } @@ -1462,7 +1464,7 @@ void Control::set_size(const Size2 &p_size, bool p_keep_offsets) { data.size_cache = new_size; return; } -#endif +#endif // TOOLS_ENABLED if (p_keep_offsets) { _compute_anchors(Rect2(data.pos_cache, new_size), data.offset, data.anchor); @@ -2745,7 +2747,7 @@ Variant Control::get_theme_item(Theme::DataType p_data_type, const StringName &p Ref Control::get_editor_theme_icon(const StringName &p_name) const { return get_theme_icon(p_name, SNAME("EditorIcons")); } -#endif +#endif // TOOLS_ENABLED bool Control::has_theme_icon(const StringName &p_name, const StringName &p_theme_type) const { ERR_READ_THREAD_GUARD_V(false); @@ -3087,7 +3089,7 @@ bool Control::is_layout_rtl() const { const_cast(this)->data.is_rtl = true; return data.is_rtl; } -#endif +#endif // TOOLS_ENABLED Node *parent_node = get_parent(); while (parent_node) { Control *parent_control = Object::cast_to(parent_node); @@ -3162,7 +3164,7 @@ bool Control::is_auto_translating() const { ERR_READ_THREAD_GUARD_V(false); return can_auto_translate(); } -#endif +#endif // DISABLE_DEPRECATED void Control::set_tooltip_auto_translate_mode(AutoTranslateMode p_mode) { ERR_MAIN_THREAD_GUARD; @@ -3215,7 +3217,7 @@ void Control::_notification(int p_notification) { case NOTIFICATION_EDITOR_POST_SAVE: { saving = false; } break; -#endif +#endif // TOOLS_ENABLED case NOTIFICATION_POSTINITIALIZE: { data.initialized = true; @@ -3261,7 +3263,7 @@ void Control::_notification(int p_notification) { case NOTIFICATION_READY: { #ifdef DEBUG_ENABLED connect(SceneStringName(ready), callable_mp(this, &Control::_clear_size_warning), CONNECT_DEFERRED | CONNECT_ONE_SHOT); -#endif +#endif // DEBUG_ENABLED } break; case NOTIFICATION_ENTER_CANVAS: { @@ -3573,7 +3575,7 @@ void Control::_bind_methods() { #ifndef DISABLE_DEPRECATED ClassDB::bind_method(D_METHOD("set_auto_translate", "enable"), &Control::set_auto_translate); ClassDB::bind_method(D_METHOD("is_auto_translating"), &Control::is_auto_translating); -#endif +#endif // DISABLE_DEPRECATED ClassDB::bind_method(D_METHOD("set_localize_numeral_system", "enable"), &Control::set_localize_numeral_system); ClassDB::bind_method(D_METHOD("is_localizing_numeral_system"), &Control::is_localizing_numeral_system); @@ -3628,7 +3630,7 @@ void Control::_bind_methods() { #ifndef DISABLE_DEPRECATED ADD_PROPERTY(PropertyInfo(Variant::BOOL, "auto_translate", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "set_auto_translate", "is_auto_translating"); -#endif +#endif // DISABLE_DEPRECATED ADD_GROUP("Tooltip", "tooltip_"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "tooltip_text", PROPERTY_HINT_MULTILINE_TEXT), "set_tooltip_text", "get_tooltip_text"); diff --git a/scene/gui/control.h b/scene/gui/control.h index 6cabf10971ad..ac386659ec4c 100644 --- a/scene/gui/control.h +++ b/scene/gui/control.h @@ -48,7 +48,7 @@ class Control : public CanvasItem { #ifdef TOOLS_ENABLED bool saving = false; -#endif +#endif //TOOLS_ENABLED public: enum Anchor { @@ -396,8 +396,6 @@ class Control : public CanvasItem { virtual Size2 _edit_get_scale() const override; virtual void _edit_set_rect(const Rect2 &p_edit_rect) override; - virtual Rect2 _edit_get_rect() const override; - virtual bool _edit_use_rect() const override; virtual void _edit_set_rotation(real_t p_rotation) override; virtual real_t _edit_get_rotation() const override; @@ -408,7 +406,13 @@ class Control : public CanvasItem { virtual bool _edit_use_pivot() const override; virtual Size2 _edit_get_minimum_size() const override; -#endif +#endif //TOOLS_ENABLED + +#ifdef DEBUG_ENABLED + virtual Rect2 _edit_get_rect() const override; + virtual bool _edit_use_rect() const override; +#endif // DEBUG_ENABLED + virtual void reparent(Node *p_parent, bool p_keep_global_transform = true) override; // Editor integration. @@ -418,7 +422,7 @@ class Control : public CanvasItem { PackedStringArray get_configuration_warnings() const override; #ifdef TOOLS_ENABLED virtual void get_argument_options(const StringName &p_function, int p_idx, List *r_options) const override; -#endif +#endif //TOOLS_ENABLED virtual bool is_text_field() const; @@ -605,7 +609,7 @@ class Control : public CanvasItem { Variant get_theme_item(Theme::DataType p_data_type, const StringName &p_name, const StringName &p_theme_type = StringName()) const; #ifdef TOOLS_ENABLED Ref get_editor_theme_icon(const StringName &p_name) const; -#endif +#endif //TOOLS_ENABLED bool has_theme_icon_override(const StringName &p_name) const; bool has_theme_stylebox_override(const StringName &p_name) const; @@ -637,7 +641,7 @@ class Control : public CanvasItem { #ifndef DISABLE_DEPRECATED void set_auto_translate(bool p_enable); bool is_auto_translating() const; -#endif +#endif //DISABLE_DEPRECATED void set_tooltip_auto_translate_mode(AutoTranslateMode p_mode); AutoTranslateMode get_tooltip_auto_translate_mode() const; diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp index 7c8bf9c80945..f87dad1889b2 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); @@ -52,11 +52,13 @@ bool CanvasItem::_edit_is_selected_on_click(const Point2 &p_point, double p_tole return p_point.length() < p_tolerance; } } +#endif // DEBUG_ENABLED +#ifdef TOOLS_ENABLED Transform2D CanvasItem::_edit_get_transform() const { return Transform2D(_edit_get_rotation(), _edit_get_position() + _edit_get_pivot()); } -#endif +#endif //TOOLS_ENABLED bool CanvasItem::is_visible_in_tree() const { ERR_READ_THREAD_GUARD_V(false); @@ -1158,7 +1160,7 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(D_METHOD("_edit_get_pivot"), &CanvasItem::_edit_get_pivot); ClassDB::bind_method(D_METHOD("_edit_use_pivot"), &CanvasItem::_edit_use_pivot); ClassDB::bind_method(D_METHOD("_edit_get_transform"), &CanvasItem::_edit_get_transform); -#endif +#endif //TOOLS_ENABLED ClassDB::bind_method(D_METHOD("get_canvas_item"), &CanvasItem::get_canvas_item); diff --git a/scene/main/canvas_item.h b/scene/main/canvas_item.h index 5c4477234bbe..c74f8238e3c4 100644 --- a/scene/main/canvas_item.h +++ b/scene/main/canvas_item.h @@ -174,7 +174,7 @@ class CanvasItem : public Node { void _draw_multiline_bind_compat_84523(const Vector &p_points, const Color &p_color, real_t p_width); void _draw_multiline_colors_bind_compat_84523(const Vector &p_points, const Vector &p_colors, real_t p_width); static void _bind_compatibility_methods(); -#endif +#endif // DISABLE_DEPRECATED void _validate_property(PropertyInfo &p_property) const; @@ -193,11 +193,9 @@ class CanvasItem : public Node { NOTIFICATION_WORLD_2D_CHANGED = 36, }; - /* EDITOR */ -#ifdef TOOLS_ENABLED - // Select the node - virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const; + /* EDITOR AND DEBUGGING */ +#ifdef TOOLS_ENABLED // Save and restore a CanvasItem state virtual void _edit_set_state(const Dictionary &p_state) {} virtual Dictionary _edit_get_state() const { return Dictionary(); } @@ -216,9 +214,7 @@ class CanvasItem : public Node { virtual real_t _edit_get_rotation() const { return 0.0; } // Used to resize/move the node - virtual bool _edit_use_rect() const { return false; } // MAYBE REPLACE BY A _edit_get_editmode() virtual void _edit_set_rect(const Rect2 &p_rect) {} - virtual Rect2 _edit_get_rect() const { return Rect2(0, 0, 0, 0); } virtual Size2 _edit_get_minimum_size() const { return Size2(-1, -1); } // LOOKS WEIRD // Used to set a pivot @@ -227,7 +223,18 @@ class CanvasItem : public Node { virtual Point2 _edit_get_pivot() const { return Point2(); } virtual Transform2D _edit_get_transform() const; -#endif +#endif // TOOLS_ENABLED + +#ifdef DEBUG_ENABLED + // Those need to be available in debug runtime, to allow for node selection. + + // Select the node. + virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const; + + // Used to resize/move the node. + virtual bool _edit_use_rect() const { return false; } // Maybe replace with _edit_get_editmode(). + virtual Rect2 _edit_get_rect() const { return Rect2(0, 0, 0, 0); } +#endif // DEBUG_ENABLED void update_draw_order(); diff --git a/scene/resources/2d/navigation_polygon.cpp b/scene/resources/2d/navigation_polygon.cpp index 3dfa906e3b4f..37240e803843 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) { @@ -79,7 +79,7 @@ bool NavigationPolygon::_edit_is_selected_on_click(const Point2 &p_point, double } return false; } -#endif +#endif // DEBUG_ENABLED void NavigationPolygon::set_vertices(const Vector &p_vertices) { RWLockWrite write_lock(rwlock); diff --git a/scene/resources/2d/navigation_polygon.h b/scene/resources/2d/navigation_polygon.h index ed2c606c556d..59e5eeed6847 100644 --- a/scene/resources/2d/navigation_polygon.h +++ b/scene/resources/2d/navigation_polygon.h @@ -68,10 +68,11 @@ 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 +#endif // DEBUG_ENABLED + enum SamplePartitionType { SAMPLE_PARTITION_CONVEX_PARTITION = 0, SAMPLE_PARTITION_TRIANGULATE,