From 1891903f030adde306c7d42549bd7b9a5f7f27a4 Mon Sep 17 00:00:00 2001 From: "kaosat.dev" Date: Mon, 18 Mar 2024 14:51:43 +0100 Subject: [PATCH] chore(): docstrings, minor cleanups --- crates/bevy_gltf_blueprints/src/materials.rs | 14 ++++++-------- .../src/spawn_from_blueprints.rs | 16 ++++++++++++---- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/crates/bevy_gltf_blueprints/src/materials.rs b/crates/bevy_gltf_blueprints/src/materials.rs index 030ee90..fe440d4 100644 --- a/crates/bevy_gltf_blueprints/src/materials.rs +++ b/crates/bevy_gltf_blueprints/src/materials.rs @@ -66,14 +66,12 @@ pub(crate) fn materials_inject( } else { let material_file_handle: Handle = asset_server.load(materials_path.clone()); let material_file_id = material_file_handle.id(); - let asset_infos: Vec> = vec![ - AssetLoadTracker { - name: material_full_path, - id: material_file_id, - loaded: false, - handle: material_file_handle.clone(), - } - ]; + let asset_infos: Vec> = vec![AssetLoadTracker { + name: material_full_path, + id: material_file_id, + loaded: false, + handle: material_file_handle.clone(), + }]; commands .entity(entity) diff --git a/crates/bevy_gltf_blueprints/src/spawn_from_blueprints.rs b/crates/bevy_gltf_blueprints/src/spawn_from_blueprints.rs index cf679b7..fe22bea 100644 --- a/crates/bevy_gltf_blueprints/src/spawn_from_blueprints.rs +++ b/crates/bevy_gltf_blueprints/src/spawn_from_blueprints.rs @@ -46,10 +46,12 @@ pub struct AddToGameWorld; /// helper component, just to transfer child data pub(crate) struct OriginalChildren(pub Vec); +/// helper component, is used to store the list of sub blueprints to enable automatic loading of dependend blueprints #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] pub struct BlueprintsList(pub HashMap>); +/// helper component, for tracking loaded assets's loading state, id , handle etc #[derive(Default, Debug)] pub(crate) struct AssetLoadTracker { #[allow(dead_code)] @@ -59,19 +61,25 @@ pub(crate) struct AssetLoadTracker { #[allow(dead_code)] pub handle: Handle, } + +/// helper component, for tracking loaded assets #[derive(Component, Debug)] pub(crate) struct AssetsToLoad { pub all_loaded: bool, pub asset_infos: Vec>, pub progress: f32, } -impl Default for AssetsToLoad { +impl Default for AssetsToLoad { fn default() -> Self { - Self { all_loaded: Default::default(), asset_infos: Default::default(), progress: Default::default() } + Self { + all_loaded: Default::default(), + asset_infos: Default::default(), + progress: Default::default(), + } } } -/// flag component +/// flag component, usually added when a blueprint is loaded #[derive(Component)] pub(crate) struct BlueprintAssetsLoaded; /// flag component @@ -221,7 +229,7 @@ pub(crate) fn spawn_from_blueprints( name, ) in spawn_placeholders.iter() { - info!( + debug!( "attempting to spawn {:?} for entity {:?}, id: {:?}, parent:{:?}", blupeprint_name.0, name, entity, original_parent );