mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-11-22 11:50:53 +00:00
chore(examples): tweaks to common code to make clippy happy
This commit is contained in:
parent
25883597ec
commit
5c43d2ead7
@ -5,11 +5,13 @@ pub use camera::*;
|
|||||||
//pub use relationships::*;
|
//pub use relationships::*;
|
||||||
|
|
||||||
#[cfg(feature = "physics_rapier")]
|
#[cfg(feature = "physics_rapier")]
|
||||||
|
#[allow(ambiguous_glob_reexports)]
|
||||||
pub mod physics_rapier;
|
pub mod physics_rapier;
|
||||||
#[cfg(feature = "physics_rapier")]
|
#[cfg(feature = "physics_rapier")]
|
||||||
pub use physics_rapier::*;
|
pub use physics_rapier::*;
|
||||||
|
|
||||||
#[cfg(feature = "physics_xpbd")]
|
#[cfg(feature = "physics_xpbd")]
|
||||||
|
#[allow(ambiguous_glob_reexports)]
|
||||||
pub mod physics_xpbd;
|
pub mod physics_xpbd;
|
||||||
#[cfg(feature = "physics_xpbd")]
|
#[cfg(feature = "physics_xpbd")]
|
||||||
pub use physics_xpbd::*;
|
pub use physics_xpbd::*;
|
||||||
@ -19,6 +21,14 @@ use bevy::prelude::*;
|
|||||||
pub struct CorePlugin;
|
pub struct CorePlugin;
|
||||||
impl Plugin for CorePlugin {
|
impl Plugin for CorePlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
app.add_plugins((CameraPlugin, PhysicsPlugin));
|
app.add_plugins(CameraPlugin);
|
||||||
|
|
||||||
|
#[cfg(feature = "physics_rapier")]
|
||||||
|
app.add_plugins(PhysicsPlugin);
|
||||||
|
|
||||||
|
#[cfg(feature = "physics_xpbd")]
|
||||||
|
app.add_plugins(PhysicsPluginXPBD);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,17 +6,17 @@ use bevy::{
|
|||||||
};
|
};
|
||||||
use bevy_rapier3d::{prelude::RapierConfiguration, render::DebugRenderContext};
|
use bevy_rapier3d::{prelude::RapierConfiguration, render::DebugRenderContext};
|
||||||
|
|
||||||
pub fn pause_physics(mut physics_config: ResMut<RapierConfiguration>) {
|
pub(crate) fn pause_physics(mut physics_config: ResMut<RapierConfiguration>) {
|
||||||
info!("pausing physics");
|
info!("pausing physics");
|
||||||
physics_config.physics_pipeline_active = false;
|
physics_config.physics_pipeline_active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn resume_physics(mut physics_config: ResMut<RapierConfiguration>) {
|
pub(crate) fn resume_physics(mut physics_config: ResMut<RapierConfiguration>) {
|
||||||
info!("unpausing physics");
|
info!("unpausing physics");
|
||||||
physics_config.physics_pipeline_active = true;
|
physics_config.physics_pipeline_active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn toggle_physics_debug(
|
pub(crate) fn toggle_physics_debug(
|
||||||
mut debug_config: ResMut<DebugRenderContext>,
|
mut debug_config: ResMut<DebugRenderContext>,
|
||||||
keycode: Res<ButtonInput<KeyCode>>,
|
keycode: Res<ButtonInput<KeyCode>>,
|
||||||
) {
|
) {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
pub mod physics_replace_proxies;
|
pub(crate) mod physics_replace_proxies;
|
||||||
pub use physics_replace_proxies::*;
|
pub(crate) use physics_replace_proxies::*;
|
||||||
|
|
||||||
pub mod utils;
|
pub(crate) mod utils;
|
||||||
|
|
||||||
pub mod controls;
|
pub(crate) mod controls;
|
||||||
pub use controls::*;
|
pub(crate) use controls::*;
|
||||||
|
|
||||||
use crate::state::GameState;
|
use crate::state::GameState;
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
|
@ -26,7 +26,7 @@ pub enum AutoAABBCollider {
|
|||||||
|
|
||||||
// replaces all physics stand-ins with the actual rapier types
|
// replaces all physics stand-ins with the actual rapier types
|
||||||
#[allow(clippy::type_complexity)]
|
#[allow(clippy::type_complexity)]
|
||||||
pub fn physics_replace_proxies(
|
pub(crate) fn physics_replace_proxies(
|
||||||
meshes: Res<Assets<Mesh>>,
|
meshes: Res<Assets<Mesh>>,
|
||||||
mesh_handles: Query<&Handle<Mesh>>,
|
mesh_handles: Query<&Handle<Mesh>>,
|
||||||
mut proxy_colliders: Query<
|
mut proxy_colliders: Query<
|
||||||
|
@ -8,17 +8,17 @@ use bevy::{prelude::ResMut, time::Time};
|
|||||||
use bevy_xpbd_3d::prelude::Physics;
|
use bevy_xpbd_3d::prelude::Physics;
|
||||||
use bevy_xpbd_3d::prelude::*;
|
use bevy_xpbd_3d::prelude::*;
|
||||||
|
|
||||||
pub fn pause_physics(mut time: ResMut<Time<Physics>>) {
|
pub(crate) fn pause_physics(mut time: ResMut<Time<Physics>>) {
|
||||||
info!("pausing physics");
|
info!("pausing physics");
|
||||||
time.pause();
|
time.pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn resume_physics(mut time: ResMut<Time<Physics>>) {
|
pub(crate) fn resume_physics(mut time: ResMut<Time<Physics>>) {
|
||||||
info!("unpausing physics");
|
info!("unpausing physics");
|
||||||
time.unpause();
|
time.unpause();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn toggle_physics_debug(
|
pub(crate) fn toggle_physics_debug(
|
||||||
mut config_store: ResMut<GizmoConfigStore>,
|
mut config_store: ResMut<GizmoConfigStore>,
|
||||||
keycode: Res<ButtonInput<KeyCode>>,
|
keycode: Res<ButtonInput<KeyCode>>,
|
||||||
) {
|
) {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
pub mod physics_replace_proxies;
|
pub(crate) mod physics_replace_proxies;
|
||||||
pub use physics_replace_proxies::*;
|
pub(crate) use physics_replace_proxies::*;
|
||||||
|
|
||||||
pub mod utils;
|
pub(crate) mod utils;
|
||||||
|
|
||||||
pub mod controls;
|
pub(crate) mod controls;
|
||||||
pub use controls::*;
|
pub(crate) use controls::*;
|
||||||
|
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_xpbd_3d::prelude::*;
|
use bevy_xpbd_3d::prelude::*;
|
||||||
@ -12,8 +12,8 @@ use bevy_xpbd_3d::prelude::*;
|
|||||||
use crate::state::GameState;
|
use crate::state::GameState;
|
||||||
use bevy_gltf_blueprints::GltfBlueprintsSet;
|
use bevy_gltf_blueprints::GltfBlueprintsSet;
|
||||||
|
|
||||||
pub struct PhysicsPlugin;
|
pub struct PhysicsPluginXPBD;
|
||||||
impl Plugin for PhysicsPlugin {
|
impl Plugin for PhysicsPluginXPBD {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
app.add_plugins((PhysicsPlugins::default(), PhysicsDebugPlugin::default()))
|
app.add_plugins((PhysicsPlugins::default(), PhysicsDebugPlugin::default()))
|
||||||
.register_type::<AutoAABBCollider>()
|
.register_type::<AutoAABBCollider>()
|
||||||
|
@ -25,7 +25,7 @@ pub enum AutoAABBCollider {
|
|||||||
|
|
||||||
// replaces all physics stand-ins with the actual xpbd types
|
// replaces all physics stand-ins with the actual xpbd types
|
||||||
#[allow(clippy::type_complexity)]
|
#[allow(clippy::type_complexity)]
|
||||||
pub fn physics_replace_proxies(
|
pub(crate) fn physics_replace_proxies(
|
||||||
meshes: Res<Assets<Mesh>>,
|
meshes: Res<Assets<Mesh>>,
|
||||||
mesh_handles: Query<&Handle<Mesh>>,
|
mesh_handles: Query<&Handle<Mesh>>,
|
||||||
mut proxy_colliders: Query<
|
mut proxy_colliders: Query<
|
||||||
|
Loading…
Reference in New Issue
Block a user