Skip to content

Commit 39f3dcb

Browse files
committed
simplify
1 parent fd6f231 commit 39f3dcb

File tree

3 files changed

+3
-31
lines changed

3 files changed

+3
-31
lines changed

crates/bevy_gizmos/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ repository = "https://github.com/bevyengine/bevy"
88
license = "MIT OR Apache-2.0"
99
keywords = ["bevy"]
1010

11-
[features]
12-
global_gizmos = []
13-
1411
[dependencies]
1512
# Bevy
1613
bevy_app = { path = "../bevy_app", version = "0.18.0-dev" }

crates/bevy_gizmos/src/global.rs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,25 +44,5 @@ fn flush_global_gizmos(mut gizmos: Gizmos) {
4444
/// }
4545
/// ```
4646
pub fn gizmo() -> impl core::ops::DerefMut<Target = GizmoBuffer<DefaultGizmoConfigGroup, ()>> {
47-
GlobalGizmos {
48-
guard: GLOBAL_GIZMO.lock().unwrap(),
49-
}
50-
}
51-
52-
struct GlobalGizmos<'a> {
53-
guard: std::sync::MutexGuard<'a, GizmoBuffer<DefaultGizmoConfigGroup, ()>>,
54-
}
55-
56-
impl<'a> core::ops::Deref for GlobalGizmos<'a> {
57-
type Target = GizmoBuffer<DefaultGizmoConfigGroup, ()>;
58-
59-
fn deref(&self) -> &Self::Target {
60-
&self.guard
61-
}
62-
}
63-
64-
impl<'a> core::ops::DerefMut for GlobalGizmos<'a> {
65-
fn deref_mut(&mut self) -> &mut Self::Target {
66-
&mut self.guard
67-
}
47+
GLOBAL_GIZMO.lock().unwrap()
6848
}

crates/bevy_gizmos/src/lib.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ pub mod config;
3030
pub mod cross;
3131
pub mod curves;
3232
pub mod gizmos;
33-
#[cfg(feature = "global_gizmos")]
3433
mod global;
3534
pub mod grid;
3635
pub mod primitives;
@@ -47,15 +46,14 @@ pub mod prelude {
4746
#[doc(hidden)]
4847
pub use crate::aabb::{AabbGizmoConfigGroup, ShowAabbGizmo};
4948

50-
#[cfg(feature = "global_gizmos")]
51-
pub use crate::global::gizmo;
5249
#[doc(hidden)]
5350
pub use crate::{
5451
config::{
5552
DefaultGizmoConfigGroup, GizmoConfig, GizmoConfigGroup, GizmoConfigStore,
5653
GizmoLineConfig, GizmoLineJoint, GizmoLineStyle,
5754
},
5855
gizmos::Gizmos,
56+
global::gizmo,
5957
primitives::{dim2::GizmoPrimitive2d, dim3::GizmoPrimitive3d},
6058
retained::Gizmo,
6159
AppGizmoBuilder, GizmoAsset,
@@ -96,10 +94,7 @@ impl Plugin for GizmoPlugin {
9694
// We insert the Resource GizmoConfigStore into the world implicitly here if it does not exist.
9795
.init_gizmo_group::<DefaultGizmoConfigGroup>();
9896

99-
app.add_plugins(aabb::AabbGizmoPlugin);
100-
101-
#[cfg(feature = "global_gizmos")]
102-
app.add_plugins(global::GlobalGizmosPlugin);
97+
app.add_plugins((aabb::AabbGizmoPlugin, global::GlobalGizmosPlugin));
10398

10499
#[cfg(feature = "bevy_light")]
105100
app.add_plugins(LightGizmoPlugin);

0 commit comments

Comments
 (0)