Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-bake edited NavigationPolygons in the Editor on a timer #87504

Merged
merged 1 commit into from
Feb 27, 2024

Conversation

smix8
Copy link
Contributor

@smix8 smix8 commented Jan 23, 2024

Auto-bakes edited NavigationPolygons in the Editor on a timer.

The pre-4.2 NavigationRegion2D did automatically rebake the entire NavigationPolygon everytime it was changed even a little.

This caused severe performance problems while editing more complex polygons.

Baking a navigation mesh is not exactly a quick process. It was very noticeable while developing the 2D navigation mesh baking with the Editor freezing all the time while dragging outline points. That was the reason why with 4.2. this auto-bake was removed from the Editor. It was expected that now with the 2D navigation mesh very complex polygons will be far more common then before and users will complain about this performance problem.

That is also what happened (the complex polygon part) but now some users started to miss the convenience of the old feature and want it back. If they only have simple projects it was convenient to not hit the bake button all the time to see how things turn out when baked. It is also regularly confusing new users that do not understand why there is no polygon, not having discovered the bake button yet.

So this pr adds back the auto-bake on a timer that refreshes on every change before firing the bake. By default 1.5 seconds which gives enough time to drag around multiple polygon outline points without triggering the bake. The timer can be adjusted in the EditorSettings. By turning it down to 0.0 seconds the old instant-bake is back. By going negativ <0 with the timer it gets disabled completely again. Slower users that need more time to arrange things can increase the timer near infinite, so the feature stays accesible.

I think this solves the issue for all the 3 major user groups.

@smix8 smix8 requested a review from a team as a code owner January 23, 2024 13:31
@smix8 smix8 force-pushed the nav_mesh_auto_rebake branch from 08438e7 to ad2babe Compare January 23, 2024 13:34
@smix8 smix8 added this to the 4.3 milestone Jan 23, 2024
@smix8 smix8 force-pushed the nav_mesh_auto_rebake branch from ad2babe to 186d175 Compare February 23, 2024 13:12
Copy link
Member

@fire fire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't usually review the navigation pull requests, but this appears to be a timer for delayed baking of navigation. It seems fine.

Auto-bakes edited NavigationPolygons in the Editor on a timer.
@smix8 smix8 force-pushed the nav_mesh_auto_rebake branch from 186d175 to 10e8f36 Compare February 27, 2024 19:51
@akien-mga akien-mga merged commit f80cdeb into godotengine:master Feb 27, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants