From 6f93b6e55a54cc3f09f3db61b23f239452a22836 Mon Sep 17 00:00:00 2001 From: "kaosat.dev" Date: Fri, 8 Mar 2024 23:22:20 +0100 Subject: [PATCH] feat(blueprints): experimenting with the bevy side of things --- crates/bevy_gltf_blueprints/src/lib.rs | 4 ++++ crates/bevy_gltf_blueprints/src/spawn_from_blueprints.rs | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/bevy_gltf_blueprints/src/lib.rs b/crates/bevy_gltf_blueprints/src/lib.rs index 366f05f..5f4f89a 100644 --- a/crates/bevy_gltf_blueprints/src/lib.rs +++ b/crates/bevy_gltf_blueprints/src/lib.rs @@ -120,6 +120,10 @@ impl Plugin for BlueprintsPlugin { .register_type::() .register_type::() .register_type::() + .register_type::() + .register_type::>() + .register_type::>>() + .insert_resource(BluePrintsConfig { format: self.format, library_folder: self.library_folder.clone(), diff --git a/crates/bevy_gltf_blueprints/src/spawn_from_blueprints.rs b/crates/bevy_gltf_blueprints/src/spawn_from_blueprints.rs index 3701fa5..c9b03a9 100644 --- a/crates/bevy_gltf_blueprints/src/spawn_from_blueprints.rs +++ b/crates/bevy_gltf_blueprints/src/spawn_from_blueprints.rs @@ -1,6 +1,6 @@ use std::path::{Path, PathBuf}; -use bevy::{gltf::Gltf, prelude::*}; +use bevy::{gltf::Gltf, prelude::*, utils::HashMap}; use crate::{Animations, BluePrintsConfig}; @@ -46,6 +46,11 @@ pub struct AddToGameWorld; /// helper component, just to transfer child data pub(crate) struct OriginalChildren(pub Vec); + +#[derive(Component, Reflect, Default, Debug)] +#[reflect(Component)] +pub struct BlueprintsList(pub HashMap>); + /// main spawning functions, /// * also takes into account the already exisiting "override" components, ie "override components" > components from blueprint pub(crate) fn spawn_from_blueprints(