From db6062940120bcb75803e0efdbbe06d9dd05f3c5 Mon Sep 17 00:00:00 2001 From: Schmarni Date: Fri, 2 May 2025 17:40:53 +0200 Subject: [PATCH 1/2] refactor: move hand debug gizmos into bevy_mod_xr Signed-off-by: Schmarni --- Cargo.lock | 1 + crates/bevy_openxr/examples/3d_scene.rs | 2 +- crates/bevy_openxr/examples/android/Cargo.toml | 1 + crates/bevy_openxr/examples/android/src/lib.rs | 2 +- crates/bevy_openxr/examples/raw_actions.rs | 5 +++-- crates/bevy_openxr/examples/tracking_utils.rs | 4 +++- crates/bevy_openxr/examples/transform_utils.rs | 6 +++--- crates/bevy_openxr/src/openxr/types.rs | 2 +- .../src/hand_gizmos.rs => bevy_xr/src/hand_debug_gizmos.rs} | 4 ++-- crates/bevy_xr/src/lib.rs | 1 + crates/bevy_xr_utils/src/lib.rs | 1 - 11 files changed, 17 insertions(+), 12 deletions(-) rename crates/{bevy_xr_utils/src/hand_gizmos.rs => bevy_xr/src/hand_debug_gizmos.rs} (93%) diff --git a/Cargo.lock b/Cargo.lock index 7379f57..afe67df 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -930,6 +930,7 @@ version = "0.2.1" dependencies = [ "bevy", "bevy_mod_openxr", + "bevy_mod_xr", "bevy_xr_utils", "reqwest", "zip", diff --git a/crates/bevy_openxr/examples/3d_scene.rs b/crates/bevy_openxr/examples/3d_scene.rs index f291179..3b6237e 100644 --- a/crates/bevy_openxr/examples/3d_scene.rs +++ b/crates/bevy_openxr/examples/3d_scene.rs @@ -19,7 +19,7 @@ fn main() -> AppExit { ]), ..default() }) - .add_plugins(bevy_xr_utils::hand_gizmos::HandGizmosPlugin) + .add_plugins(bevy_mod_xr::hand_debug_gizmos::HandGizmosPlugin) .add_systems(Startup, setup) .insert_resource(ClearColor(Color::NONE)) .run() diff --git a/crates/bevy_openxr/examples/android/Cargo.toml b/crates/bevy_openxr/examples/android/Cargo.toml index 4a1c6ed..3663aec 100644 --- a/crates/bevy_openxr/examples/android/Cargo.toml +++ b/crates/bevy_openxr/examples/android/Cargo.toml @@ -9,6 +9,7 @@ publish = false [dependencies] bevy_mod_openxr.workspace = true bevy_xr_utils.workspace = true +bevy_mod_xr.workspace = true bevy = { workspace = true, default-features = false, features = [ # Bevy 0.15 made GameActivity the default which breaks Quest builds # To use NativeActivity instead of GameActivity all of the features have to be listed manually diff --git a/crates/bevy_openxr/examples/android/src/lib.rs b/crates/bevy_openxr/examples/android/src/lib.rs index 3c82c27..66b212b 100644 --- a/crates/bevy_openxr/examples/android/src/lib.rs +++ b/crates/bevy_openxr/examples/android/src/lib.rs @@ -15,7 +15,7 @@ fn main() { }, ..default() })) - .add_plugins(bevy_xr_utils::hand_gizmos::HandGizmosPlugin) + .add_plugins(bevy_mod_xr::hand_debug_gizmos::HandGizmosPlugin) .add_systems(Startup, setup) .add_systems(Update, modify_msaa) .insert_resource(AmbientLight { diff --git a/crates/bevy_openxr/examples/raw_actions.rs b/crates/bevy_openxr/examples/raw_actions.rs index 4b7cc7a..31c1c9f 100644 --- a/crates/bevy_openxr/examples/raw_actions.rs +++ b/crates/bevy_openxr/examples/raw_actions.rs @@ -16,9 +16,10 @@ use bevy_mod_xr::{ }; use openxr::Posef; -fn main() { +fn main() -> AppExit { let mut app = App::new(); app.add_plugins(add_xr_plugins(DefaultPlugins)); + app.add_plugins(bevy_mod_xr::hand_debug_gizmos::HandGizmosPlugin); app.add_systems(XrSessionCreated, spawn_hands); app.add_systems(XrSessionCreated, attach_set); app.add_systems( @@ -31,7 +32,7 @@ fn main() { app.add_systems(Startup, create_actions.run_if(session_available)); app.add_systems(Startup, setup); - app.run(); + app.run() } fn attach_set(actions: Res, mut attach: EventWriter) { diff --git a/crates/bevy_openxr/examples/tracking_utils.rs b/crates/bevy_openxr/examples/tracking_utils.rs index cab0f0c..eb25ccb 100644 --- a/crates/bevy_openxr/examples/tracking_utils.rs +++ b/crates/bevy_openxr/examples/tracking_utils.rs @@ -4,12 +4,14 @@ use bevy::prelude::*; use bevy_mod_openxr::{action_binding::OxrSendActionBindings, add_xr_plugins}; use bevy_mod_xr::session::{XrSessionCreated, XrTracker}; use bevy_xr_utils::tracking_utils::{ - suggest_action_bindings, TrackingUtilitiesPlugin, XrTrackedLeftGrip, XrTrackedLocalFloor, XrTrackedRightGrip, XrTrackedStage, XrTrackedView + suggest_action_bindings, TrackingUtilitiesPlugin, XrTrackedLeftGrip, XrTrackedLocalFloor, + XrTrackedRightGrip, XrTrackedStage, XrTrackedView, }; fn main() { let mut app = App::new(); app.add_plugins(add_xr_plugins(DefaultPlugins)); + app.add_plugins(bevy_mod_xr::hand_debug_gizmos::HandGizmosPlugin); app.add_systems(Startup, setup); //things? diff --git a/crates/bevy_openxr/examples/transform_utils.rs b/crates/bevy_openxr/examples/transform_utils.rs index 9bda156..029c02f 100644 --- a/crates/bevy_openxr/examples/transform_utils.rs +++ b/crates/bevy_openxr/examples/transform_utils.rs @@ -8,10 +8,10 @@ use bevy_xr_utils::xr_utils_actions::{ XRUtilsActionsPlugin, XRUtilsBinding, }; -fn main() { +fn main() -> AppExit { App::new() .add_plugins(add_xr_plugins(DefaultPlugins)) - .add_plugins(bevy_xr_utils::hand_gizmos::HandGizmosPlugin) + .add_plugins(bevy_mod_xr::hand_debug_gizmos::HandGizmosPlugin) .add_plugins(transform_utils::TransformUtilitiesPlugin) .add_systems(Startup, setup) .add_plugins(XRUtilsActionsPlugin) @@ -31,7 +31,7 @@ fn main() { brightness: 500.0, ..AmbientLight::default() }) - .run(); + .run() } /// set up a simple 3D scene diff --git a/crates/bevy_openxr/src/openxr/types.rs b/crates/bevy_openxr/src/openxr/types.rs index 7ad5b32..fc0e0cd 100644 --- a/crates/bevy_openxr/src/openxr/types.rs +++ b/crates/bevy_openxr/src/openxr/types.rs @@ -1,7 +1,7 @@ use std::borrow::Cow; use crate::error::OxrError; -use crate::graphics::{GraphicsExt, GraphicsType, GraphicsWrap}; +use crate::graphics::GraphicsExt; pub use crate::openxr::exts::OxrExtensions; diff --git a/crates/bevy_xr_utils/src/hand_gizmos.rs b/crates/bevy_xr/src/hand_debug_gizmos.rs similarity index 93% rename from crates/bevy_xr_utils/src/hand_gizmos.rs rename to crates/bevy_xr/src/hand_debug_gizmos.rs index 29c3cfe..61cf071 100644 --- a/crates/bevy_xr_utils/src/hand_gizmos.rs +++ b/crates/bevy_xr/src/hand_debug_gizmos.rs @@ -1,7 +1,7 @@ +use crate::hands::{HandBone, XrHandBoneRadius}; +use crate::spaces::XrSpaceLocationFlags; use bevy::color::palettes::css; use bevy::{prelude::*, transform::TransformSystem}; -use bevy_mod_xr::hands::{HandBone, XrHandBoneRadius}; -use bevy_mod_xr::spaces::XrSpaceLocationFlags; pub struct HandGizmosPlugin; impl Plugin for HandGizmosPlugin { fn build(&self, app: &mut App) { diff --git a/crates/bevy_xr/src/lib.rs b/crates/bevy_xr/src/lib.rs index 7e95137..87692d1 100644 --- a/crates/bevy_xr/src/lib.rs +++ b/crates/bevy_xr/src/lib.rs @@ -4,3 +4,4 @@ pub mod hands; pub mod session; pub mod types; pub mod spaces; +pub mod hand_debug_gizmos; diff --git a/crates/bevy_xr_utils/src/lib.rs b/crates/bevy_xr_utils/src/lib.rs index ffce3b4..78db581 100644 --- a/crates/bevy_xr_utils/src/lib.rs +++ b/crates/bevy_xr_utils/src/lib.rs @@ -1,4 +1,3 @@ -pub mod hand_gizmos; #[cfg(not(target_family = "wasm"))] pub mod tracking_utils; #[cfg(not(target_family = "wasm"))] From bdfdb0d94a1c8326d177765c8b43c0f0576e9d74 Mon Sep 17 00:00:00 2001 From: Schmarni Date: Fri, 2 May 2025 17:43:02 +0200 Subject: [PATCH 2/2] refactor: move xr_utils examples into bevy_xr_utils Signed-off-by: Schmarni --- Cargo.lock | 1 - crates/bevy_openxr/Cargo.toml | 1 - crates/{bevy_openxr => bevy_xr_utils}/examples/tracking_utils.rs | 0 .../{bevy_openxr => bevy_xr_utils}/examples/transform_utils.rs | 0 4 files changed, 2 deletions(-) rename crates/{bevy_openxr => bevy_xr_utils}/examples/tracking_utils.rs (100%) rename crates/{bevy_openxr => bevy_xr_utils}/examples/transform_utils.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index afe67df..581b395 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -896,7 +896,6 @@ dependencies = [ "ash", "bevy", "bevy_mod_xr", - "bevy_xr_utils", "jni 0.20.0", "ndk-context", "openxr", diff --git a/crates/bevy_openxr/Cargo.toml b/crates/bevy_openxr/Cargo.toml index e34c04c..b42e310 100644 --- a/crates/bevy_openxr/Cargo.toml +++ b/crates/bevy_openxr/Cargo.toml @@ -14,7 +14,6 @@ d3d12 = ["wgpu/dx12", "wgpu-hal/dx12", "dep:winapi"] passthrough = [] [dev-dependencies] -bevy_xr_utils.workspace = true bevy = { workspace = true, default-features = true } [target.'cfg(target_os = "android")'.dependencies] diff --git a/crates/bevy_openxr/examples/tracking_utils.rs b/crates/bevy_xr_utils/examples/tracking_utils.rs similarity index 100% rename from crates/bevy_openxr/examples/tracking_utils.rs rename to crates/bevy_xr_utils/examples/tracking_utils.rs diff --git a/crates/bevy_openxr/examples/transform_utils.rs b/crates/bevy_xr_utils/examples/transform_utils.rs similarity index 100% rename from crates/bevy_openxr/examples/transform_utils.rs rename to crates/bevy_xr_utils/examples/transform_utils.rs