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

Can raze work without a view reference? #11

Open
viridia opened this issue Jul 28, 2024 · 1 comment
Open

Can raze work without a view reference? #11

viridia opened this issue Jul 28, 2024 · 1 comment

Comments

@viridia
Copy link
Owner

viridia commented Jul 28, 2024

The .raze() method of View requires several parameters:

  • A DeferredWorld
  • The View that was used to create the view output.
  • The View::State.

So for example, Element::raze() uses the element's entity id (to despawn it) as well as the child views and the components, which also may need cleanup.

However, having to keep around both the View and View::State in order to cleanup View::State is troublesome. It would be convenient if somehow View::State could be despawnable by itself, but this would mean that it would have to have a more complex type, and this is true for every type that implements View.

Views are especially troublesome to keep around since, in general, they are not copyable or cloneable. This means having to wrap them in an Arc or some other container in order to keep them.

@viridia
Copy link
Owner Author

viridia commented Aug 25, 2024

I did a bit of research along these lines last week. The outcome was that if we made a modest change to Bevy - what I call the "hidden parents" feature - then about 50% of the code for Quill's view layer is no longer needed, raze is no longer needed, StateScoped can work, etc. The reason is because with hidden parents, we don't need two trees, we can do everything as a single tree.

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

No branches or pull requests

1 participant