Skip to content

Commit 58e79bf

Browse files
committed
Compile certain CanvasItem._edit_*() functions with DEBUG_ENABLED
1 parent c6c464c commit 58e79bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+155
-121
lines changed

scene/2d/animated_sprite_2d.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ Point2 AnimatedSprite2D::_edit_get_pivot() const {
5656
bool AnimatedSprite2D::_edit_use_pivot() const {
5757
return true;
5858
}
59+
#endif // TOOLS_ENABLED
5960

61+
#ifdef DEBUG_ENABLED
6062
Rect2 AnimatedSprite2D::_edit_get_rect() const {
6163
return _get_rect();
6264
}
@@ -75,7 +77,7 @@ bool AnimatedSprite2D::_edit_use_rect() const {
7577
}
7678
return t.is_valid();
7779
}
78-
#endif
80+
#endif // DEBUG_ENABLED
7981

8082
Rect2 AnimatedSprite2D::get_anchorable_rect() const {
8183
return _get_rect();
@@ -593,7 +595,7 @@ void AnimatedSprite2D::get_argument_options(const StringName &p_function, int p_
593595
}
594596
Node2D::get_argument_options(p_function, p_idx, r_options);
595597
}
596-
#endif
598+
#endif // TOOLS_ENABLED
597599

598600
#ifndef DISABLE_DEPRECATED
599601
bool AnimatedSprite2D::_set(const StringName &p_name, const Variant &p_value) {

scene/2d/animated_sprite_2d.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class AnimatedSprite2D : public Node2D {
6666
protected:
6767
#ifndef DISABLE_DEPRECATED
6868
bool _set(const StringName &p_name, const Variant &p_value);
69-
#endif
69+
#endif // DISABLE_DEPRECATED
7070
static void _bind_methods();
7171
void _notification(int p_what);
7272
void _validate_property(PropertyInfo &p_property) const;
@@ -79,9 +79,12 @@ class AnimatedSprite2D : public Node2D {
7979
virtual void _edit_set_pivot(const Point2 &p_pivot) override;
8080
virtual Point2 _edit_get_pivot() const override;
8181
virtual bool _edit_use_pivot() const override;
82+
#endif // TOOLS_ENABLED
83+
84+
#ifdef DEBUG_ENABLED
8285
virtual Rect2 _edit_get_rect() const override;
8386
virtual bool _edit_use_rect() const override;
84-
#endif
87+
#endif // DEBUG_ENABLED
8588

8689
virtual Rect2 get_anchorable_rect() const override;
8790

@@ -129,7 +132,7 @@ class AnimatedSprite2D : public Node2D {
129132

130133
#ifdef TOOLS_ENABLED
131134
virtual void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const override;
132-
#endif
135+
#endif // TOOLS_ENABLED
133136

134137
AnimatedSprite2D();
135138
};

scene/2d/back_buffer_copy.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ void BackBufferCopy::_update_copy_mode() {
4545
}
4646
}
4747

48-
#ifdef TOOLS_ENABLED
48+
#ifdef DEBUG_ENABLED
4949
Rect2 BackBufferCopy::_edit_get_rect() const {
5050
return rect;
5151
}
5252

5353
bool BackBufferCopy::_edit_use_rect() const {
5454
return true;
5555
}
56-
#endif
56+
#endif // DEBUG_ENABLED
5757

5858
Rect2 BackBufferCopy::get_anchorable_rect() const {
5959
return rect;

scene/2d/back_buffer_copy.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ class BackBufferCopy : public Node2D {
5454
void _validate_property(PropertyInfo &p_property) const;
5555

5656
public:
57-
#ifdef TOOLS_ENABLED
57+
#ifdef DEBUG_ENABLED
5858
Rect2 _edit_get_rect() const override;
5959
virtual bool _edit_use_rect() const override;
60-
#endif
60+
#endif // DEBUG_ENABLED
6161

6262
void set_rect(const Rect2 &p_rect);
6363
Rect2 get_rect() const;

scene/2d/light_2d.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void Light2D::_update_light_visibility() {
5454
if (editor_only) {
5555
editor_ok = false;
5656
}
57-
#endif
57+
#endif // TOOLS_ENABLED
5858

5959
RS::get_singleton()->canvas_light_set_enabled(canvas_light, enabled && is_visible_in_tree() && editor_ok);
6060
}
@@ -343,7 +343,6 @@ Light2D::~Light2D() {
343343
//////////////////////////////
344344

345345
#ifdef TOOLS_ENABLED
346-
347346
Dictionary PointLight2D::_edit_get_state() const {
348347
Dictionary state = Node2D::_edit_get_state();
349348
state["offset"] = get_texture_offset();
@@ -367,7 +366,9 @@ Point2 PointLight2D::_edit_get_pivot() const {
367366
bool PointLight2D::_edit_use_pivot() const {
368367
return true;
369368
}
369+
#endif // TOOLS_ENABLED
370370

371+
#ifdef DEBUG_ENABLED
371372
Rect2 PointLight2D::_edit_get_rect() const {
372373
if (texture.is_null()) {
373374
return Rect2();
@@ -380,7 +381,7 @@ Rect2 PointLight2D::_edit_get_rect() const {
380381
bool PointLight2D::_edit_use_rect() const {
381382
return !texture.is_null();
382383
}
383-
#endif
384+
#endif // DEBUG_ENABLED
384385

385386
Rect2 PointLight2D::get_anchorable_rect() const {
386387
if (texture.is_null()) {

scene/2d/light_2d.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,12 @@ class PointLight2D : public Light2D {
160160
virtual void _edit_set_pivot(const Point2 &p_pivot) override;
161161
virtual Point2 _edit_get_pivot() const override;
162162
virtual bool _edit_use_pivot() const override;
163+
#endif // TOOLS_ENABLED
164+
165+
#ifdef DEBUG_ENABLED
163166
virtual Rect2 _edit_get_rect() const override;
164167
virtual bool _edit_use_rect() const override;
165-
#endif
168+
#endif // DEBUG_ENABLED
166169

167170
virtual Rect2 get_anchorable_rect() const override;
168171

scene/2d/light_occluder_2d.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
#define LINE_GRAB_WIDTH 8
3737

38-
#ifdef TOOLS_ENABLED
38+
#ifdef DEBUG_ENABLED
3939
Rect2 OccluderPolygon2D::_edit_get_rect() const {
4040
if (rect_cache_dirty) {
4141
if (closed) {
@@ -83,7 +83,7 @@ bool OccluderPolygon2D::_edit_is_selected_on_click(const Point2 &p_point, double
8383
return false;
8484
}
8585
}
86-
#endif
86+
#endif // DEBUG_ENABLED
8787

8888
void OccluderPolygon2D::set_polygon(const Vector<Vector2> &p_polygon) {
8989
polygon = p_polygon;
@@ -156,7 +156,7 @@ OccluderPolygon2D::~OccluderPolygon2D() {
156156
void LightOccluder2D::_poly_changed() {
157157
#ifdef DEBUG_ENABLED
158158
queue_redraw();
159-
#endif
159+
#endif // DEBUG_ENABLED
160160
}
161161

162162
void LightOccluder2D::_physics_interpolated_changed() {
@@ -218,22 +218,22 @@ void LightOccluder2D::_notification(int p_what) {
218218
}
219219
}
220220

221-
#ifdef TOOLS_ENABLED
221+
#ifdef DEBUG_ENABLED
222222
Rect2 LightOccluder2D::_edit_get_rect() const {
223223
return occluder_polygon.is_valid() ? occluder_polygon->_edit_get_rect() : Rect2();
224224
}
225225

226226
bool LightOccluder2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const {
227227
return occluder_polygon.is_valid() ? occluder_polygon->_edit_is_selected_on_click(p_point, p_tolerance) : false;
228228
}
229-
#endif
229+
#endif // DEBUG_ENABLED
230230

231231
void LightOccluder2D::set_occluder_polygon(const Ref<OccluderPolygon2D> &p_polygon) {
232232
#ifdef DEBUG_ENABLED
233233
if (occluder_polygon.is_valid()) {
234234
occluder_polygon->disconnect_changed(callable_mp(this, &LightOccluder2D::_poly_changed));
235235
}
236-
#endif
236+
#endif // DEBUG_ENABLED
237237
occluder_polygon = p_polygon;
238238

239239
if (occluder_polygon.is_valid()) {
@@ -247,7 +247,7 @@ void LightOccluder2D::set_occluder_polygon(const Ref<OccluderPolygon2D> &p_polyg
247247
occluder_polygon->connect_changed(callable_mp(this, &LightOccluder2D::_poly_changed));
248248
}
249249
queue_redraw();
250-
#endif
250+
#endif // DEBUG_ENABLED
251251
}
252252

253253
Ref<OccluderPolygon2D> LightOccluder2D::get_occluder_polygon() const {

scene/2d/light_occluder_2d.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,10 @@ class OccluderPolygon2D : public Resource {
5656
static void _bind_methods();
5757

5858
public:
59-
#ifdef TOOLS_ENABLED
59+
#ifdef DEBUG_ENABLED
6060
virtual Rect2 _edit_get_rect() const;
6161
virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const;
62-
#endif
63-
62+
#endif // DEBUG_ENABLED
6463
void set_polygon(const Vector<Vector2> &p_polygon);
6564
Vector<Vector2> get_polygon() const;
6665

@@ -93,10 +92,10 @@ class LightOccluder2D : public Node2D {
9392
static void _bind_methods();
9493

9594
public:
96-
#ifdef TOOLS_ENABLED
95+
#ifdef DEBUG_ENABLED
9796
virtual Rect2 _edit_get_rect() const override;
9897
virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const override;
99-
#endif
98+
#endif // DEBUG_ENABLED
10099

101100
void set_occluder_polygon(const Ref<OccluderPolygon2D> &p_polygon);
102101
Ref<OccluderPolygon2D> get_occluder_polygon() const;

scene/2d/line_2d.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
Line2D::Line2D() {
3737
}
3838

39-
#ifdef TOOLS_ENABLED
39+
#ifdef DEBUG_ENABLED
4040
Rect2 Line2D::_edit_get_rect() const {
4141
if (_points.size() == 0) {
4242
return Rect2(0, 0, 0, 0);

scene/2d/line_2d.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class Line2D : public Node2D {
5555
LINE_TEXTURE_STRETCH
5656
};
5757

58-
#ifdef TOOLS_ENABLED
58+
#ifdef DEBUG_ENABLED
5959
virtual Rect2 _edit_get_rect() const override;
6060
virtual bool _edit_use_rect() const override;
6161
virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const override;

0 commit comments

Comments
 (0)