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.

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.
@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