summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
authorsmix8 <52464204+smix8@users.noreply.github.com>2023-03-12 02:36:16 +0100
committerYuri Sizov <yuris@humnom.net>2023-03-16 16:45:07 +0100
commitbea2da94da07b5cda93b59e2293ac0edde7e6aa5 (patch)
tree074d8ad86c8157db6ae311111bbe677b364c847d /scene/2d
parentc6a704af2cc6b0bef66c61c83247aa65e6a664ef (diff)
Allow negative NavigationAgent2D path debug line_width for thin lines
Allows the line_width for NavigationAgent2D path debug to go negativ for thin line rendering. (cherry picked from commit f6a10c0565e32e0170bcce71635d8bad16077d1d)
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/navigation_agent_2d.cpp10
-rw-r--r--scene/2d/navigation_agent_2d.h2
2 files changed, 8 insertions, 4 deletions
diff --git a/scene/2d/navigation_agent_2d.cpp b/scene/2d/navigation_agent_2d.cpp
index bfe2f6252e..157318125b 100644
--- a/scene/2d/navigation_agent_2d.cpp
+++ b/scene/2d/navigation_agent_2d.cpp
@@ -124,8 +124,8 @@ void NavigationAgent2D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "debug_enabled"), "set_debug_enabled", "get_debug_enabled");
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");
- ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "debug_path_custom_line_width", PROPERTY_HINT_RANGE, "1,50,1,suffix:px"), "set_debug_path_custom_line_width", "get_debug_path_custom_line_width");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "debug_path_custom_point_size", PROPERTY_HINT_RANGE, "0,50,0.01,or_greater,suffix:px"), "set_debug_path_custom_point_size", "get_debug_path_custom_point_size");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "debug_path_custom_line_width", PROPERTY_HINT_RANGE, "-1,50,0.01,or_greater,suffix:px"), "set_debug_path_custom_line_width", "get_debug_path_custom_line_width");
ADD_SIGNAL(MethodInfo("path_changed"));
ADD_SIGNAL(MethodInfo("target_reached"));
@@ -734,7 +734,7 @@ void NavigationAgent2D::set_debug_path_custom_point_size(float p_point_size) {
return;
}
- debug_path_custom_point_size = MAX(0.1, p_point_size);
+ debug_path_custom_point_size = MAX(0.0, p_point_size);
debug_path_dirty = true;
#endif // DEBUG_ENABLED
}
@@ -803,6 +803,10 @@ void NavigationAgent2D::_update_debug_path() {
RenderingServer::get_singleton()->canvas_item_add_polyline(debug_path_instance, navigation_path, debug_path_colors, debug_path_custom_line_width, false);
+ if (debug_path_custom_point_size <= 0.0) {
+ return;
+ }
+
float point_size = NavigationServer2D::get_singleton()->get_debug_navigation_agent_path_point_size();
float half_point_size = point_size * 0.5;
diff --git a/scene/2d/navigation_agent_2d.h b/scene/2d/navigation_agent_2d.h
index 1614c70229..97c5d94483 100644
--- a/scene/2d/navigation_agent_2d.h
+++ b/scene/2d/navigation_agent_2d.h
@@ -76,7 +76,7 @@ class NavigationAgent2D : public Node {
// Debug properties for exposed bindings
bool debug_enabled = false;
float debug_path_custom_point_size = 4.0;
- float debug_path_custom_line_width = 1.0;
+ float debug_path_custom_line_width = -1.0;
bool debug_use_custom = false;
Color debug_path_custom_color = Color(1.0, 1.0, 1.0, 1.0);
#ifdef DEBUG_ENABLED