Upgrade to bevy 0.14

attempt/001
Elijah C. Voigt 1 year ago
parent 07bbbfa25b
commit 21e67e04ca

971
Cargo.lock generated

File diff suppressed because it is too large Load Diff

@ -4,9 +4,9 @@ version = "0.1.0"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
bevy = { version = "0.13", features = ["file_watcher", "dynamic_linking"] } bevy = { version = "0.14", features = ["file_watcher", "dynamic_linking"] }
wee_alloc = "*" wee_alloc = "*"
bevy_mod_picking = "0.18" bevy_mod_picking = "0.20"
thiserror = "1" thiserror = "1"
nom = "7" nom = "7"
# Entity Uuid parsing # Entity Uuid parsing

@ -107,7 +107,7 @@ fn init_editor(mut commands: Commands) {
TextBundle::from_section( TextBundle::from_section(
"Welcome to the editor", "Welcome to the editor",
TextStyle { TextStyle {
color: Color::WHITE, color: WHITE.into(),
..default() ..default()
}, },
), ),
@ -170,19 +170,19 @@ fn plane_gizmos(mut gizmos: Gizmos) {
(start..=end).for_each(|n| { (start..=end).for_each(|n| {
{ {
let offset = Vec3::Z * (n as f32); let offset = Vec3::Z * (n as f32);
gizmos.line(Vec3::NEG_X * r + offset, Vec3::X * r + offset, Color::GRAY); gizmos.line(Vec3::NEG_X * r + offset, Vec3::X * r + offset, GRAY);
} }
{ {
let offset = Vec3::X * (n as f32); let offset = Vec3::X * (n as f32);
gizmos.line(Vec3::NEG_Z * r + offset, Vec3::Z * r + offset, Color::GRAY); gizmos.line(Vec3::NEG_Z * r + offset, Vec3::Z * r + offset, GRAY);
} }
}); });
// World origin arrows // World origin arrows
{ {
gizmos.arrow(Vec3::ZERO, Vec3::X, Color::RED); gizmos.arrow(Vec3::ZERO, Vec3::X, RED);
gizmos.arrow(Vec3::ZERO, Vec3::Y, Color::DARK_GREEN); gizmos.arrow(Vec3::ZERO, Vec3::Y, DARK_GREEN);
gizmos.arrow(Vec3::ZERO, Vec3::Z, Color::BLUE); gizmos.arrow(Vec3::ZERO, Vec3::Z, BLUE);
} }
} }

@ -4,7 +4,7 @@ pub(crate) struct MenuPlugin;
impl Plugin for MenuPlugin { impl Plugin for MenuPlugin {
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {
// app.add_systems(Startup, init_menu); app.add_systems(Startup, init_menu);
} }
} }

@ -1,23 +1,26 @@
pub(crate) use bevy::app::AppExit; pub(crate) use bevy::{
pub(crate) use bevy::asset::AsyncReadExt; app::AppExit,
pub(crate) use bevy::asset::{io::Reader, AssetLoader, LoadContext}; asset::{io::Reader, AssetLoader, LoadContext, AsyncReadExt},
pub(crate) use bevy::input::common_conditions::input_just_pressed; color::palettes::css::{WHITE, GRAY, RED, DARK_GREEN, BLUE},
pub(crate) use bevy::prelude::*; gltf::Gltf,
pub(crate) use bevy::render::camera::RenderTarget; input::common_conditions::input_just_pressed,
pub(crate) use bevy::utils::Uuid; math::Vec3A,
pub(crate) use bevy::utils::{thiserror::Error, BoxedFuture}; prelude::*,
pub(crate) use bevy::window::PrimaryWindow; render::camera::RenderTarget,
pub(crate) use bevy::window::WindowCloseRequested; window::{WindowRef, WindowCloseRequested, PrimaryWindow},
pub(crate) use bevy::window::WindowRef; };
pub(crate) use nom::bytes::complete::tag; pub(crate) use nom::{
pub(crate) use nom::character::complete::space1; IResult,
pub(crate) use nom::bytes::complete::take_until1; bytes::complete::{tag, take_until1},
pub(crate) use nom::number::complete::float; character::complete::space1,
pub(crate) use nom::sequence::tuple; number::complete::float,
pub(crate) use bevy::{gltf::Gltf, math::Vec3A}; sequence::tuple,
pub(crate) use nom::IResult; };
pub(crate) use uuid::Uuid;
pub(crate) use thiserror::Error;
pub(crate) use crate::{
pub(crate) use crate::camera::*; camera::*,
pub(crate) use crate::conditions::*; conditions::*,
pub(crate) use crate::save::*; save::*,
};

@ -275,19 +275,18 @@ impl AssetLoader for SaveEntityLoader {
type Settings = (); type Settings = ();
type Error = SaveEntityLoaderError; type Error = SaveEntityLoaderError;
fn load<'a>( async fn load<'a>(
&'a self, &'a self,
reader: &'a mut Reader, reader: &'a mut Reader<'_>,
_settings: &'a (), _settings: &'a (),
load_context: &'a mut LoadContext, load_context: &'a mut LoadContext<'_>,
) -> BoxedFuture<'a, Result<Self::Asset, Self::Error>> { ) -> Result<Self::Asset, Self::Error> {
Box::pin(async move { let mut bytes = Vec::new();
let mut bytes = Vec::new(); reader.read_to_end(&mut bytes).await?;
reader.read_to_end(&mut bytes).await?;
let s = std::str::from_utf8(bytes.as_slice()).unwrap();
let s = std::str::from_utf8(bytes.as_slice()).unwrap(); let save_entity = SaveEntity::parse(s, load_context)?;
Ok(SaveEntity::parse(s, load_context)?) Ok(save_entity)
})
} }
fn extensions(&self) -> &[&str] { fn extensions(&self) -> &[&str] {
@ -357,7 +356,7 @@ fn check_loaded_entity_assets(
if let Some((gltf_handle, scene_name)) = &saved.model { if let Some((gltf_handle, scene_name)) = &saved.model {
// Find scene and update // Find scene and update
let gltf = gltfs.get(gltf_handle).unwrap(); let gltf = gltfs.get(gltf_handle).unwrap();
let scene_handle = gltf.named_scenes.get(scene_name).unwrap(); let scene_handle = gltf.named_scenes.get(scene_name.as_str().into()).unwrap();
e.insert(scene_handle.clone()); e.insert(scene_handle.clone());
} else { } else {
e.remove::<Handle<Scene>>(); e.remove::<Handle<Scene>>();

@ -36,6 +36,6 @@ fn handle_window_close(
.filter_map(|WindowCloseRequested { window }| primary.get(*window).ok()) .filter_map(|WindowCloseRequested { window }| primary.get(*window).ok())
// If this was the primary window, send an AppExit // If this was the primary window, send an AppExit
.for_each(|_| { .for_each(|_| {
exit.send(AppExit); exit.send(AppExit::Success);
}); });
} }

Loading…
Cancel
Save