SystemParam QueryRecursive for safe recursive iteration.#13607
SystemParam QueryRecursive for safe recursive iteration.#13607mintlu8 wants to merge 14 commits intobevyengine:mainfrom
QueryRecursive for safe recursive iteration.#13607Conversation
QueryRecursive, a generalized version of propagate_transform .QueryRecursive for safe recursive iteration.
This reverts commit 60afdf7.
|
Aside from the API being IMO a bit rough & needing more design the issue with this is it's a stopgap that can be done via third party. Specifically: So the question then is what additional value would there be to providing this stopgap as a first party? Bare in mind this is already a kind of niche scenario simply due to the fact that hierarchy right now is very limited. |
I think this PR is very important since
I welcome suggestion to changes in the API. |
Objective
Recursive iterating through the hierarchy while keeping a reference to parent requires
unsafe, as seen inpropagate_transforminbevy_transform. This PR alleviates this issue by generalizing recursive iteration into a safe interface.Solution
Added
QueryRecursivethat contains 2 queries from 5 generic parameters.QueryDataSharedgets passed from parent to children as a reference during iteration.Additionally we support passing evaluation results from parent to children in
iter_mut_with.Example: transform pipeline (naive implementation)
Testing
Added some tests.
Changelog
Added
QueryRecursive.