chore(Bevy): Update to bevy 0.13 (#136)

* chore(crates): updated crates to Bevy 0.13
   * updated deps
   * updated / changed code where relevant
   * updated README files
   * bumped version numbers for upcoming release
   * updated rust-toolchain
   * updated assets where relevant
   * closes #132 
* feat(bevy_gltf_components): 
  * added GltfProcessed flag component to improve performance of iteration over added<gltfExtras>
  * closes #144 
  * light & shadow processing is now integrated,  to match  lights coming from Blender: you can now control whether 
  lights cast shadows, the cascade resolution , background color etc  from Blender
   * closes #155 

* feat(bevy_registry_export): added boilerplate to make registry path relative to assets folder 
  * closes #137 
* feat(tools): added boilerplate for internal tools
   * clean zip file generator for blender add-on releases
   * example gltf file generator
* feat(lighting): added components, exporter support & testing for blender-configurable shadows
   * added BlenderLightShadows component to bevy_gltf_components
   * added writing shadow information to gltf_auto_export
   * updated tests
   * closes #157 

Co-authored-by: Jan Hohenheim <jan@hohenheim.ch>
This commit is contained in:
Mark Moissette 2024-03-04 22:16:31 +01:00 committed by GitHub
parent 9cb9dda5d3
commit 09915f521d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
146 changed files with 6665 additions and 1818 deletions

View File

@ -20,7 +20,7 @@ jobs:
key: ubuntu-latest-cargo-lint-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.75.0
toolchain: 1.76.0
components: rustfmt, clippy
- name: Install alsa and udev
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev

View File

@ -1,22 +1,12 @@
[workspace]
members = [
"crates/bevy_gltf_components",
"crates/bevy_gltf_blueprints",
"crates/bevy_gltf_save_load",
"crates/bevy_registry_export",
"examples/common/",
"examples/bevy_gltf_components/basic/",
"examples/bevy_gltf_blueprints/basic/",
"examples/bevy_gltf_blueprints/basic_xpbd_physics/",
"examples/bevy_gltf_blueprints/animation/",
"examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles",
"examples/bevy_gltf_blueprints/materials/",
"examples/bevy_gltf_save_load/basic/",
"examples/bevy_registry_export/basic",
"testing/bevy_example"
"crates/*",
"examples/common*",
"examples/bevy_gltf_components/*",
"examples/bevy_gltf_blueprints/*",
"examples/bevy_gltf_save_load/*",
"examples/bevy_registry_export/*",
"testing/bevy_example/",
]
resolver = "2"
@ -30,6 +20,10 @@ match_same_arms = "warn"
semicolon_if_nothing_returned = "warn"
#### --------------------Dev/ debug-------------------------------
# Enable a small amount of optimization in debug mode
[profile.dev]
opt-level = 1
# Enable high optimizations for dependencies (incl. Bevy), but not for our code:
[profile.dev.package."*"]
opt-level = 3

View File

@ -1,6 +1,6 @@
[package]
name = "bevy_gltf_blueprints"
version = "0.8.0"
version = "0.9.0"
authors = ["Mark 'kaosat-dev' Moissette"]
description = "Adds the ability to define Blueprints/Prefabs for [Bevy](https://bevyengine.org/) inside gltf files and spawn them in Bevy."
homepage = "https://github.com/kaosat-dev/Blender_bevy_components_workflow"
@ -13,10 +13,9 @@ license = "MIT OR Apache-2.0"
[lints]
workspace = true
[dev-dependencies]
bevy = { version = "0.12", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf", "bevy_animation", "animation"] }
[dependencies]
bevy_gltf_components = "0.4"
#bevy_gltf_components = { path = "../bevy_gltf_components" }
bevy = { version = "0.12", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf", "bevy_animation", "animation"] }
bevy_gltf_components = { version = "0.5", path = "../bevy_gltf_components" }
bevy = { version = "0.13", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf", "bevy_animation", "animation"] }
[dev-dependencies]
bevy = { version = "0.13", default-features = false, features = ["dynamic_linking"] }

View File

@ -25,8 +25,8 @@ Here's a minimal usage example:
```toml
# Cargo.toml
[dependencies]
bevy="0.12"
bevy_gltf_blueprints = { version = "0.8"}
bevy="0.13"
bevy_gltf_blueprints = { version = "0.9"}
```
@ -64,7 +64,7 @@ fn spawn_blueprint(
Add the following to your `[dependencies]` section in `Cargo.toml`:
```toml
bevy_gltf_blueprints = "0.8"
bevy_gltf_blueprints = "0.9"
```
Or use `cargo add`:
@ -346,9 +346,10 @@ The main branch is compatible with the latest Bevy release, while the branch `be
Compatibility of `bevy_gltf_blueprints` versions:
| `bevy_gltf_blueprints` | `bevy` |
| :-- | :-- |
| `0.9` | `0.13` |
| `0.3 - 0.8` | `0.12` |
| `0.1 - 0.2` | `0.11` |
| branch `main` | `0.12` |
| branch `main` | `0.13` |
| branch `bevy_main` | `main` |

View File

@ -78,6 +78,9 @@ impl CopyComponents {
};
for (component, type_id) in components {
let type_registry: &AppTypeRegistry = world.resource();
let type_registry = type_registry.clone();
let type_registry = type_registry.read();
let source = component
.reflect(world.get_entity(self.source).unwrap())
.unwrap()
@ -90,7 +93,7 @@ impl CopyComponents {
// println!("contains typeid {:?} {}", type_id, destination.contains_type_id(type_id));
// we only want to copy components that are NOT already in the destination (ie no overwriting existing components)
if !destination.contains_type_id(type_id) {
component.insert(&mut destination, &*source);
component.insert(&mut destination, &*source, &type_registry);
}
}
}

View File

@ -30,11 +30,14 @@ pub struct MaterialInfo {
pub(crate) fn materials_inject(
mut blueprints_config: ResMut<BluePrintsConfig>,
material_infos: Query<(&MaterialInfo, &Children), Added<MaterialInfo>>,
with_materials_and_meshes: Query<(
With<Parent>,
With<Handle<StandardMaterial>>,
With<Handle<Mesh>>,
)>,
with_materials_and_meshes: Query<
(),
(
With<Parent>,
With<Handle<StandardMaterial>>,
With<Handle<Mesh>>,
),
>,
models: Res<Assets<bevy::gltf::Gltf>>,
asset_server: Res<AssetServer>,

View File

@ -1,6 +1,6 @@
[package]
name = "bevy_gltf_components"
version = "0.4.0"
version = "0.5.0"
authors = ["Mark 'kaosat-dev' Moissette"]
description = "Allows you to define [Bevy](https://bevyengine.org/) components direclty inside gltf files and instanciate the components on the Bevy side."
homepage = "https://github.com/kaosat-dev/Blender_bevy_components_workflow"
@ -13,10 +13,10 @@ license = "MIT OR Apache-2.0"
[lints]
workspace = true
[dev-dependencies]
bevy = { version = "0.12", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] }
[dependencies]
bevy = { version = "0.12", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] }
bevy = { version = "0.13", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] }
serde = "1.0.188"
ron = "0.8.1"
[dev-dependencies]
bevy = { version = "0.13", default-features = false, features = ["dynamic_linking"] }

View File

@ -23,8 +23,8 @@ Here's a minimal usage example:
```toml
# Cargo.toml
[dependencies]
bevy="0.12"
bevy_gltf_components = { version = "0.4"}
bevy="0.13"
bevy_gltf_components = { version = "0.5"}
```
@ -60,7 +60,7 @@ bevy_gltf_components = { version = "0.4"}
Add the following to your `[dependencies]` section in `Cargo.toml`:
```toml
bevy_gltf_components = "0.4"
bevy_gltf_components = "0.5"
```
Or use `cargo add`:
@ -104,6 +104,16 @@ Typically , the order of systems should be
***bevy_gltf_components (GltfComponentsSet::Injection)*** => ***replace_proxies***
## Additional features
- as of version 0.5 , this crate also includes automatic handling of lights in gltf files, to attempt to match Blender's eevee rendering as close as possible:
* **BlenderLightShadows** (automatically generated by the gltf_auto_export Blender add-on) allows you to toggle light's shadows on/off in Blender and have matching
behaviour in Bevy
* **BlenderBackgroundShader** aka background color is also automatically set on the Bevy side
* **BlenderShadowSettings** sets the cascade_size on the bevy side to match the one configured in Blender
If these components are present in your gltf file, they will be handled automatically by this crate, will be ignored otherwise.
## Examples
https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/examples/basic
@ -117,9 +127,10 @@ The main branch is compatible with the latest Bevy release, while the branch `be
Compatibility of `bevy_gltf_components` versions:
| `bevy_gltf_components` | `bevy` |
| :-- | :-- |
| `0.5` | `0.13` |
| `0.2 - 0.4` | `0.12` |
| `0.1` | `0.11` |
| branch `main` | `0.12` |
| branch `main` | `0.13` |
| branch `bevy_main` | `main` |

View File

@ -0,0 +1,8 @@
use bevy::prelude::*;
mod lighting;
pub use lighting::*;
pub(crate) fn plugin(app: &mut App) {
app.add_plugins(lighting::plugin);
}

View File

@ -0,0 +1,97 @@
use bevy::pbr::DirectionalLightShadowMap;
use bevy::prelude::*;
use crate::GltfComponentsSet;
pub(crate) fn plugin(app: &mut App) {
app.register_type::<BlenderBackgroundShader>()
.register_type::<BlenderShadowSettings>()
.register_type::<BlenderLightShadows>()
.add_systems(
Update,
(process_lights, process_shadowmap, process_background_shader)
.after(GltfComponentsSet::Injection),
);
}
#[derive(Component, Reflect, Default, Debug, PartialEq, Clone)]
#[reflect(Component)]
#[non_exhaustive]
/// The properties of a light's shadow , to enable controlling per light shadows from Blender
pub struct BlenderLightShadows {
pub enabled: bool,
pub buffer_bias: f32,
}
/// The background color as described by Blender's [background shader](https://docs.blender.org/manual/en/latest/render/shader_nodes/shader/background.html).
#[derive(Component, Reflect, Default, Debug, PartialEq, Clone)]
#[reflect(Component)]
#[non_exhaustive]
pub struct BlenderBackgroundShader {
pub color: Color,
pub strength: f32,
}
/// The settings used by EEVEE's [shadow rendering](https://docs.blender.org/manual/en/latest/render/eevee/render_settings/shadows.html).
#[derive(Component, Reflect, Default, Debug, PartialEq, Clone)]
#[reflect(Component)]
#[non_exhaustive]
pub struct BlenderShadowSettings {
pub cascade_size: usize,
}
fn process_lights(
mut directional_lights: Query<
(&mut DirectionalLight, Option<&BlenderLightShadows>),
Added<DirectionalLight>,
>,
mut spot_lights: Query<(&mut SpotLight, Option<&BlenderLightShadows>), Added<SpotLight>>,
mut point_lights: Query<(&mut PointLight, Option<&BlenderLightShadows>), Added<PointLight>>,
) {
for (mut light, blender_light_shadows) in directional_lights.iter_mut() {
if let Some(blender_light_shadows) = blender_light_shadows {
light.shadows_enabled = blender_light_shadows.enabled;
} else {
light.shadows_enabled = true;
}
}
for (mut light, blender_light_shadows) in spot_lights.iter_mut() {
if let Some(blender_light_shadows) = blender_light_shadows {
light.shadows_enabled = blender_light_shadows.enabled;
} else {
light.shadows_enabled = true;
}
}
for (mut light, blender_light_shadows) in point_lights.iter_mut() {
if let Some(blender_light_shadows) = blender_light_shadows {
light.shadows_enabled = blender_light_shadows.enabled;
} else {
light.shadows_enabled = true;
}
}
}
fn process_shadowmap(
shadowmaps: Query<&BlenderShadowSettings, Added<BlenderShadowSettings>>,
mut commands: Commands,
) {
for shadowmap in shadowmaps.iter() {
commands.insert_resource(DirectionalLightShadowMap {
size: shadowmap.cascade_size,
});
}
}
fn process_background_shader(
background_shaders: Query<&BlenderBackgroundShader, Added<BlenderBackgroundShader>>,
mut commands: Commands,
) {
for background_shader in background_shaders.iter() {
commands.insert_resource(AmbientLight {
color: background_shader.color,
// Just a guess, see <https://github.com/bevyengine/bevy/issues/12280>
brightness: background_shader.strength * 400.0,
});
}
}

View File

@ -7,11 +7,18 @@ pub use ronstring_to_reflect_component::*;
pub mod process_gltfs;
pub use process_gltfs::*;
pub mod blender_settings;
use bevy::{
app::Startup,
ecs::system::{Res, Resource},
ecs::{
component::Component,
reflect::ReflectComponent,
system::{Res, Resource},
},
log::warn,
prelude::{App, IntoSystemConfigs, Plugin, SystemSet, Update},
reflect::Reflect,
};
/// A Bevy plugin for extracting components from gltf files and automatically adding them to the relevant entities
@ -47,6 +54,11 @@ use bevy::{
///}
/// ```
/// this is a flag component to tag a processed gltf, to avoid processing things multiple times
#[derive(Component, Reflect, Default, Debug)]
#[reflect(Component)]
pub struct GltfProcessed;
#[derive(SystemSet, Debug, Hash, PartialEq, Eq, Clone)]
/// systemset to order your systems after the component injection when needed
pub enum GltfComponentsSet {
@ -76,13 +88,15 @@ fn check_for_legacy_mode(gltf_components_config: Res<GltfComponentsConfig>) {
impl Plugin for ComponentsFromGltfPlugin {
fn build(&self, app: &mut App) {
app.insert_resource(GltfComponentsConfig {
legacy_mode: self.legacy_mode,
})
.add_systems(Startup, check_for_legacy_mode)
.add_systems(
Update,
(add_components_from_gltf_extras).in_set(GltfComponentsSet::Injection),
);
app.add_plugins(blender_settings::plugin)
.register_type::<GltfProcessed>()
.insert_resource(GltfComponentsConfig {
legacy_mode: self.legacy_mode,
})
.add_systems(Startup, check_for_legacy_mode)
.add_systems(
Update,
(add_components_from_gltf_extras).in_set(GltfComponentsSet::Injection),
);
}
}

View File

@ -2,7 +2,7 @@ use bevy::{
core::Name,
ecs::{
entity::Entity,
query::Added,
query::{Added, Without},
reflect::{AppTypeRegistry, ReflectComponent},
world::World,
},
@ -13,12 +13,12 @@ use bevy::{
utils::HashMap,
};
use crate::{ronstring_to_reflect_component, GltfComponentsConfig};
use crate::{ronstring_to_reflect_component, GltfComponentsConfig, GltfProcessed};
/// main function: injects components into each entity in gltf files that have `gltf_extras`, using reflection
pub fn add_components_from_gltf_extras(world: &mut World) {
let mut extras =
world.query_filtered::<(Entity, &Name, &GltfExtras, &Parent), Added<GltfExtras>>();
world.query_filtered::<(Entity, &Name, &GltfExtras, &Parent), (Added<GltfExtras>, Without<GltfProcessed>)>();
let mut entity_components: HashMap<Entity, Vec<(Box<dyn Reflect>, TypeRegistration)>> =
HashMap::new();
@ -32,6 +32,7 @@ pub fn add_components_from_gltf_extras(world: &mut World) {
let type_registry: &AppTypeRegistry = world.resource();
let type_registry = type_registry.read();
let reflect_components = ronstring_to_reflect_component(
&extra.value,
&type_registry,
@ -68,20 +69,29 @@ pub fn add_components_from_gltf_extras(world: &mut World) {
}
for (entity, components) in entity_components {
let type_registry: &AppTypeRegistry = world.resource();
let type_registry = type_registry.clone();
let type_registry = type_registry.read();
if !components.is_empty() {
debug!("--entity {:?}, components {}", entity, components.len());
}
for (component, type_registration) in components {
let mut entity_mut = world.entity_mut(entity);
debug!(
"------adding {} {:?}",
component.get_represented_type_info().unwrap().type_path(),
component
);
type_registration
.data::<ReflectComponent>()
.unwrap()
.insert(&mut entity_mut, &*component); // TODO: how can we insert any additional components "by hand" here ?
{
let mut entity_mut = world.entity_mut(entity);
type_registration
.data::<ReflectComponent>()
.expect("Unable to reflect component")
.insert(&mut entity_mut, &*component, &type_registry);
entity_mut.insert(GltfProcessed); // this is how can we insert any additional components
}
}
}
}

View File

@ -110,7 +110,8 @@ pub fn ronstring_to_reflect_component(
println!("serialized Component {}", serialized);*/
debug!("component data ron string {}", ron_string);
let mut deserializer = ron::Deserializer::from_str(ron_string.as_str()).unwrap();
let mut deserializer = ron::Deserializer::from_str(ron_string.as_str())
.expect("deserialzer should have been generated from string");
let reflect_deserializer = UntypedReflectDeserializer::new(type_registry);
let component = reflect_deserializer
.deserialize(&mut deserializer)
@ -123,7 +124,6 @@ pub fn ronstring_to_reflect_component(
debug!("component {:?}", component);
debug!("real type {:?}", component.get_represented_type_info());
components.push((component, type_registration.clone()));
debug!("found type registration for {}", capitalized_type_name);
} else {

View File

@ -1,6 +1,6 @@
[package]
name = "bevy_gltf_save_load"
version = "0.3.0"
version = "0.4.0"
authors = ["Mark 'kaosat-dev' Moissette"]
description = "Save & load your bevy games"
homepage = "https://github.com/kaosat-dev/Blender_bevy_components_workflow"
@ -13,10 +13,10 @@ license = "MIT OR Apache-2.0"
[lints]
workspace = true
[dev-dependencies]
bevy = { version = "0.12", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] }
[dependencies]
bevy = { version = "0.12", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] }
bevy_gltf_blueprints = "0.8"
#bevy_gltf_blueprints = { path = "../bevy_gltf_blueprints" }
bevy = { version = "0.13", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] }
#bevy_gltf_blueprints = "0.9"
bevy_gltf_blueprints = { version = "0.9", path = "../bevy_gltf_blueprints" }
[dev-dependencies]
bevy = { version = "0.13", default-features = false, features = ["dynamic_linking"] }

View File

@ -34,9 +34,9 @@ Here's a minimal usage example:
```toml
# Cargo.toml
[dependencies]
bevy="0.12"
bevy_gltf_save_load = "0.3"
bevy_gltf_blueprints = "0.6" // also needed
bevy="0.13"
bevy_gltf_save_load = "0.4"
bevy_gltf_blueprints = "0.9" // also needed
```
```rust no_run
@ -142,7 +142,11 @@ Add the following to your `[dependencies]` section in `Cargo.toml`:
```toml
bevy_gltf_save_load = "0.3"
<<<<<<< HEAD
bevy_gltf_blueprints = "0.8" // also needed, as bevy_gltf_save_load does not re-export it at this time
=======
bevy_gltf_blueprints = "0.6" // also needed, as bevy_gltf_save_load does not re-export it at this time
>>>>>>> 9cb9dda5d35c635d367fa81ca1a6c752cda9bc02
```
@ -299,6 +303,7 @@ The main branch is compatible with the latest Bevy release, while the branch `be
Compatibility of `bevy_gltf_save_load` versions:
| `bevy_gltf_save_load` | `bevy` |
| :-- | :-- |
| `0.4 ` | `0.13` |
| `0.1 -0.3` | `0.12` |
| branch `main` | `0.12` |
| branch `bevy_main` | `main` |

View File

@ -92,15 +92,15 @@ impl Plugin for SaveLoadPlugin {
Update,
(unload_world, apply_deferred, load_game)
.chain()
.run_if(resource_exists::<LoadRequested>())
.run_if(not(resource_exists::<LoadFirstStageDone>()))
.run_if(resource_exists::<LoadRequested>)
.run_if(not(resource_exists::<LoadFirstStageDone>))
.in_set(LoadingSet::Load),
)
.add_systems(
Update,
(load_static, apply_deferred, cleanup_loaded_scene)
.chain()
.run_if(resource_exists::<LoadFirstStageDone>())
.run_if(resource_exists::<LoadFirstStageDone>)
// .run_if(in_state(AppState::LoadingGame))
.in_set(LoadingSet::Load),
);

View File

@ -1,6 +1,6 @@
[package]
name = "bevy_registry_export"
version = "0.2.0"
version = "0.3.0"
authors = ["Mark 'kaosat-dev' Moissette", "Pascal 'Killercup' Hertleif"]
description = "Allows you to define [Bevy](https://bevyengine.org/) components direclty inside gltf files and instanciate the components on the Bevy side."
homepage = "https://github.com/kaosat-dev/Blender_bevy_components_workflow"
@ -10,12 +10,12 @@ categories = ["game-development"]
edition = "2021"
license = "MIT OR Apache-2.0"
[dev-dependencies]
bevy = { version = "0.12", default-features = false, features = ["bevy_asset", "bevy_scene", "bevy_gltf"] }
[dependencies]
bevy = { version = "0.12", default-features = false, features = ["bevy_scene"] }
bevy_reflect = { version = "0.12.1", default-features = false }
bevy_app = { version = "0.12.1", default-features = false, features = ["bevy_reflect"] }
bevy_ecs = { version = "0.12.1", default-features = false, features = ["bevy_reflect"] }
serde_json = "1.0.108"
bevy = { version = "0.13", default-features = false, features = ["bevy_scene"] }
bevy_reflect = { version = "0.13", default-features = false }
bevy_app = { version = "0.13", default-features = false, features = ["bevy_reflect"] }
bevy_ecs = { version = "0.13", default-features = false, features = ["bevy_reflect"] }
serde_json = "1.0.108"
[dev-dependencies]
bevy = { version = "0.13", default-features = false, features = ["dynamic_linking"] }

View File

@ -17,8 +17,8 @@ Here's a minimal usage example:
```toml
# Cargo.toml
[dependencies]
bevy="0.12"
bevy_registry_export = "0.2"
bevy="0.13"
bevy_registry_export = "0.3"
```
```rust no_run
@ -44,7 +44,7 @@ take a look at the [example]('https://github.com/kaosat-dev/Blender_bevy_compone
Add the following to your `[dependencies]` section in `Cargo.toml`:
```toml
bevy_registry_export = "0.2"
bevy_registry_export = "0.3"
```
@ -112,6 +112,7 @@ The main branch is compatible with the latest Bevy release, while the branch `be
Compatibility of `bevy_registry_export` versions:
| `bevy_registry_export` | `bevy` | `bevy_components (Blender add-on)` |
| :-- | :-- |:-- |
| `0.3 ` | `0.13` | `0.3` |
| `0.2 ` | `0.12` | `0.3` |
| `0.1 ` | `0.12` | `0.1 -0.2` |
| branch `main` | `0.12` | `0.1` |

View File

@ -1,4 +1,4 @@
use std::fs::File;
use std::{fs::File, path::Path};
use bevy::log::info;
use bevy_ecs::{
@ -8,14 +8,17 @@ use bevy_ecs::{
use bevy_reflect::{TypeInfo, TypeRegistration, VariantInfo}; // TypePath // DynamicTypePath
use serde_json::{json, Map, Value};
use crate::ExportComponentsConfig;
use crate::{AssetRoot, ExportComponentsConfig};
pub fn export_types(world: &mut World) {
let config = world
.get_resource::<ExportComponentsConfig>()
.expect("ExportComponentsConfig should exist at this stage");
let writer = File::create(&config.save_path).expect("should have created schema file");
let asset_root = world.resource::<AssetRoot>();
let registry_save_path = Path::join(&asset_root.0, &config.save_path);
println!("registry_save_path {}", registry_save_path.display());
let writer = File::create(registry_save_path).expect("should have created schema file");
let types = world.resource_mut::<AppTypeRegistry>();
let types = types.read();

View File

@ -6,6 +6,7 @@ use bevy_ecs::system::Resource;
pub use export_types::*;
use bevy::{
asset::AssetPlugin,
prelude::{App, Plugin},
scene::SceneFilter,
};
@ -29,20 +30,44 @@ pub struct ExportRegistryPlugin {
impl Default for ExportRegistryPlugin {
fn default() -> Self {
Self {
component_filter: SceneFilter::default(), // unused for now
resource_filter: SceneFilter::default(), // unused for now
save_path: PathBuf::from("assets/registry.json"),
component_filter: SceneFilter::default(), // unused for now
resource_filter: SceneFilter::default(), // unused for now
save_path: PathBuf::from("registry.json"), // relative to assets folder
}
}
}
impl Plugin for ExportRegistryPlugin {
fn build(&self, app: &mut App) {
app.insert_resource(ExportComponentsConfig {
save_path: self.save_path.clone(),
component_filter: self.component_filter.clone(),
resource_filter: self.resource_filter.clone(),
})
.add_systems(Startup, export_types);
app.register_asset_root()
.insert_resource(ExportComponentsConfig {
save_path: self.save_path.clone(),
component_filter: self.component_filter.clone(),
resource_filter: self.resource_filter.clone(),
})
.add_systems(Startup, export_types);
}
}
trait RegistryExportApp {
fn register_asset_root(&mut self) -> &mut Self;
}
impl RegistryExportApp for App {
fn register_asset_root(&mut self) -> &mut Self {
let asset_plugin = get_asset_plugin(self);
let path_str = asset_plugin.file_path.clone();
let path = PathBuf::from(path_str);
self.insert_resource(AssetRoot(path))
}
}
fn get_asset_plugin(app: &App) -> &AssetPlugin {
let asset_plugins: Vec<&AssetPlugin> = app.get_added_plugins();
asset_plugins.into_iter().next().expect(ASSET_ERROR)
}
const ASSET_ERROR: &str = "Bevy_registry_export requires access to the Bevy asset plugin. \
Please add `ExportRegistryPlugin` after `AssetPlugin`, which is commonly added as part of the `DefaultPlugins`";
#[derive(Debug, Clone, PartialEq, Eq, Hash, Resource)]
pub(crate) struct AssetRoot(pub(crate) PathBuf);

View File

@ -5,11 +5,8 @@ edition = "2021"
license = "MIT OR Apache-2.0"
[dependencies]
bevy="0.12"
bevy = { version = "0.13", features = ["dynamic_linking"] }
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
bevy_gltf_worlflow_examples_common = { path = "../../common" }
bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
bevy_asset_loader = { version = "0.18", features = ["standard_dynamic_assets" ]}
bevy_editor_pls = { version = "0.6" }
bevy_gltf_worlflow_examples_common_rapier = { path = "../../common_rapier" }
bevy_rapier3d = { version = "0.25.0", features = ["serde-serialize", "debug-render-3d", "enhanced-determinism"] }
rand = "0.8.5"

View File

@ -1,4 +1,6 @@
use bevy_gltf_worlflow_examples_common::{assets::GameAssets, GameState, InAppRunning, Player};
use bevy_gltf_worlflow_examples_common_rapier::{
assets::GameAssets, GameState, InAppRunning, Player,
};
use bevy_rapier3d::prelude::Velocity;
use rand::Rng;
use std::time::Duration;
@ -43,12 +45,12 @@ pub fn setup_game(
}
pub fn spawn_test(
keycode: Res<Input<KeyCode>>,
keycode: Res<ButtonInput<KeyCode>>,
mut commands: Commands,
mut game_world: Query<(Entity, &Children), With<GameWorldTag>>,
) {
if keycode.just_pressed(KeyCode::T) {
if keycode.just_pressed(KeyCode::KeyT) {
let world = game_world.single_mut();
let world = world.1[0];
@ -165,11 +167,11 @@ pub fn animation_control(
mut animation_players: Query<&mut AnimationPlayer>,
keycode: Res<Input<KeyCode>>,
keycode: Res<ButtonInput<KeyCode>>,
// mut entities_with_animations : Query<(&mut AnimationPlayer, &mut Animations)>,
) {
// robots
if keycode.just_pressed(KeyCode::B) {
if keycode.just_pressed(KeyCode::KeyB) {
for (link, animations) in animated_enemies.iter() {
let mut animation_player = animation_players.get_mut(link.0).unwrap();
let anim_name = "Scan";
@ -187,7 +189,7 @@ pub fn animation_control(
}
// foxes
if keycode.just_pressed(KeyCode::W) {
if keycode.just_pressed(KeyCode::KeyW) {
for (link, animations) in animated_foxes.iter() {
let mut animation_player = animation_players.get_mut(link.0).unwrap();
let anim_name = "Walk";
@ -204,7 +206,7 @@ pub fn animation_control(
}
}
if keycode.just_pressed(KeyCode::X) {
if keycode.just_pressed(KeyCode::KeyX) {
for (link, animations) in animated_foxes.iter() {
let mut animation_player = animation_players.get_mut(link.0).unwrap();
let anim_name = "Run";
@ -221,7 +223,7 @@ pub fn animation_control(
}
}
if keycode.just_pressed(KeyCode::C) {
if keycode.just_pressed(KeyCode::KeyC) {
for (link, animations) in animated_foxes.iter() {
let mut animation_player = animation_players.get_mut(link.0).unwrap();
let anim_name = "Survey";

View File

@ -1,8 +1,17 @@
use bevy::prelude::*;
use bevy_gltf_worlflow_examples_common::{AppState, InMainMenu};
use bevy_gltf_worlflow_examples_common_rapier::{AppState, InMainMenu};
pub fn setup_main_menu(mut commands: Commands) {
commands.spawn((Camera2dBundle::default(), InMainMenu));
commands.spawn((
Camera2dBundle {
camera: Camera {
order: 102, // needed because of this: https://github.com/jakobhellermann/bevy_editor_pls/blob/crates/bevy_editor_pls_default_windows/src/cameras/mod.rs#L213C9-L213C28
..default()
},
..Default::default()
},
InMainMenu,
));
commands.spawn((
TextBundle::from_section(
@ -89,22 +98,10 @@ pub fn teardown_main_menu(bla: Query<Entity, With<InMainMenu>>, mut commands: Co
}
pub fn main_menu(
keycode: Res<Input<KeyCode>>,
keycode: Res<ButtonInput<KeyCode>>,
mut next_app_state: ResMut<NextState<AppState>>,
// mut next_game_state: ResMut<NextState<GameState>>,
) {
if keycode.just_pressed(KeyCode::Return) {
if keycode.just_pressed(KeyCode::Enter) {
next_app_state.set(AppState::AppLoading);
// next_game_state.set(GameState::None);
}
if keycode.just_pressed(KeyCode::L) {
next_app_state.set(AppState::AppLoading);
// load_requested_events.send(LoadRequest { path: "toto".into() })
}
if keycode.just_pressed(KeyCode::S) {
// save_requested_events.send(SaveRequest { path: "toto".into() })
}
}

View File

@ -5,7 +5,7 @@ pub mod in_main_menu;
pub use in_main_menu::*;
use bevy::prelude::*;
use bevy_gltf_worlflow_examples_common::{AppState, GameState};
use bevy_gltf_worlflow_examples_common_rapier::{AppState, GameState};
#[derive(Component, Reflect, Default, Debug)]
#[reflect(Component)]

View File

@ -1,6 +1,5 @@
use bevy::prelude::*;
use bevy_editor_pls::prelude::*;
use bevy_gltf_worlflow_examples_common::CommonPlugin;
use bevy_gltf_worlflow_examples_common_rapier::CommonPlugin;
mod core;
use crate::core::*;
@ -15,8 +14,6 @@ fn main() {
App::new()
.add_plugins((
DefaultPlugins.set(AssetPlugin::default()),
// editor
EditorPlugin::default(),
// our custom plugins
CommonPlugin,
CorePlugin, // reusable plugins

View File

@ -5,11 +5,8 @@ edition = "2021"
license = "MIT OR Apache-2.0"
[dependencies]
bevy="0.12"
bevy = { version = "0.13", features = ["dynamic_linking"] }
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
bevy_gltf_worlflow_examples_common = { path = "../../common" }
bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
bevy_asset_loader = { version = "0.18", features = ["standard_dynamic_assets" ]}
bevy_editor_pls = { version = "0.6" }
bevy_gltf_worlflow_examples_common_rapier = { path = "../../common_rapier" }
bevy_rapier3d = { version = "0.25.0", features = ["serde-serialize", "debug-render-3d", "enhanced-determinism"] }
rand = "0.8.5"

View File

@ -1,7 +1,6 @@
use bevy::prelude::*;
use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, GameWorldTag};
use bevy_gltf_worlflow_examples_common::{assets::GameAssets, GameState, InAppRunning};
use bevy_gltf_worlflow_examples_common_rapier::{assets::GameAssets, GameState, InAppRunning};
use bevy_rapier3d::prelude::Velocity;
use rand::Rng;
@ -40,12 +39,12 @@ pub fn setup_game(
struct UnregisteredComponent;
pub fn spawn_test(
keycode: Res<Input<KeyCode>>,
keycode: Res<ButtonInput<KeyCode>>,
mut commands: Commands,
mut game_world: Query<(Entity, &Children), With<GameWorldTag>>,
) {
if keycode.just_pressed(KeyCode::T) {
if keycode.just_pressed(KeyCode::KeyT) {
let world = game_world.single_mut();
let world = world.1[0];
@ -83,12 +82,12 @@ pub fn spawn_test(
}
pub fn spawn_test_unregisted_components(
keycode: Res<Input<KeyCode>>,
keycode: Res<ButtonInput<KeyCode>>,
mut commands: Commands,
mut game_world: Query<(Entity, &Children), With<GameWorldTag>>,
) {
if keycode.just_pressed(KeyCode::U) {
if keycode.just_pressed(KeyCode::KeyU) {
let world = game_world.single_mut();
let world = world.1[0];

View File

@ -1,8 +1,17 @@
use bevy::prelude::*;
use bevy_gltf_worlflow_examples_common::{AppState, InMainMenu};
use bevy_gltf_worlflow_examples_common_rapier::{AppState, InMainMenu};
pub fn setup_main_menu(mut commands: Commands) {
commands.spawn((Camera2dBundle::default(), InMainMenu));
commands.spawn((
Camera2dBundle {
camera: Camera {
order: 102, // needed because of this: https://github.com/jakobhellermann/bevy_editor_pls/blob/crates/bevy_editor_pls_default_windows/src/cameras/mod.rs#L213C9-L213C28
..default()
},
..Default::default()
},
InMainMenu,
));
commands.spawn((
TextBundle::from_section(
@ -89,24 +98,24 @@ pub fn teardown_main_menu(bla: Query<Entity, With<InMainMenu>>, mut commands: Co
}
pub fn main_menu(
keycode: Res<Input<KeyCode>>,
keycode: Res<ButtonInput<KeyCode>>,
mut next_app_state: ResMut<NextState<AppState>>,
// mut next_game_state: ResMut<NextState<GameState>>,
// mut save_requested_events: EventWriter<SaveRequest>,
// mut load_requested_events: EventWriter<LoadRequest>,
) {
if keycode.just_pressed(KeyCode::Return) {
if keycode.just_pressed(KeyCode::Enter) {
next_app_state.set(AppState::AppLoading);
// next_game_state.set(GameState::None);
}
if keycode.just_pressed(KeyCode::L) {
if keycode.just_pressed(KeyCode::KeyL) {
next_app_state.set(AppState::AppLoading);
// load_requested_events.send(LoadRequest { path: "toto".into() })
}
if keycode.just_pressed(KeyCode::S) {
if keycode.just_pressed(KeyCode::KeyS) {
// save_requested_events.send(SaveRequest { path: "toto".into() })
}
}

View File

@ -5,7 +5,7 @@ pub mod in_main_menu;
pub use in_main_menu::*;
use bevy::prelude::*;
use bevy_gltf_worlflow_examples_common::{AppState, GameState};
use bevy_gltf_worlflow_examples_common_rapier::{AppState, GameState};
pub struct GamePlugin;
impl Plugin for GamePlugin {

View File

@ -1,6 +1,5 @@
use bevy::prelude::*;
use bevy_editor_pls::prelude::*;
use bevy_gltf_worlflow_examples_common::CommonPlugin;
use bevy_gltf_worlflow_examples_common_rapier::CommonPlugin;
mod core;
use crate::core::*;
@ -15,8 +14,6 @@ fn main() {
App::new()
.add_plugins((
DefaultPlugins.set(AssetPlugin::default()),
// editor
EditorPlugin::default(),
// our custom plugins
CommonPlugin,
CorePlugin, // reusable plugins

View File

@ -5,11 +5,8 @@ edition = "2021"
license = "MIT OR Apache-2.0"
[dependencies]
bevy="0.12"
bevy = { version = "0.13", features = ["dynamic_linking"] }
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
bevy_gltf_worlflow_examples_common = { path = "../../common" }
bevy_xpbd_3d = "0.3"
bevy_asset_loader = { version = "0.18", features = ["standard_dynamic_assets" ]}
bevy_editor_pls = { version = "0.6" }
rand = "0.8.5"
bevy_gltf_worlflow_examples_common_xpbd = { path = "../../common_xpbd" }
bevy_xpbd_3d = "0.4"
rand = "0.8.5"

View File

@ -1,18 +1,12 @@
pub mod physics;
pub use physics::*;
use bevy::prelude::*;
use bevy_gltf_blueprints::*;
pub struct CorePlugin;
impl Plugin for CorePlugin {
fn build(&self, app: &mut App) {
app.add_plugins((
PhysicsPlugin,
BlueprintsPlugin {
library_folder: "models/library".into(),
..Default::default()
},
));
app.add_plugins((BlueprintsPlugin {
library_folder: "models/library".into(),
..Default::default()
},));
}
}

View File

@ -1,14 +0,0 @@
use bevy::log::info;
use bevy::{prelude::ResMut, time::Time};
use bevy_xpbd_3d::prelude::Physics;
use bevy_xpbd_3d::prelude::*;
pub fn pause_physics(mut time: ResMut<Time<Physics>>) {
info!("pausing physics");
time.pause();
}
pub fn resume_physics(mut time: ResMut<Time<Physics>>) {
info!("unpausing physics");
time.unpause();
}

View File

@ -1,28 +0,0 @@
pub mod physics_replace_proxies;
pub use physics_replace_proxies::*;
pub mod utils;
pub mod controls;
pub use controls::*;
use bevy::prelude::*;
use bevy_xpbd_3d::prelude::*;
use bevy_gltf_blueprints::GltfBlueprintsSet;
use bevy_gltf_worlflow_examples_common::GameState;
pub struct PhysicsPlugin;
impl Plugin for PhysicsPlugin {
fn build(&self, app: &mut App) {
app.add_plugins((PhysicsPlugins::default(), PhysicsDebugPlugin::default()))
.register_type::<AutoAABBCollider>()
.register_type::<physics_replace_proxies::Collider>()
.add_systems(
Update,
physics_replace_proxies.after(GltfBlueprintsSet::AfterSpawn),
)
.add_systems(OnEnter(GameState::InGame), resume_physics)
.add_systems(OnExit(GameState::InGame), pause_physics);
}
}

View File

@ -1,10 +1,7 @@
use bevy::prelude::*;
use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, GameWorldTag};
use bevy_gltf_worlflow_examples_common::{assets::GameAssets, GameState, InAppRunning};
// use bevy_rapier3d::prelude::Velocity;
use bevy_gltf_worlflow_examples_common_xpbd::{assets::GameAssets, GameState, InAppRunning};
use bevy_xpbd_3d::prelude::*;
use rand::Rng;
pub fn setup_game(
@ -13,7 +10,6 @@ pub fn setup_game(
models: Res<Assets<bevy::gltf::Gltf>>,
mut next_game_state: ResMut<NextState<GameState>>,
) {
println!("setting up all stuff");
commands.insert_resource(AmbientLight {
color: Color::WHITE,
brightness: 0.2,
@ -39,12 +35,12 @@ pub fn setup_game(
}
pub fn spawn_test(
keycode: Res<Input<KeyCode>>,
keycode: Res<ButtonInput<KeyCode>>,
mut commands: Commands,
mut game_world: Query<(Entity, &Children), With<GameWorldTag>>,
) {
if keycode.just_pressed(KeyCode::T) {
if keycode.just_pressed(KeyCode::KeyT) {
let world = game_world.single_mut();
let world = world.1[0];

View File

@ -1,8 +1,17 @@
use bevy::prelude::*;
use bevy_gltf_worlflow_examples_common::{AppState, InMainMenu};
use bevy_gltf_worlflow_examples_common_xpbd::{AppState, InMainMenu};
pub fn setup_main_menu(mut commands: Commands) {
commands.spawn((Camera2dBundle::default(), InMainMenu));
commands.spawn((
Camera2dBundle {
camera: Camera {
order: 102, // needed because of this: https://github.com/jakobhellermann/bevy_editor_pls/blob/crates/bevy_editor_pls_default_windows/src/cameras/mod.rs#L213C9-L213C28
..default()
},
..Default::default()
},
InMainMenu,
));
commands.spawn((
TextBundle::from_section(
@ -89,24 +98,10 @@ pub fn teardown_main_menu(bla: Query<Entity, With<InMainMenu>>, mut commands: Co
}
pub fn main_menu(
keycode: Res<Input<KeyCode>>,
keycode: Res<ButtonInput<KeyCode>>,
mut next_app_state: ResMut<NextState<AppState>>,
// mut next_game_state: ResMut<NextState<GameState>>,
// mut save_requested_events: EventWriter<SaveRequest>,
// mut load_requested_events: EventWriter<LoadRequest>,
) {
if keycode.just_pressed(KeyCode::Return) {
if keycode.just_pressed(KeyCode::Enter) {
next_app_state.set(AppState::AppLoading);
// next_game_state.set(GameState::None);
}
if keycode.just_pressed(KeyCode::L) {
next_app_state.set(AppState::AppLoading);
// load_requested_events.send(LoadRequest { path: "toto".into() })
}
if keycode.just_pressed(KeyCode::S) {
// save_requested_events.send(SaveRequest { path: "toto".into() })
}
}

View File

@ -5,7 +5,7 @@ pub mod in_main_menu;
pub use in_main_menu::*;
use bevy::prelude::*;
use bevy_gltf_worlflow_examples_common::{AppState, GameState};
use bevy_gltf_worlflow_examples_common_xpbd::{AppState, GameState};
pub struct GamePlugin;
impl Plugin for GamePlugin {

View File

@ -1,6 +1,5 @@
use bevy::prelude::*;
use bevy_editor_pls::prelude::*;
use bevy_gltf_worlflow_examples_common::CommonPlugin;
use bevy_gltf_worlflow_examples_common_xpbd::CommonPlugin;
mod core;
use crate::core::*;
@ -15,8 +14,6 @@ fn main() {
App::new()
.add_plugins((
DefaultPlugins.set(AssetPlugin::default()),
// editor
EditorPlugin::default(),
// our custom plugins
CommonPlugin,
CorePlugin, // reusable plugins

View File

@ -5,11 +5,8 @@ edition = "2021"
license = "MIT OR Apache-2.0"
[dependencies]
bevy="0.12"
bevy = { version = "0.13", features = ["dynamic_linking"] }
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
bevy_gltf_worlflow_examples_common = { path = "../../common" }
bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
bevy_asset_loader = { version = "0.18", features = ["standard_dynamic_assets" ]}
bevy_editor_pls = { version = "0.6" }
rand = "0.8.5"
bevy_gltf_worlflow_examples_common_rapier = { path = "../../common_rapier" }
bevy_rapier3d = { version = "0.25.0", features = ["serde-serialize", "debug-render-3d", "enhanced-determinism"] }
rand = "0.8.5"

View File

@ -1,6 +1,6 @@
use bevy::prelude::*;
use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, GameWorldTag};
use bevy_gltf_worlflow_examples_common::{assets::GameAssets, GameState, InAppRunning};
use bevy_gltf_worlflow_examples_common_rapier::{assets::GameAssets, GameState, InAppRunning};
use bevy_rapier3d::prelude::Velocity;
use rand::Rng;
@ -11,7 +11,6 @@ pub fn setup_game(
models: Res<Assets<bevy::gltf::Gltf>>,
mut next_game_state: ResMut<NextState<GameState>>,
) {
println!("setting up all stuff");
commands.insert_resource(AmbientLight {
color: Color::WHITE,
brightness: 0.2,
@ -41,12 +40,12 @@ pub fn setup_game(
struct UnregisteredComponent;
pub fn spawn_test(
keycode: Res<Input<KeyCode>>,
keycode: Res<ButtonInput<KeyCode>>,
mut commands: Commands,
mut game_world: Query<(Entity, &Children), With<GameWorldTag>>,
) {
if keycode.just_pressed(KeyCode::T) {
if keycode.just_pressed(KeyCode::KeyT) {
let world = game_world.single_mut();
let world = world.1[0];
@ -66,7 +65,7 @@ pub fn spawn_test(
let new_entity = commands
.spawn((
BluePrintBundle {
blueprint: BlueprintName("Health_Pickup".to_string()),
blueprint: BlueprintName("Watermelon2".to_string()),
..Default::default()
},
bevy::prelude::Name::from(format!("test{}", name_index)),
@ -82,47 +81,3 @@ pub fn spawn_test(
commands.entity(world).add_child(new_entity);
}
}
pub fn spawn_test_unregisted_components(
keycode: Res<Input<KeyCode>>,
mut commands: Commands,
mut game_world: Query<(Entity, &Children), With<GameWorldTag>>,
) {
if keycode.just_pressed(KeyCode::U) {
let world = game_world.single_mut();
let world = world.1[0];
let mut rng = rand::thread_rng();
let range = 5.5;
let x: f32 = rng.gen_range(-range..range);
let y: f32 = rng.gen_range(-range..range);
let mut rng = rand::thread_rng();
let range = 0.8;
let vel_x: f32 = rng.gen_range(-range..range);
let vel_y: f32 = rng.gen_range(2.0..2.5);
let vel_z: f32 = rng.gen_range(-range..range);
let name_index: u64 = rng.gen();
let new_entity = commands
.spawn((
BluePrintBundle {
blueprint: BlueprintName("Health_Pickup".to_string()),
..Default::default()
},
bevy::prelude::Name::from(format!("test{}", name_index)),
// BlueprintName("Health_Pickup".to_string()),
// SpawnHere,
TransformBundle::from_transform(Transform::from_xyz(x, 2.0, y)),
Velocity {
linvel: Vec3::new(vel_x, vel_y, vel_z),
angvel: Vec3::new(0.0, 0.0, 0.0),
},
UnregisteredComponent,
))
.id();
commands.entity(world).add_child(new_entity);
}
}

View File

@ -1,8 +1,17 @@
use bevy::prelude::*;
use bevy_gltf_worlflow_examples_common::{AppState, InMainMenu};
use bevy_gltf_worlflow_examples_common_rapier::{AppState, InMainMenu};
pub fn setup_main_menu(mut commands: Commands) {
commands.spawn((Camera2dBundle::default(), InMainMenu));
commands.spawn((
Camera2dBundle {
camera: Camera {
order: 102, // needed because of this: https://github.com/jakobhellermann/bevy_editor_pls/blob/crates/bevy_editor_pls_default_windows/src/cameras/mod.rs#L213C9-L213C28
..default()
},
..Default::default()
},
InMainMenu,
));
commands.spawn((
TextBundle::from_section(
@ -89,24 +98,10 @@ pub fn teardown_main_menu(bla: Query<Entity, With<InMainMenu>>, mut commands: Co
}
pub fn main_menu(
keycode: Res<Input<KeyCode>>,
keycode: Res<ButtonInput<KeyCode>>,
mut next_app_state: ResMut<NextState<AppState>>,
// mut next_game_state: ResMut<NextState<GameState>>,
// mut save_requested_events: EventWriter<SaveRequest>,
// mut load_requested_events: EventWriter<LoadRequest>,
) {
if keycode.just_pressed(KeyCode::Return) {
if keycode.just_pressed(KeyCode::Enter) {
next_app_state.set(AppState::AppLoading);
// next_game_state.set(GameState::None);
}
if keycode.just_pressed(KeyCode::L) {
next_app_state.set(AppState::AppLoading);
// load_requested_events.send(LoadRequest { path: "toto".into() })
}
if keycode.just_pressed(KeyCode::S) {
// save_requested_events.send(SaveRequest { path: "toto".into() })
}
}

View File

@ -5,18 +5,15 @@ pub mod in_main_menu;
pub use in_main_menu::*;
use bevy::prelude::*;
use bevy_gltf_worlflow_examples_common::{AppState, GameState};
use bevy_gltf_worlflow_examples_common_rapier::{AppState, GameState};
pub struct GamePlugin;
impl Plugin for GamePlugin {
fn build(&self, app: &mut App) {
app.add_systems(
Update,
(spawn_test, spawn_test_unregisted_components).run_if(in_state(GameState::InGame)),
)
.add_systems(OnEnter(AppState::MenuRunning), setup_main_menu)
.add_systems(OnExit(AppState::MenuRunning), teardown_main_menu)
.add_systems(Update, main_menu.run_if(in_state(AppState::MenuRunning)))
.add_systems(OnEnter(AppState::AppRunning), setup_game);
app.add_systems(Update, (spawn_test).run_if(in_state(GameState::InGame)))
.add_systems(OnEnter(AppState::MenuRunning), setup_main_menu)
.add_systems(OnExit(AppState::MenuRunning), teardown_main_menu)
.add_systems(Update, main_menu.run_if(in_state(AppState::MenuRunning)))
.add_systems(OnEnter(AppState::AppRunning), setup_game);
}
}

View File

@ -1,6 +1,5 @@
use bevy::prelude::*;
use bevy_editor_pls::prelude::*;
use bevy_gltf_worlflow_examples_common::CommonPlugin;
use bevy_gltf_worlflow_examples_common_rapier::CommonPlugin;
mod core;
use crate::core::*;
@ -15,8 +14,6 @@ fn main() {
App::new()
.add_plugins((
DefaultPlugins.set(AssetPlugin::default()),
// editor
EditorPlugin::default(),
// our custom plugins
CommonPlugin,
CorePlugin, // reusable plugins

View File

@ -5,11 +5,8 @@ edition = "2021"
license = "MIT OR Apache-2.0"
[dependencies]
bevy="0.12"
bevy = { version = "0.13", features = ["dynamic_linking"] }
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
bevy_gltf_worlflow_examples_common = { path = "../../common" }
bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
bevy_asset_loader = { version = "0.18", features = ["standard_dynamic_assets" ]}
bevy_editor_pls = { version = "0.6" }
rand = "0.8.5"
bevy_gltf_worlflow_examples_common_rapier = { path = "../../common_rapier" }
bevy_rapier3d = { version = "0.25.0", features = ["serde-serialize", "debug-render-3d", "enhanced-determinism"] }
rand = "0.8.5"

View File

@ -1,6 +1,6 @@
use bevy::prelude::*;
use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, GameWorldTag};
use bevy_gltf_worlflow_examples_common::{assets::GameAssets, GameState, InAppRunning};
use bevy_gltf_worlflow_examples_common_rapier::{assets::GameAssets, GameState, InAppRunning};
use bevy_rapier3d::prelude::Velocity;
use rand::Rng;
@ -11,7 +11,6 @@ pub fn setup_game(
models: Res<Assets<bevy::gltf::Gltf>>,
mut next_game_state: ResMut<NextState<GameState>>,
) {
println!("setting up all stuff");
commands.insert_resource(AmbientLight {
color: Color::WHITE,
brightness: 0.2,
@ -41,12 +40,12 @@ pub fn setup_game(
struct UnregisteredComponent;
pub fn spawn_test(
keycode: Res<Input<KeyCode>>,
keycode: Res<ButtonInput<KeyCode>>,
mut commands: Commands,
mut game_world: Query<(Entity, &Children), With<GameWorldTag>>,
) {
if keycode.just_pressed(KeyCode::T) {
if keycode.just_pressed(KeyCode::KeyT) {
let world = game_world.single_mut();
let world = world.1[0];
@ -82,47 +81,3 @@ pub fn spawn_test(
commands.entity(world).add_child(new_entity);
}
}
pub fn spawn_test_unregisted_components(
keycode: Res<Input<KeyCode>>,
mut commands: Commands,
mut game_world: Query<(Entity, &Children), With<GameWorldTag>>,
) {
if keycode.just_pressed(KeyCode::U) {
let world = game_world.single_mut();
let world = world.1[0];
let mut rng = rand::thread_rng();
let range = 5.5;
let x: f32 = rng.gen_range(-range..range);
let y: f32 = rng.gen_range(-range..range);
let mut rng = rand::thread_rng();
let range = 0.8;
let vel_x: f32 = rng.gen_range(-range..range);
let vel_y: f32 = rng.gen_range(2.0..2.5);
let vel_z: f32 = rng.gen_range(-range..range);
let name_index: u64 = rng.gen();
let new_entity = commands
.spawn((
BluePrintBundle {
blueprint: BlueprintName("Health_Pickup".to_string()),
..Default::default()
},
bevy::prelude::Name::from(format!("test{}", name_index)),
// BlueprintName("Health_Pickup".to_string()),
// SpawnHere,
TransformBundle::from_transform(Transform::from_xyz(x, 2.0, y)),
Velocity {
linvel: Vec3::new(vel_x, vel_y, vel_z),
angvel: Vec3::new(0.0, 0.0, 0.0),
},
UnregisteredComponent,
))
.id();
commands.entity(world).add_child(new_entity);
}
}

View File

@ -1,8 +1,17 @@
use bevy::prelude::*;
use bevy_gltf_worlflow_examples_common::{AppState, InMainMenu};
use bevy_gltf_worlflow_examples_common_rapier::{AppState, InMainMenu};
pub fn setup_main_menu(mut commands: Commands) {
commands.spawn((Camera2dBundle::default(), InMainMenu));
commands.spawn((
Camera2dBundle {
camera: Camera {
order: 102, // needed because of this: https://github.com/jakobhellermann/bevy_editor_pls/blob/crates/bevy_editor_pls_default_windows/src/cameras/mod.rs#L213C9-L213C28
..default()
},
..Default::default()
},
InMainMenu,
));
commands.spawn((
TextBundle::from_section(
@ -89,24 +98,10 @@ pub fn teardown_main_menu(bla: Query<Entity, With<InMainMenu>>, mut commands: Co
}
pub fn main_menu(
keycode: Res<Input<KeyCode>>,
keycode: Res<ButtonInput<KeyCode>>,
mut next_app_state: ResMut<NextState<AppState>>,
// mut next_game_state: ResMut<NextState<GameState>>,
// mut save_requested_events: EventWriter<SaveRequest>,
// mut load_requested_events: EventWriter<LoadRequest>,
) {
if keycode.just_pressed(KeyCode::Return) {
if keycode.just_pressed(KeyCode::Enter) {
next_app_state.set(AppState::AppLoading);
// next_game_state.set(GameState::None);
}
if keycode.just_pressed(KeyCode::L) {
next_app_state.set(AppState::AppLoading);
// load_requested_events.send(LoadRequest { path: "toto".into() })
}
if keycode.just_pressed(KeyCode::S) {
// save_requested_events.send(SaveRequest { path: "toto".into() })
}
}

View File

@ -1,6 +1,8 @@
use bevy::{gltf::Gltf, prelude::*};
use bevy_gltf_blueprints::GameWorldTag;
use bevy_gltf_worlflow_examples_common::{assets::GameAssets, GameState, InAppRunning, Player};
use bevy_gltf_worlflow_examples_common_rapier::{
assets::GameAssets, GameState, InAppRunning, Player,
};
use bevy_rapier3d::prelude::*;
#[derive(Component, Reflect, Default, Debug)]

View File

@ -8,16 +8,13 @@ pub mod level_transitions;
pub use level_transitions::*;
use bevy::prelude::*;
use bevy_gltf_worlflow_examples_common::{AppState, GameState};
use bevy_gltf_worlflow_examples_common_rapier::{AppState, GameState};
pub struct GamePlugin;
impl Plugin for GamePlugin {
fn build(&self, app: &mut App) {
app.add_plugins(LevelsPlugin)
.add_systems(
Update,
(spawn_test, spawn_test_unregisted_components).run_if(in_state(GameState::InGame)),
)
.add_systems(Update, (spawn_test).run_if(in_state(GameState::InGame)))
.add_systems(OnEnter(AppState::MenuRunning), setup_main_menu)
.add_systems(OnExit(AppState::MenuRunning), teardown_main_menu)
.add_systems(Update, main_menu.run_if(in_state(AppState::MenuRunning)))

View File

@ -1,6 +1,5 @@
use bevy::prelude::*;
use bevy_editor_pls::prelude::*;
use bevy_gltf_worlflow_examples_common::CommonPlugin;
use bevy_gltf_worlflow_examples_common_rapier::CommonPlugin;
mod core;
use crate::core::*;
@ -15,8 +14,6 @@ fn main() {
App::new()
.add_plugins((
DefaultPlugins.set(AssetPlugin::default()),
// editor
EditorPlugin::default(),
// our custom plugins
CommonPlugin,
CorePlugin, // reusable plugins

View File

@ -5,9 +5,6 @@ edition = "2021"
license = "MIT OR Apache-2.0"
[dependencies]
bevy="0.12"
bevy = { version = "0.13", features = ["dynamic_linking"] }
bevy_gltf_components = { path = "../../../crates/bevy_gltf_components" }
bevy_gltf_worlflow_examples_common = { path = "../../common" }
bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
bevy_editor_pls = { version = "0.6" }
bevy_gltf_worlflow_examples_common_rapier = { path = "../../common_rapier" }

View File

@ -1,7 +1,6 @@
use bevy::{gltf::Gltf, prelude::*};
use bevy_editor_pls::prelude::*;
use bevy_gltf_components::ComponentsFromGltfPlugin;
use bevy_gltf_worlflow_examples_common::CorePlugin;
use bevy_gltf_worlflow_examples_common_rapier::CorePlugin;
mod test_components;
use test_components::*;
@ -61,14 +60,14 @@ fn main() {
.add_plugins((
DefaultPlugins.set(AssetPlugin::default()),
// editor
EditorPlugin::default(),
// EditorPlugin::default(),
// physics
// our custom plugins
ComponentsFromGltfPlugin::default(),
CorePlugin, // reusable plugins
ComponentsTestPlugin, // Showcases different type of components /structs
))
.add_state::<AppState>()
.init_state::<AppState>()
.add_systems(Startup, setup)
.add_systems(Update, (spawn_level.run_if(in_state(AppState::Loading)),))
.run();

View File

@ -5,14 +5,12 @@ edition = "2021"
license = "MIT OR Apache-2.0"
[dependencies]
bevy="0.12"
bevy_gltf_blueprints = "0.7"
bevy = { version = "0.13", features = ["dynamic_linking"] }
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
bevy_gltf_save_load = { path = "../../../crates/bevy_gltf_save_load" }
bevy_gltf_worlflow_examples_common = { path = "../../common" }
bevy_gltf_worlflow_examples_common_rapier = { path = "../../common_rapier" }
bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
bevy_asset_loader = { version = "0.18", features = ["standard_dynamic_assets" ]}
bevy_editor_pls = { version = "0.6" }
rand = "0.8.5"
serde_json="1.0.108"
serde="1.0.193"
serde_json = "1.0.108"
serde = "1.0.193"
bevy_rapier3d = { version = "0.25.0", features = ["serde-serialize", "debug-render-3d", "enhanced-determinism"] }
rand = "0.8.5"

View File

@ -6,7 +6,7 @@ use bevy::{
};
use bevy_gltf_blueprints::*;
use bevy_gltf_save_load::*;
use bevy_gltf_worlflow_examples_common::{CameraTrackingOffset, Pickable};
use bevy_gltf_worlflow_examples_common_rapier::{CameraTrackingOffset, Pickable};
use bevy_rapier3d::dynamics::Velocity;
use std::any::TypeId;

View File

@ -1,7 +1,7 @@
use bevy::prelude::*;
use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, GameWorldTag, Library, NoInBlueprint};
use bevy_gltf_save_load::{Dynamic, DynamicEntitiesRoot, StaticEntitiesRoot};
use bevy_gltf_worlflow_examples_common::{GameState, InAppRunning, Player};
use bevy_gltf_worlflow_examples_common_rapier::{GameState, InAppRunning, Player};
use bevy_rapier3d::prelude::Velocity;
use rand::Rng;
@ -60,16 +60,16 @@ pub fn unload_world(mut commands: Commands, gameworlds: Query<Entity, With<GameW
}
}
pub fn should_reset(keycode: Res<Input<KeyCode>>) -> bool {
keycode.just_pressed(KeyCode::N)
pub fn should_reset(keycode: Res<ButtonInput<KeyCode>>) -> bool {
keycode.just_pressed(KeyCode::KeyN)
}
pub fn spawn_test(
keycode: Res<Input<KeyCode>>,
keycode: Res<ButtonInput<KeyCode>>,
mut dynamic_entities_world: Query<Entity, With<DynamicEntitiesRoot>>,
mut commands: Commands,
) {
if keycode.just_pressed(KeyCode::T) {
if keycode.just_pressed(KeyCode::KeyT) {
let world = dynamic_entities_world.single_mut();
let mut rng = rand::thread_rng();
@ -109,12 +109,12 @@ pub fn spawn_test(
struct UnregisteredComponent;
pub fn spawn_test_unregisted_components(
keycode: Res<Input<KeyCode>>,
keycode: Res<ButtonInput<KeyCode>>,
mut commands: Commands,
mut dynamic_entities_world: Query<Entity, With<DynamicEntitiesRoot>>,
) {
if keycode.just_pressed(KeyCode::U) {
if keycode.just_pressed(KeyCode::KeyU) {
let world = dynamic_entities_world.single_mut();
let mut rng = rand::thread_rng();
@ -152,13 +152,13 @@ pub fn spawn_test_unregisted_components(
}
pub fn spawn_test_parenting(
keycode: Res<Input<KeyCode>>,
keycode: Res<ButtonInput<KeyCode>>,
players: Query<Entity, With<Player>>,
mut commands: Commands,
names: Query<(Entity, &Name)>,
) {
if keycode.just_pressed(KeyCode::P) {
if keycode.just_pressed(KeyCode::KeyP) {
let mut rng = rand::thread_rng();
let range = 5.5;
let x: f32 = rng.gen_range(-range..range);

View File

@ -1,13 +1,11 @@
use bevy::{core_pipeline::clear_color::ClearColorConfig, prelude::*};
use bevy_gltf_worlflow_examples_common::InGameLoading;
use bevy::prelude::*;
use bevy_gltf_worlflow_examples_common_rapier::InGameLoading;
pub fn setup_loading_screen(mut commands: Commands) {
commands.spawn((
Camera2dBundle {
camera_2d: Camera2d {
clear_color: ClearColorConfig::Custom(Color::BLACK),
},
camera: Camera {
clear_color: ClearColorConfig::Custom(Color::BLACK),
// renders after / on top of the main camera
order: 2,
..default()

View File

@ -1,5 +1,5 @@
use bevy::prelude::*;
use bevy_gltf_worlflow_examples_common::InGameSaving;
use bevy_gltf_worlflow_examples_common_rapier::InGameSaving;
pub fn setup_saving_screen(mut commands: Commands) {
commands.spawn((

View File

@ -1,8 +1,17 @@
use bevy::prelude::*;
use bevy_gltf_worlflow_examples_common::{AppState, InMainMenu};
use bevy_gltf_worlflow_examples_common_rapier::{AppState, InMainMenu};
pub fn setup_main_menu(mut commands: Commands) {
commands.spawn((Camera2dBundle::default(), InMainMenu));
commands.spawn((
Camera2dBundle {
camera: Camera {
order: 102, // needed because of this: https://github.com/jakobhellermann/bevy_editor_pls/blob/crates/bevy_editor_pls_default_windows/src/cameras/mod.rs#L213C9-L213C28
..default()
},
..Default::default()
},
InMainMenu,
));
commands.spawn((
TextBundle::from_section(
@ -92,24 +101,14 @@ pub fn teardown_main_menu(in_main_menu: Query<Entity, With<InMainMenu>>, mut com
}
pub fn main_menu(
keycode: Res<Input<KeyCode>>,
keycode: Res<ButtonInput<KeyCode>>,
mut next_app_state: ResMut<NextState<AppState>>,
// mut next_game_state: ResMut<NextState<GameState>>,
// mut save_requested_events: EventWriter<SaveRequest>,
// mut load_requested_events: EventWriter<LoadRequest>,
) {
if keycode.just_pressed(KeyCode::Return) {
if keycode.just_pressed(KeyCode::Enter) {
next_app_state.set(AppState::AppLoading);
// next_game_state.set(GameState::None);
}
if keycode.just_pressed(KeyCode::L) {
if keycode.just_pressed(KeyCode::KeyL) {
next_app_state.set(AppState::AppLoading);
// load_requested_events.send(LoadRequest { path: "toto".into() })
}
if keycode.just_pressed(KeyCode::S) {
// save_requested_events.send(SaveRequest { path: "toto".into() })
}
}

View File

@ -1,5 +1,5 @@
pub mod in_game;
use bevy_gltf_worlflow_examples_common::{AppState, GameState};
use bevy_gltf_worlflow_examples_common_rapier::{AppState, GameState};
pub use in_game::*;
pub mod in_main_menu;
@ -16,19 +16,19 @@ use bevy_gltf_save_load::{LoadRequest, LoadingFinished, SaveRequest, SavingFinis
pub fn request_save(
mut save_requests: EventWriter<SaveRequest>,
keycode: Res<Input<KeyCode>>,
keycode: Res<ButtonInput<KeyCode>>,
current_state: Res<State<GameState>>,
mut next_game_state: ResMut<NextState<GameState>>,
) {
if keycode.just_pressed(KeyCode::S)
if keycode.just_pressed(KeyCode::KeyS)
&& (current_state.get() != &GameState::InLoading)
&& (current_state.get() != &GameState::InSaving)
{
next_game_state.set(GameState::InSaving);
save_requests.send(SaveRequest {
path: "save.scn.ron".into(),
})
});
}
}
@ -43,18 +43,18 @@ pub fn on_saving_finished(
pub fn request_load(
mut load_requests: EventWriter<LoadRequest>,
keycode: Res<Input<KeyCode>>,
keycode: Res<ButtonInput<KeyCode>>,
current_state: Res<State<GameState>>,
mut next_game_state: ResMut<NextState<GameState>>,
) {
if keycode.just_pressed(KeyCode::L)
if keycode.just_pressed(KeyCode::KeyL)
&& (current_state.get() != &GameState::InLoading)
&& (current_state.get() != &GameState::InSaving)
{
next_game_state.set(GameState::InLoading);
load_requests.send(LoadRequest {
path: "save.scn.ron".into(),
})
});
}
}

View File

@ -1,6 +1,5 @@
use bevy::prelude::*;
use bevy_editor_pls::prelude::*;
use bevy_gltf_worlflow_examples_common::CommonPlugin;
use bevy_gltf_worlflow_examples_common_rapier::CommonPlugin;
mod core;
use crate::core::*;
@ -15,8 +14,6 @@ fn main() {
App::new()
.add_plugins((
DefaultPlugins.set(AssetPlugin::default()),
// editor
EditorPlugin::default(),
// our custom plugins
CommonPlugin,
CorePlugin, // reusable plugins

View File

@ -5,12 +5,9 @@ edition = "2021"
license = "MIT OR Apache-2.0"
[dependencies]
bevy="0.12"
bevy = { version = "0.13", features = ["dynamic_linking"] }
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
bevy_registry_export = { path = "../../../crates/bevy_registry_export" }
bevy_gltf_worlflow_examples_common = { path = "../../common" }
bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] }
bevy_asset_loader = { version = "0.18", features = ["standard_dynamic_assets" ]}
bevy_editor_pls = { version = "0.6" }
bevy_gltf_worlflow_examples_common_rapier = { path = "../../common_rapier" }
bevy_rapier3d = { version = "0.25.0", features = ["serde-serialize", "debug-render-3d", "enhanced-determinism"] }
rand = "0.8.5"

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@ impl Plugin for CorePlugin {
fn build(&self, app: &mut App) {
app.add_plugins((
ExportRegistryPlugin {
save_path: "assets/registry.json".into(),
save_path: "registry.json".into(),
..Default::default()
},
BlueprintsPlugin {

View File

@ -1,6 +1,6 @@
use bevy::prelude::*;
use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, GameWorldTag};
use bevy_gltf_worlflow_examples_common::{assets::GameAssets, GameState, InAppRunning};
use bevy_gltf_worlflow_examples_common_rapier::{assets::GameAssets, GameState, InAppRunning};
use bevy_rapier3d::prelude::Velocity;
use rand::Rng;
@ -11,7 +11,6 @@ pub fn setup_game(
models: Res<Assets<bevy::gltf::Gltf>>,
mut next_game_state: ResMut<NextState<GameState>>,
) {
println!("setting up all stuff");
commands.insert_resource(AmbientLight {
color: Color::WHITE,
brightness: 0.2,
@ -41,12 +40,12 @@ pub fn setup_game(
struct UnregisteredComponent;
pub fn spawn_test(
keycode: Res<Input<KeyCode>>,
keycode: Res<ButtonInput<KeyCode>>,
mut commands: Commands,
mut game_world: Query<(Entity, &Children), With<GameWorldTag>>,
) {
if keycode.just_pressed(KeyCode::T) {
if keycode.just_pressed(KeyCode::KeyT) {
let world = game_world.single_mut();
let world = world.1[0];
@ -82,47 +81,3 @@ pub fn spawn_test(
commands.entity(world).add_child(new_entity);
}
}
pub fn spawn_test_unregisted_components(
keycode: Res<Input<KeyCode>>,
mut commands: Commands,
mut game_world: Query<(Entity, &Children), With<GameWorldTag>>,
) {
if keycode.just_pressed(KeyCode::U) {
let world = game_world.single_mut();
let world = world.1[0];
let mut rng = rand::thread_rng();
let range = 5.5;
let x: f32 = rng.gen_range(-range..range);
let y: f32 = rng.gen_range(-range..range);
let mut rng = rand::thread_rng();
let range = 0.8;
let vel_x: f32 = rng.gen_range(-range..range);
let vel_y: f32 = rng.gen_range(2.0..2.5);
let vel_z: f32 = rng.gen_range(-range..range);
let name_index: u64 = rng.gen();
let new_entity = commands
.spawn((
BluePrintBundle {
blueprint: BlueprintName("Health_Pickup".to_string()),
..Default::default()
},
bevy::prelude::Name::from(format!("test{}", name_index)),
// BlueprintName("Health_Pickup".to_string()),
// SpawnHere,
TransformBundle::from_transform(Transform::from_xyz(x, 2.0, y)),
Velocity {
linvel: Vec3::new(vel_x, vel_y, vel_z),
angvel: Vec3::new(0.0, 0.0, 0.0),
},
UnregisteredComponent,
))
.id();
commands.entity(world).add_child(new_entity);
}
}

View File

@ -1,8 +1,17 @@
use bevy::prelude::*;
use bevy_gltf_worlflow_examples_common::{AppState, InMainMenu};
use bevy_gltf_worlflow_examples_common_rapier::{AppState, InMainMenu};
pub fn setup_main_menu(mut commands: Commands) {
commands.spawn((Camera2dBundle::default(), InMainMenu));
commands.spawn((
Camera2dBundle {
camera: Camera {
order: 102, // needed because of this: https://github.com/jakobhellermann/bevy_editor_pls/blob/crates/bevy_editor_pls_default_windows/src/cameras/mod.rs#L213C9-L213C28
..default()
},
..Default::default()
},
InMainMenu,
));
commands.spawn((
TextBundle::from_section(
@ -89,24 +98,10 @@ pub fn teardown_main_menu(bla: Query<Entity, With<InMainMenu>>, mut commands: Co
}
pub fn main_menu(
keycode: Res<Input<KeyCode>>,
keycode: Res<ButtonInput<KeyCode>>,
mut next_app_state: ResMut<NextState<AppState>>,
// mut next_game_state: ResMut<NextState<GameState>>,
// mut save_requested_events: EventWriter<SaveRequest>,
// mut load_requested_events: EventWriter<LoadRequest>,
) {
if keycode.just_pressed(KeyCode::Return) {
if keycode.just_pressed(KeyCode::Enter) {
next_app_state.set(AppState::AppLoading);
// next_game_state.set(GameState::None);
}
if keycode.just_pressed(KeyCode::L) {
next_app_state.set(AppState::AppLoading);
// load_requested_events.send(LoadRequest { path: "toto".into() })
}
if keycode.just_pressed(KeyCode::S) {
// save_requested_events.send(SaveRequest { path: "toto".into() })
}
}

Some files were not shown because too many files have changed in this diff Show More