summaryrefslogtreecommitdiff
path: root/scene/3d
diff options
context:
space:
mode:
authorsmix8 <52464204+smix8@users.noreply.github.com>2023-02-08 20:37:57 +0100
committersmix8 <52464204+smix8@users.noreply.github.com>2023-02-08 21:49:04 +0100
commit820b841fcbd23d083ef9002aeeb6c55143d88fca (patch)
tree4221da19d3d0d2801bfe3474665f55c91d497ebb /scene/3d
parentccd4caa3de9e89376f339aa76219941d1c83a482 (diff)
Fix NavigationAgent debug functions bindings in release builds
Fixes that certain NavigationAgent debug functions bindings were not available in release builds.
Diffstat (limited to 'scene/3d')
-rw-r--r--scene/3d/navigation_agent_3d.cpp12
-rw-r--r--scene/3d/navigation_agent_3d.h12
2 files changed, 15 insertions, 9 deletions
diff --git a/scene/3d/navigation_agent_3d.cpp b/scene/3d/navigation_agent_3d.cpp
index 524304425c..47c68721d4 100644
--- a/scene/3d/navigation_agent_3d.cpp
+++ b/scene/3d/navigation_agent_3d.cpp
@@ -121,7 +121,6 @@ void NavigationAgent3D::_bind_methods() {
ADD_SIGNAL(MethodInfo("navigation_finished"));
ADD_SIGNAL(MethodInfo("velocity_computed", PropertyInfo(Variant::VECTOR3, "safe_velocity")));
-#ifdef DEBUG_ENABLED
ClassDB::bind_method(D_METHOD("set_debug_enabled", "enabled"), &NavigationAgent3D::set_debug_enabled);
ClassDB::bind_method(D_METHOD("get_debug_enabled"), &NavigationAgent3D::get_debug_enabled);
ClassDB::bind_method(D_METHOD("set_debug_use_custom", "enabled"), &NavigationAgent3D::set_debug_use_custom);
@@ -136,7 +135,6 @@ void NavigationAgent3D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "debug_use_custom"), "set_debug_use_custom", "get_debug_use_custom");
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "debug_path_custom_color"), "set_debug_path_custom_color", "get_debug_path_custom_color");
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "debug_path_custom_point_size", PROPERTY_HINT_RANGE, "1,50,1,suffix:px"), "set_debug_path_custom_point_size", "get_debug_path_custom_point_size");
-#endif // DEBUG_ENABLED
}
void NavigationAgent3D::_notification(int p_what) {
@@ -696,14 +694,15 @@ void NavigationAgent3D::_check_distance_to_target() {
////////DEBUG////////////////////////////////////////////////////////////
-#ifdef DEBUG_ENABLED
void NavigationAgent3D::set_debug_enabled(bool p_enabled) {
+#ifdef DEBUG_ENABLED
if (debug_enabled == p_enabled) {
return;
}
debug_enabled = p_enabled;
debug_path_dirty = true;
+#endif // DEBUG_ENABLED
}
bool NavigationAgent3D::get_debug_enabled() const {
@@ -711,12 +710,14 @@ bool NavigationAgent3D::get_debug_enabled() const {
}
void NavigationAgent3D::set_debug_use_custom(bool p_enabled) {
+#ifdef DEBUG_ENABLED
if (debug_use_custom == p_enabled) {
return;
}
debug_use_custom = p_enabled;
debug_path_dirty = true;
+#endif // DEBUG_ENABLED
}
bool NavigationAgent3D::get_debug_use_custom() const {
@@ -724,12 +725,14 @@ bool NavigationAgent3D::get_debug_use_custom() const {
}
void NavigationAgent3D::set_debug_path_custom_color(Color p_color) {
+#ifdef DEBUG_ENABLED
if (debug_path_custom_color == p_color) {
return;
}
debug_path_custom_color = p_color;
debug_path_dirty = true;
+#endif // DEBUG_ENABLED
}
Color NavigationAgent3D::get_debug_path_custom_color() const {
@@ -737,18 +740,21 @@ Color NavigationAgent3D::get_debug_path_custom_color() const {
}
void NavigationAgent3D::set_debug_path_custom_point_size(float p_point_size) {
+#ifdef DEBUG_ENABLED
if (Math::is_equal_approx(debug_path_custom_point_size, p_point_size)) {
return;
}
debug_path_custom_point_size = p_point_size;
debug_path_dirty = true;
+#endif // DEBUG_ENABLED
}
float NavigationAgent3D::get_debug_path_custom_point_size() const {
return debug_path_custom_point_size;
}
+#ifdef DEBUG_ENABLED
void NavigationAgent3D::_navigation_debug_changed() {
debug_path_dirty = true;
}
diff --git a/scene/3d/navigation_agent_3d.h b/scene/3d/navigation_agent_3d.h
index 209b2a0989..072ca1d3e8 100644
--- a/scene/3d/navigation_agent_3d.h
+++ b/scene/3d/navigation_agent_3d.h
@@ -75,14 +75,16 @@ class NavigationAgent3D : public Node {
// No initialized on purpose
uint32_t update_frame_id = 0;
-#ifdef DEBUG_ENABLED
+ // Debug properties for exposed bindings
bool debug_enabled = false;
- bool debug_path_dirty = true;
- RID debug_path_instance;
- Ref<ArrayMesh> debug_path_mesh;
float debug_path_custom_point_size = 4.0;
bool debug_use_custom = false;
Color debug_path_custom_color = Color(1.0, 1.0, 1.0, 1.0);
+#ifdef DEBUG_ENABLED
+ // Debug properties internal only
+ bool debug_path_dirty = true;
+ RID debug_path_instance;
+ Ref<ArrayMesh> debug_path_mesh;
Ref<StandardMaterial3D> debug_agent_path_line_custom_material;
Ref<StandardMaterial3D> debug_agent_path_point_custom_material;
@@ -196,7 +198,6 @@ public:
PackedStringArray get_configuration_warnings() const override;
-#ifdef DEBUG_ENABLED
void set_debug_enabled(bool p_enabled);
bool get_debug_enabled() const;
@@ -208,7 +209,6 @@ public:
void set_debug_path_custom_point_size(float p_point_size);
float get_debug_path_custom_point_size() const;
-#endif // DEBUG_ENABLED
private:
void update_navigation();