WIP loading meshes for prefabs
Some checks failed
CI / Tests (push) Successful in 4m6s
CI / Bevy lints (push) Failing after 4m50s
CI / Clippy lints (push) Failing after 14m16s

This commit is contained in:
2025-07-22 22:56:57 -04:00
parent 6f15c9e9aa
commit 2616e32674
4 changed files with 36 additions and 20 deletions

View File

@@ -1,7 +1,4 @@
use bevy::{
ecs::{component::Component, system::EntityCommands, world::World},
math::Vec3,
};
use bevy::prelude::*;
use serde::{Deserialize, Serialize};
use crate::prefab::{ComponentBuilder, PrefabAsset};
@@ -12,7 +9,7 @@ struct Name {
}
#[typetag::serde]
impl ComponentBuilder for Name {
fn insert(&self, _entity: &mut EntityCommands) {
fn build(&self, _entity: &mut EntityCommands, _: &AssetServer) {
assert_eq!(self.name, "Test".to_string(), "Name");
}
}
@@ -24,7 +21,7 @@ struct Position {
#[typetag::serde]
impl ComponentBuilder for Position {
fn insert(&self, _entity: &mut EntityCommands) {
fn build(&self, _entity: &mut EntityCommands, _: &AssetServer) {
assert_eq!(self.pos, Vec3::X, "Position");
}
}
@@ -38,6 +35,7 @@ fn round_trip_test() {
name: "Test".to_string(),
}),
],
..default()
};
let serialized = ron::to_string(&prefab);
@@ -52,13 +50,4 @@ fn round_trip_test() {
prefab.components.len(),
"Prefab's components count do not match"
);
let mut world = World::new();
let e = world.spawn_empty().id();
let mut commands = world.commands();
let mut ec = commands.entity(e);
for component in loaded_asset.components {
component.insert(&mut ec);
}
}