diff --git a/crates/bevy_gltf_blueprints/src/assets.rs b/crates/bevy_gltf_blueprints/src/assets.rs index c57d204..9b1201a 100644 --- a/crates/bevy_gltf_blueprints/src/assets.rs +++ b/crates/bevy_gltf_blueprints/src/assets.rs @@ -20,7 +20,7 @@ pub struct LocalAssets(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 AllAssets(pub Vec); +pub struct BlenvyAssets(pub Vec); diff --git a/crates/bevy_gltf_blueprints/src/lib.rs b/crates/bevy_gltf_blueprints/src/lib.rs index 23f882a..f4a21a0 100644 --- a/crates/bevy_gltf_blueprints/src/lib.rs +++ b/crates/bevy_gltf_blueprints/src/lib.rs @@ -123,7 +123,7 @@ impl Plugin for BlueprintsPlugin { .register_type::>() .register_type::>() .register_type::() - .register_type::() + .register_type::() .register_type::>>() diff --git a/crates/bevy_gltf_blueprints/src/spawn_from_blueprints.rs b/crates/bevy_gltf_blueprints/src/spawn_from_blueprints.rs index f3bd1df..5df7fdc 100644 --- a/crates/bevy_gltf_blueprints/src/spawn_from_blueprints.rs +++ b/crates/bevy_gltf_blueprints/src/spawn_from_blueprints.rs @@ -2,7 +2,7 @@ use std::path::{Path, PathBuf}; use bevy::{gltf::Gltf, prelude::*, utils::hashbrown::HashMap}; -use crate::{AllAssets, AssetsToLoad, AssetLoadTracker, BluePrintsConfig, BlueprintAnimations, BlueprintAssetsLoaded, BlueprintAssetsNotLoaded}; +use crate::{BlenvyAssets, AssetsToLoad, AssetLoadTracker, BluePrintsConfig, BlueprintAnimations, BlueprintAssetsLoaded, BlueprintAssetsNotLoaded}; /// this is a flag component for our levels/game world #[derive(Component)] @@ -76,9 +76,9 @@ pub(crate) fn test_thingy( &BlueprintPath, Option<&Parent>,*/ Option<&Name>, - Option<&AllAssets>, + Option<&BlenvyAssets>, ), - (Added), // Added + (Added), // Added >, diff --git a/crates/blenvy/src/blueprints/assets.rs b/crates/blenvy/src/blueprints/assets.rs index 02f3fe3..f8822c2 100644 --- a/crates/blenvy/src/blueprints/assets.rs +++ b/crates/blenvy/src/blueprints/assets.rs @@ -15,12 +15,7 @@ pub struct MyAsset{ /// 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 LocalAssets(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 AllAssets(pub Vec); +pub struct BlenvyAssets(pub Vec); diff --git a/crates/blenvy/src/blueprints/mod.rs b/crates/blenvy/src/blueprints/mod.rs index 3a52047..18c3fce 100644 --- a/crates/blenvy/src/blueprints/mod.rs +++ b/crates/blenvy/src/blueprints/mod.rs @@ -50,26 +50,6 @@ impl Default for BluePrintBundle { } -#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Default)] -pub enum GltfFormat { - #[default] - GLB, - GLTF, -} - -impl fmt::Display for GltfFormat { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - GltfFormat::GLB => { - write!(f, "glb",) - } - GltfFormat::GLTF => { - write!(f, "gltf") - } - } - } -} - #[derive(Debug, Clone)] /// Plugin for gltf blueprints pub struct BlueprintsPlugin { @@ -112,8 +92,7 @@ impl Plugin for BlueprintsPlugin { .register_type::() .register_type::>() .register_type::>() - .register_type::() - .register_type::() + .register_type::() .add_event::() diff --git a/crates/blenvy/src/blueprints/spawn_from_blueprints.rs b/crates/blenvy/src/blueprints/spawn_from_blueprints.rs index 5d84865..3867efd 100644 --- a/crates/blenvy/src/blueprints/spawn_from_blueprints.rs +++ b/crates/blenvy/src/blueprints/spawn_from_blueprints.rs @@ -2,7 +2,7 @@ use std::path::{Path, PathBuf}; use bevy::{gltf::Gltf, prelude::*, utils::hashbrown::HashMap}; -use crate::{AllAssets, AssetsToLoad, AssetLoadTracker, BlenvyConfig, BlueprintAnimations, BlueprintAssetsLoaded, BlueprintAssetsNotLoaded}; +use crate::{BlenvyAssets, AssetsToLoad, AssetLoadTracker, BlenvyConfig, BlueprintAnimations, BlueprintAssetsLoaded, BlueprintAssetsNotLoaded}; /// this is a flag component for our levels/game world #[derive(Component)] @@ -99,9 +99,9 @@ pub(crate) fn blueprints_prepare_spawn( &BlueprintPath, Option<&Parent>,*/ Option<&Name>, - Option<&AllAssets>, + Option<&BlenvyAssets>, ), - (Added), // Added + (Added), // Added >, @@ -111,7 +111,7 @@ pub(crate) fn blueprints_prepare_spawn( &BlueprintName, &BlueprintPath, Option<&Parent>, - Option<&AllAssets>, + Option<&BlenvyAssets>, ),(Added) >, mut commands: Commands, diff --git a/testing/bevy_example/assets/registry.json b/testing/bevy_example/assets/registry.json index ef98897..25fd5ff 100644 --- a/testing/bevy_example/assets/registry.json +++ b/testing/bevy_example/assets/registry.json @@ -13231,11 +13231,11 @@ "type": "object", "typeInfo": "Struct" }, - "blenvy::blueprints::assets::AllAssets": { + "blenvy::blueprints::assets::BlenvyAssets": { "isComponent": true, "isResource": false, "items": false, - "long_name": "blenvy::blueprints::assets::AllAssets", + "long_name": "blenvy::blueprints::assets::BlenvyAssets", "prefixItems": [ { "type": { @@ -13243,23 +13243,7 @@ } } ], - "short_name": "AllAssets", - "type": "array", - "typeInfo": "TupleStruct" - }, - "blenvy::blueprints::assets::LocalAssets": { - "isComponent": true, - "isResource": false, - "items": false, - "long_name": "blenvy::blueprints::assets::LocalAssets", - "prefixItems": [ - { - "type": { - "$ref": "#/$defs/alloc::vec::Vec" - } - } - ], - "short_name": "LocalAssets", + "short_name": "BlenvyAssets", "type": "array", "typeInfo": "TupleStruct" }, diff --git a/testing/bevy_example/src/game/mod.rs b/testing/bevy_example/src/game/mod.rs index 96cd046..7c8ed52 100644 --- a/testing/bevy_example/src/game/mod.rs +++ b/testing/bevy_example/src/game/mod.rs @@ -7,7 +7,7 @@ pub use animation::*; use std::{collections::HashMap, fs, time::Duration}; use blenvy::{ - AllAssets, BlueprintAnimationPlayerLink, BlueprintEvent, BlueprintName, GltfBlueprintsSet, SceneAnimations + BlenvyAssets, BlueprintAnimationPlayerLink, BlueprintEvent, BlueprintName, GltfBlueprintsSet, SceneAnimations }; use bevy::{ @@ -39,7 +39,7 @@ fn validate_export( scene_animations: Query<(Entity, &SceneAnimations)>, empties_candidates: Query<(Entity, &Name, &GlobalTransform)>, - assets_list: Query<(Entity, &AllAssets)>, + assets_list: Query<(Entity, &BlenvyAssets)>, root: Query<(Entity, &Name, &Children), (Without, With)>, ) { let animations_found = diff --git a/testing/bevy_example/src/hierarchy_debug.rs b/testing/bevy_example/src/hierarchy_debug.rs index 6ec6de1..7ad171c 100644 --- a/testing/bevy_example/src/hierarchy_debug.rs +++ b/testing/bevy_example/src/hierarchy_debug.rs @@ -1,5 +1,5 @@ use bevy::{gltf::{GltfMaterialExtras, GltfMeshExtras, GltfSceneExtras}, prelude::*}; -use blenvy::{AllAssets, BlueprintInstanceReady}; +use blenvy::{BlenvyAssets, BlueprintInstanceReady}; use crate::BasicTest; @@ -32,7 +32,7 @@ pub fn get_descendants( all_children: &Query<&Children>, all_names:&Query<&Name>, root: &Entity, nesting: usize, - to_check: &Query<&BasicTest>//&Query<(&BlueprintInstanceReady, &AllAssets)>, + to_check: &Query<&BasicTest>//&Query<(&BlueprintInstanceReady, &BlenvyAssets)>, ) -> String { @@ -67,7 +67,7 @@ pub fn draw_hierarchy_debug( all_children: Query<&Children>, all_names:Query<&Name>, - to_check: Query<&BasicTest>,//Query<(&BlueprintInstanceReady, &AllAssets)>, + to_check: Query<&BasicTest>,//Query<(&BlueprintInstanceReady, &BlenvyAssets)>, mut display: Query<&mut Text, With>, ){ let mut hierarchy_display: Vec = vec![]; diff --git a/tools/blenvy/TODO.md b/tools/blenvy/TODO.md index 171808b..bd6750b 100644 --- a/tools/blenvy/TODO.md +++ b/tools/blenvy/TODO.md @@ -141,6 +141,7 @@ General issues: - [x] change "assets" tab to "levels"/worlds tab & modify UI accordingly - [ ] add option to 'split out' meshes from blueprints ? - [ ] ie considering meshletts etc , it would make sense to keep blueprints seperate from purely mesh gltfs +- [ ] remove local assets, useless - [x] remove 'export_marked_assets' it should be a default setting - [x] disable/ hide asset editing ui for external assets diff --git a/tools/blenvy/add_ons/auto_export/blueprints/export_blueprints.py b/tools/blenvy/add_ons/auto_export/blueprints/export_blueprints.py index 9cb1d4e..5ffa267 100644 --- a/tools/blenvy/add_ons/auto_export/blueprints/export_blueprints.py +++ b/tools/blenvy/add_ons/auto_export/blueprints/export_blueprints.py @@ -37,8 +37,7 @@ def export_blueprints(blueprints, settings, blueprints_data): all_assets = [] auto_assets = [] - collection["local_assets"] = assets_to_fake_ron([{"name": asset.name, "path": asset.path} for asset in collection.user_assets] + auto_assets) - collection["AllAssets"] = assets_to_fake_ron([{"name": asset.name, "path": asset.path} for asset in collection.user_assets]) #all_assets + [{"name": asset.name, "path": asset.path} for asset in collection.user_assets] + auto_assets) + collection["BlenvyAssets"] = assets_to_fake_ron([{"name": asset.name, "path": asset.path} for asset in collection.user_assets] + auto_assets) #all_assets + [{"name": asset.name, "path": asset.path} for asset in collection.user_assets] + auto_assets) # do the actual export diff --git a/tools/blenvy/add_ons/auto_export/levels/export_main_scenes.py b/tools/blenvy/add_ons/auto_export/levels/export_main_scenes.py index b9d1da2..c76d74b 100644 --- a/tools/blenvy/add_ons/auto_export/levels/export_main_scenes.py +++ b/tools/blenvy/add_ons/auto_export/levels/export_main_scenes.py @@ -78,9 +78,7 @@ def export_main_scene(scene, settings, blueprints_data): materials_exported_path = os.path.join(materials_path, f"{materials_library_name}{export_gltf_extension}") material_assets = [{"name": materials_library_name, "path": materials_exported_path}] # we also add the material library as an asset - - scene["local_assets"] = assets_to_fake_ron([{"name": asset.name, "path": asset.path} for asset in scene.user_assets] + auto_assets + material_assets) - scene["AllAssets"] = assets_to_fake_ron(all_assets + [{"name": asset.name, "path": asset.path} for asset in scene.user_assets] + auto_assets + material_assets) + scene["BlenvyAssets"] = assets_to_fake_ron(all_assets + [{"name": asset.name, "path": asset.path} for asset in scene.user_assets] + auto_assets + material_assets) if export_separate_dynamic_and_static_objects: