mirror of
https://github.com/godotengine/godot.git
synced 2024-11-24 21:22:48 +00:00
Merge pull request #88701 from smix8/bake_rect_debug
Add debug visual for NavigationRegion2D bake rect
This commit is contained in:
commit
87d40ba743
@ -177,6 +177,7 @@ void NavigationRegion2D::_notification(int p_what) {
|
||||
if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || NavigationServer2D::get_singleton()->get_debug_enabled()) && navigation_polygon.is_valid()) {
|
||||
_update_debug_mesh();
|
||||
_update_debug_edge_connections_mesh();
|
||||
_update_debug_baking_rect();
|
||||
}
|
||||
#endif // DEBUG_ENABLED
|
||||
} break;
|
||||
@ -659,3 +660,15 @@ void NavigationRegion2D::_update_debug_edge_connections_mesh() {
|
||||
}
|
||||
}
|
||||
#endif // DEBUG_ENABLED
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
void NavigationRegion2D::_update_debug_baking_rect() {
|
||||
Rect2 baking_rect = get_navigation_polygon()->get_baking_rect();
|
||||
if (baking_rect.has_area()) {
|
||||
Vector2 baking_rect_offset = get_navigation_polygon()->get_baking_rect_offset();
|
||||
Rect2 debug_baking_rect = Rect2(baking_rect.position.x + baking_rect_offset.x, baking_rect.position.y + baking_rect_offset.y, baking_rect.size.x, baking_rect.size.y);
|
||||
Color debug_baking_rect_color = Color(0.8, 0.5, 0.7, 0.1);
|
||||
draw_rect(debug_baking_rect, debug_baking_rect_color);
|
||||
}
|
||||
}
|
||||
#endif // DEBUG_ENABLED
|
||||
|
@ -58,6 +58,7 @@ class NavigationRegion2D : public Node2D {
|
||||
private:
|
||||
void _update_debug_mesh();
|
||||
void _update_debug_edge_connections_mesh();
|
||||
void _update_debug_baking_rect();
|
||||
void _navigation_map_changed(RID p_map);
|
||||
void _navigation_debug_changed();
|
||||
#endif // DEBUG_ENABLED
|
||||
|
Loading…
Reference in New Issue
Block a user