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

Export CachedWindow #12785

Closed
wants to merge 3 commits into from
Closed

Export CachedWindow #12785

wants to merge 3 commits into from

Conversation

UkoeHB
Copy link
Contributor

@UkoeHB UkoeHB commented Mar 29, 2024

Objective

  • Allow access to the CachedWindow resource. I am using this in bevy_worldswap when transferring newly-created windows to other worlds.

Solution

  • Export the CachedWindow struct.

Changelog

  • CachedWindow is now public.

@james7132 james7132 added A-Windowing Platform-agnostic interface layer to run your app in C-Usability A targeted quality-of-life change that makes Bevy easier to use labels Mar 29, 2024
@pablo-lua pablo-lua added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Apr 1, 2024
@mockersf
Copy link
Member

mockersf commented Apr 1, 2024

This component is supposed to be internal to how bevy_winit works, it shouldn't be visible from the outside

@mockersf mockersf added the X-Controversial There is active debate or serious implications around merging this PR label Apr 1, 2024
@UkoeHB
Copy link
Contributor Author

UkoeHB commented Apr 2, 2024

This component is supposed to be internal to how bevy_winit works, it shouldn't be visible from the outside

I agree. The problem I have is CachedWindow is inserted in create_windows, which only runs when making a new OS window. This is a blocker for worldswapping, where I am transferring windows between worlds. All I need to do is clone the CachedWindow component into secondary world window entities if those worlds aren't yet tracking a given window, but that isn't possible without access to the type information. Here's the code where I do that.

If you have an alternative idea, I'd be happy to implement it. One option would be to make the internal data of CachedWindow private, and also hide it from the generated docs.

@UkoeHB UkoeHB mentioned this pull request Apr 3, 2024
6 tasks
@mockersf
Copy link
Member

mockersf commented Apr 3, 2024

It seems your idea of "world swap" is not possible with private components handled by their own plugin...

Does that mean that you'll have to open PRs on every plugin that your users will try to use with yours to make them public?

@UkoeHB
Copy link
Contributor Author

UkoeHB commented Apr 3, 2024

It seems your idea of "world swap" is not possible with private components handled by their own plugin...

Does that mean that you'll have to open PRs on every plugin that your users will try to use with yours to make them public?

It's only the window swapping part that requires access to private components. In general world swapping is expected to have minimal coupling between worlds. If users want to couple other parts, then they'd need to figure that out on a case-by-case basis.

@UkoeHB
Copy link
Contributor Author

UkoeHB commented Apr 16, 2024

Closing due to won't fix conclusion from #12860.

@UkoeHB UkoeHB closed this Apr 16, 2024
@UkoeHB UkoeHB deleted the cached_window branch June 5, 2024 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Windowing Platform-agnostic interface layer to run your app in C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it X-Controversial There is active debate or serious implications around merging this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants