Fix headless_renderer example and mention Screenshot.#19598
Fix headless_renderer example and mention Screenshot.#19598alice-i-cecile merged 3 commits intobevyengine:mainfrom
headless_renderer example and mention Screenshot.#19598Conversation
The feature is definitely worth preserving: that's important for machine learning applications, and some forms of testing. I'm not familiar enough to know if we could reuse Screenshot to do this perfectly and more simply, but this is a clear improvement over the current state of things. As a result, merging :) |
| .set(WindowPlugin { | ||
| primary_window: None, | ||
| // Don’t automatically exit due to having no windows. | ||
| exit_condition: bevy::window::ExitCondition::DontExit, |
There was a problem hiding this comment.
what makes it exit then?
There was a problem hiding this comment.
That's very much worth explaining, so I added a comment about that. The code explicitly generates an AppExit event.
I didn’t see any information in the contribution guide about force-push/rebase/squash preferences, so I added an extra commit with that comment, but I would personally rather rebase to 2 commits. Please let me know what is preferred.
There was a problem hiding this comment.
We don't have strong preferences about git workflows (primarily to reduce the barrier of entry), but I personally find that rebasing / force pushing sucks on Github because it risks stranding comments and generating nonsense notifications.
Objective
headless_rendererexample work instead of exiting without effect.Screenshotto use that instead.This PR was inspired by my own efforts to do headless rendering, in which the complexity of the
headless_rendererexample was a distraction, and this comment from #12478 (comment) :That “cleanup” was not done, and I thought to do it, but it seems to me that using
Screenshot(in its current form) in the example would not be correct, because — if I understand correctly — the example is trying to, potentially, capture many consecutive frames, whereasScreenshotby itself gives no means to capture multiple frames without gaps or duplicates. But perhaps I am wrong (the code is complex and not clearly documented), or perhaps that feature isn’t worth preserving. In that case, let me know and I will revise this PR.Solution
exit_condition: bevy::window::ExitCondition::DontExitScreenshotin the crate documentation.Testing