From f71152a45c64b9e9aecefc6a7dc32fa7f129c632 Mon Sep 17 00:00:00 2001 From: Aceeri Date: Mon, 11 Mar 2024 10:02:13 -0700 Subject: [PATCH] Non-exclusive systems for clearing contexts --- crates/bevy_gizmos/src/lib.rs | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/crates/bevy_gizmos/src/lib.rs b/crates/bevy_gizmos/src/lib.rs index 1ebff59ffa5292..913a46e71c186c 100755 --- a/crates/bevy_gizmos/src/lib.rs +++ b/crates/bevy_gizmos/src/lib.rs @@ -260,33 +260,27 @@ where /// Pop the default gizmos context out of the [`Swap`] gizmo storage. /// /// This must be called before [`UpdateGizmoMeshes`] in the [`Last`] schedule. -pub fn end_gizmo_context(world: &mut World) -where +pub fn end_gizmo_context( + mut swap: ResMut>>, + mut default: ResMut>, +) where Config: GizmoConfigGroup, Clear: 'static + Send + Sync, { - world.resource_scope( - |world: &mut World, mut swap: Mut>>| { - let mut default = world.resource_mut::>(); - default.clear(); - default.swap(&mut *swap); - }, - ); + default.clear(); + default.swap(&mut *swap); } /// Collect the requested gizmos into a specific clear context. -pub fn collect_requested_gizmos(world: &mut World) -where +pub fn collect_requested_gizmos( + mut update: ResMut>, + mut context: ResMut>, +) where Config: GizmoConfigGroup, Clear: 'static + Send + Sync, { - world.resource_scope( - |world: &mut World, mut update: Mut>| { - let mut context = world.resource_mut::>(); - context.append_storage(&update); - update.clear(); - }, - ); + context.append_storage(&update); + update.clear(); } /// Clear out the contextual gizmos.