not working. saving my place until assets v2 gets implemented

main
Elijah Voigt 2 years ago
parent a40958f0bb
commit 0167d158b5

@ -0,0 +1,18 @@
Level(
epochs: [
Epoch(
id: 1,
scene: (
resources: [],
entities: [],
),
),
Epoch(
id: 2,
scene: (
resources: [],
entities: [],
),
),
],
)

@ -281,7 +281,7 @@ impl AssetLoader for LevelAssetLoader {
bytes: &'a [u8],
load_context: &'a mut LoadContext,
) -> BoxedFuture<'a, Result<(), bevy::asset::Error>> {
Box::pin(async move { Ok(load_level(bytes, load_context).await?) })
Box::pin(async move { Ok(load_level(bytes, load_context).await) })
}
fn extensions(&self) -> &[&str] {
@ -290,13 +290,12 @@ impl AssetLoader for LevelAssetLoader {
}
// ref: https://github.com/bevyengine/bevy/blob/12c6fa7e591545afe8c7101b0f021121eea7272f/crates/bevy_gltf/src/loader.rs#L92
pub async fn load_level<'a, 'b>(
bytes: &'a [u8],
load_context: &'a mut LoadContext<'b>,
) -> Handle<Level> {
pub async fn load_level<'a, 'b>(bytes: &'a [u8], load_context: &'a mut LoadContext<'b>) {
let level: Level = ron::de::from_bytes(bytes).expect("Deserialize level");
info!("Level: {:?}", level);
let scene = SceneLoader::from_world(&mut World::new())
let mut world = World::new();
world.insert_resource(AppTypeRegistry { ..default() });
let scene = SceneLoader::from_world(&mut world)
.load(bytes, load_context)
.await;
info!("Scene result: {:?}", scene);

@ -1,4 +1,4 @@
use bevy::reflect::TypeUuid;
use bevy::reflect::{TypePath, TypeUuid};
use crate::editor::prelude::*;
@ -12,11 +12,13 @@ impl Plugin for EditorTimelinePlugin {
}
}
#[derive(Debug, Component, Resource, Clone, Default, Reflect, TypeUuid, Deserialize)]
#[derive(
Debug, Component, Resource, Clone, Default, TypeUuid, Deserialize, TypePath, FromReflect,
)]
#[uuid = "959f5f02-7c80-4b3d-ad02-9dc2e5d1b963"]
pub struct Epoch {
id: usize,
// scene: Handle<DynamicScene>,
scene: DynamicScene,
}
/// Timeline widget marker

Loading…
Cancel
Save