mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 12:43:34 +00:00
6573887d5c
# Objective - Fixes a correctness error introduced in https://github.com/bevyengine/bevy/pull/14013 ... ## Solution I've been playing around a lot of with the access code and I realized that I introduced a soundness error when trying to simplify the code. When we have a `Or<(With<A>, With<B>)>` filter, we cannot call ``` let mut intermediate = FilteredAccess::default(); $name::update_component_access($name, &mut intermediate); _new_access.append_or(&intermediate); ``` because that's just equivalent to adding the new components as `Or` clauses. For example if the existing `filter_sets` was `vec![With<C>]`, we would then get `vec![With<C>, With<A>, With<B>]` which translates to `A or B or C`. Instead what we want is `(A and B) or (A and C)`, so we need to have each new OR clause compose with the existing access like so: ``` let mut intermediate = _access.clone(); // if we previously had a With<C> in the filter_set, this will become `With<C> AND With<A>` $name::update_component_access($name, &mut intermediate); _new_access.append_or(&intermediate); ``` ## Testing - Added a unit test that is broken in main, but passes in this PR |
||
---|---|---|
.. | ||
bevy_a11y | ||
bevy_animation | ||
bevy_app | ||
bevy_asset | ||
bevy_audio | ||
bevy_color | ||
bevy_core | ||
bevy_core_pipeline | ||
bevy_derive | ||
bevy_dev_tools | ||
bevy_diagnostic | ||
bevy_dylib | ||
bevy_dynamic_plugin | ||
bevy_ecs | ||
bevy_encase_derive | ||
bevy_gilrs | ||
bevy_gizmos | ||
bevy_gltf | ||
bevy_hierarchy | ||
bevy_input | ||
bevy_internal | ||
bevy_log | ||
bevy_macro_utils | ||
bevy_math | ||
bevy_mikktspace | ||
bevy_pbr | ||
bevy_picking | ||
bevy_ptr | ||
bevy_reflect | ||
bevy_render | ||
bevy_scene | ||
bevy_sprite | ||
bevy_state | ||
bevy_tasks | ||
bevy_text | ||
bevy_time | ||
bevy_transform | ||
bevy_ui | ||
bevy_utils | ||
bevy_window | ||
bevy_winit |