diff --git a/crates/blenvy/README.md b/crates/blenvy/README.md index 000f05b..f586818 100644 --- a/crates/blenvy/README.md +++ b/crates/blenvy/README.md @@ -13,7 +13,7 @@ this crate adds the ability to define Blueprints/Prefabs for [Bevy](https://bevy A blueprint is a set of **overrideable** components + a hierarchy: ie * just a Gltf file with Gltf_extras specifying components - * a component called BlueprintName + * a component called BlueprintInfo Particularly useful when using [Blender](https://www.blender.org/) as an editor for the [Bevy](https://bevyengine.org/) game engine, combined with the Blender add-on that do a lot of the work for you - [blenvy](https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/tools/blenvy) @@ -51,7 +51,7 @@ fn spawn_blueprint( ){ if keycode.just_pressed(KeyCode::S) { let new_entity = commands.spawn(( - BlueprintName("Health_Pickup".to_string()), // mandatory !! + BlueprintInfo(name: "Health_Pickup".to_string(), path:""), // mandatory !! SpawnHere, // mandatory !! TransformBundle::from_transform(Transform::from_xyz(x, 2.0, y)), // VERY important !! // any other component you want to insert @@ -114,7 +114,7 @@ fn main() { You can spawn entities from blueprints like this: ```rust no_run commands.spawn(( - BlueprintName("Health_Pickup".to_string()), // mandatory !! + BlueprintInfo("Health_Pickup".to_string()), // mandatory !! SpawnHere, // mandatory !! TransformBundle::from_transform(Transform::from_xyz(x, 2.0, y)), // optional @@ -134,7 +134,7 @@ you can just add any additional components you need when spawning : ```rust no_run commands.spawn(( - BlueprintName("Health_Pickup".to_string()), + BlueprintInfo("Health_Pickup".to_string()), SpawnHere, TransformBundle::from_transform(Transform::from_xyz(x, 2.0, y)), // from Rapier/bevy_xpbd: this means the entity will also have a velocity component when inserted into the world @@ -152,7 +152,7 @@ any component you specify when spawning the Blueprint that is also specified **w for example ```rust no_run commands.spawn(( - BlueprintName("Health_Pickup".to_string()), + BlueprintInfo("Health_Pickup".to_string()), SpawnHere, TransformBundle::from_transform(Transform::from_xyz(x, 2.0, y)), HealthPowerUp(20)// if this is component is also present inside the "Health_Pickup" blueprint, that one will be replaced with this component during spawning @@ -163,7 +163,7 @@ commands.spawn(( ### BluePrintBundle There is also a ```BluePrintBundle``` for convenience , which just has - * a ```BlueprintName``` component + * a ```BlueprintInfo``` component * a ```SpawnHere``` component ## Additional information @@ -178,7 +178,7 @@ commands .spawn(( Name::from("test"), BluePrintBundle { - blueprint: BlueprintName("TestBlueprint".to_string()), + blueprint: BlueprintInfo("TestBlueprint".to_string()), ..Default::default() }, Library("models".into()) // now the path to the blueprint above will be /assets/models/TestBlueprint.glb diff --git a/crates/blenvy/src/blueprints/assets.rs b/crates/blenvy/src/blueprints/assets.rs index 93125b9..3ca2627 100644 --- a/crates/blenvy/src/blueprints/assets.rs +++ b/crates/blenvy/src/blueprints/assets.rs @@ -16,7 +16,22 @@ 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, Deserialize)] #[reflect(Component)] -pub struct BlenvyAssets(pub Vec); +pub struct BlenvyAssets { + /// only this field should get filled in from the Blender side + pub assets: Vec, + /// set to default when deserializing + #[serde(default)] + #[reflect(default)] + pub loaded: bool, + /// set to default when deserializing + #[serde(default)] + #[reflect(default)] + pub progress: f32, + #[reflect(ignore)] + #[serde(skip)] + pub asset_infos: Vec, +} +//(pub Vec); @@ -30,7 +45,7 @@ pub(crate) struct BlueprintAssetsLoaded; pub(crate) struct BlueprintAssetsNotLoaded; /// helper component, for tracking loaded assets's loading state, id , handle etc -#[derive(Debug)] +#[derive(Debug, Reflect)] pub(crate) struct AssetLoadTracker { #[allow(dead_code)] pub name: String, diff --git a/crates/blenvy/src/blueprints/mod.rs b/crates/blenvy/src/blueprints/mod.rs index 18c3fce..a765381 100644 --- a/crates/blenvy/src/blueprints/mod.rs +++ b/crates/blenvy/src/blueprints/mod.rs @@ -35,15 +35,13 @@ pub enum GltfBlueprintsSet { #[derive(Bundle)] pub struct BluePrintBundle { - pub blueprint: BlueprintName, - pub blueprint_path: BlueprintPath, + pub blueprint: BlueprintInfo, pub spawn_here: SpawnHere, } impl Default for BluePrintBundle { fn default() -> Self { BluePrintBundle { - blueprint: BlueprintName("default".into()), - blueprint_path: BlueprintPath("".into()), + blueprint: BlueprintInfo{ name: "default".into(), path:"".into()}, spawn_here: SpawnHere, } } @@ -76,8 +74,7 @@ fn aabbs_enabled(blenvy_config: Res) -> bool { impl Plugin for BlueprintsPlugin { fn build(&self, app: &mut App) { app - .register_type::() - .register_type::() + .register_type::() .register_type::() .register_type::() .register_type::() diff --git a/crates/blenvy/src/blueprints/spawn_from_blueprints.rs b/crates/blenvy/src/blueprints/spawn_from_blueprints.rs index 96d0103..afa8a82 100644 --- a/crates/blenvy/src/blueprints/spawn_from_blueprints.rs +++ b/crates/blenvy/src/blueprints/spawn_from_blueprints.rs @@ -9,23 +9,12 @@ use crate::{BlenvyAssets, BlenvyAssetsLoadState, AssetLoadTracker, BlenvyConfig, #[derive(Component)] pub struct GameWorldTag; -/// Main component for the blueprints -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub struct BlueprintName(pub String); - -/// path component for the blueprints -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub struct BlueprintPath(pub String); - - /// Main component for the blueprints /// has both name & path of the blueprint to enable injecting the data from the correct blueprint /// into the entity that contains this component #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -pub struct BlueprintInfo{ +pub struct BlueprintInfo { pub name: String, pub path: String, } @@ -100,67 +89,35 @@ pub enum BlueprintEvent { use gltf::Gltf as RawGltf; pub(crate) fn blueprints_prepare_spawn( - spawn_placeholders: Query< - ( - Entity, - &BlueprintPath, - ), - (Added, Without, Without)>, - - // before 0.14 we have to use a seperate query, after migrating we can query at the root level - entities_with_assets: Query< - ( - Entity, - /*&BlueprintName, - &BlueprintPath, - Option<&Parent>,*/ - Option<&Name>, - Option<&BlenvyAssets>, - ), - (Added), // Added - >, - - blueprint_instances_to_spawn : Query< ( Entity, - &BlueprintName, - &BlueprintPath, + &BlueprintInfo, Option<&Parent>, Option<&BlenvyAssets>, - ),(Added) + ),(Added) >, mut commands: Commands, asset_server: Res, ) { - for (entity, blueprint_path) in spawn_placeholders.iter() { - println!("added blueprint_path {:?}", blueprint_path); - /*commands.entity(entity).insert( - SceneBundle { - scene: asset_server.load(format!("{}#Scene0", &blueprint_path.0)), // "levels/World.glb#Scene0"), - ..default() - }, - );*/ - // let model_handle: Handle = asset_server.load(model_path.clone()); - } - - for (entity, blueprint_name, blueprint_path, parent, all_assets) in blueprint_instances_to_spawn.iter() { - println!("Detected blueprint to spawn {:?} {:?}", blueprint_name, blueprint_path); + + for (entity, blueprint_info, parent, all_assets) in blueprint_instances_to_spawn.iter() { + println!("Detected blueprint to spawn {:?} {:?}", blueprint_info.name, blueprint_info.path); println!("all assets {:?}", all_assets); ////////////// // we add the asset of the blueprint itself // TODO: add detection of already loaded data - let untyped_handle = asset_server.load_untyped(&blueprint_path.0); + let untyped_handle = asset_server.load_untyped(&blueprint_info.path); let asset_id = untyped_handle.id(); let loaded = asset_server.is_loaded_with_dependencies(asset_id); let mut asset_infos: Vec = vec![]; if !loaded { asset_infos.push(AssetLoadTracker { - name: blueprint_name.0.clone(), + name: blueprint_info.name.clone(), id: asset_id, loaded: false, handle: untyped_handle.clone(), @@ -169,7 +126,7 @@ asset_server: Res, // and we also add all its assets /* prefetch attempt */ - let gltf = RawGltf::open(format!("assets/{}", blueprint_path.0)).unwrap();// RawGltf::open("examples/Box.gltf")?; + let gltf = RawGltf::open(format!("assets/{}", blueprint_info.path)).unwrap();// RawGltf::open("examples/Box.gltf")?; for scene in gltf.scenes() { let foo_extras = scene.extras().clone().unwrap(); @@ -184,7 +141,7 @@ asset_server: Res, let all_assets: BlenvyAssets = ron::from_str(&assets_raw.as_str().unwrap()).unwrap(); println!("all_assets {:?}", all_assets); - for asset in all_assets.0.iter() { + for asset in all_assets.assets.iter() { let untyped_handle = asset_server.load_untyped(&asset.path); //println!("untyped handle {:?}", untyped_handle); //asset_server.load(asset.path); @@ -222,7 +179,7 @@ asset_server: Res, pub(crate) fn blueprints_check_assets_loading( mut blueprint_assets_to_load: Query< - (Entity, Option<&Name>, &BlueprintPath, &mut BlenvyAssetsLoadState), + (Entity, Option<&Name>, &BlueprintInfo, &mut BlenvyAssetsLoadState), With, >, asset_server: Res, @@ -230,7 +187,7 @@ pub(crate) fn blueprints_check_assets_loading( mut blueprint_events: EventWriter, ) { - for (entity, entity_name, blueprint_path, mut assets_to_load) in blueprint_assets_to_load.iter_mut() { + for (entity, entity_name, blueprint_info, mut assets_to_load) in blueprint_assets_to_load.iter_mut() { let mut all_loaded = true; let mut loaded_amount = 0; let total = assets_to_load.asset_infos.len(); @@ -259,8 +216,8 @@ pub(crate) fn blueprints_check_assets_loading( if all_loaded { assets_to_load.all_loaded = true; - println!("LOADING: in progress for ALL assets of {:?} (instance of {}), preparing for spawn", entity_name, blueprint_path.0); - blueprint_events.send(BlueprintEvent::AssetsLoaded {blueprint_name:"".into(), blueprint_path: blueprint_path.0.clone() }); + println!("LOADING: in progress for ALL assets of {:?} (instance of {}), preparing for spawn", entity_name, blueprint_info.path); + blueprint_events.send(BlueprintEvent::AssetsLoaded {blueprint_name:"".into(), blueprint_path: blueprint_info.path.clone() }); commands .entity(entity) @@ -269,7 +226,7 @@ pub(crate) fn blueprints_check_assets_loading( .remove::() ; }else { - println!("LOADING: done for ALL assets of {:?} (instance of {}): {} ",entity_name, blueprint_path.0, progress * 100.0); + println!("LOADING: done for ALL assets of {:?} (instance of {}): {} ",entity_name, blueprint_info.path, progress * 100.0); } } } @@ -280,8 +237,7 @@ pub(crate) fn blueprints_spawn( spawn_placeholders: Query< ( Entity, - &BlueprintName, - &BlueprintPath, + &BlueprintInfo, Option<&Transform>, Option<&Parent>, Option<&AddToGameWorld>, @@ -303,8 +259,7 @@ pub(crate) fn blueprints_spawn( ) { for ( entity, - blupeprint_name, - blueprint_path, + blueprint_info, transform, original_parent, add_to_world, @@ -313,16 +268,16 @@ pub(crate) fn blueprints_spawn( { info!( "all assets loaded, attempting to spawn blueprint {:?} for entity {:?}, id: {:?}, parent:{:?}", - blupeprint_name.0, name, entity, original_parent + blueprint_info.name, name, entity, original_parent ); // info!("attempting to spawn {:?}", model_path); - let model_handle: Handle = asset_server.load(blueprint_path.0.clone()); // FIXME: kinda weird now + let model_handle: Handle = asset_server.load(blueprint_info.path.clone()); // FIXME: kinda weird now let gltf = assets_gltf.get(&model_handle).unwrap_or_else(|| { panic!( "gltf file {:?} should have been loaded", - &blueprint_path.0 + &blueprint_info.path ) }); diff --git a/crates/blenvy/src/blueprints/spawn_post_process.rs b/crates/blenvy/src/blueprints/spawn_post_process.rs index b216e37..0bc30bf 100644 --- a/crates/blenvy/src/blueprints/spawn_post_process.rs +++ b/crates/blenvy/src/blueprints/spawn_post_process.rs @@ -5,7 +5,7 @@ use bevy::prelude::*; use bevy::scene::SceneInstance; // use bevy::utils::hashbrown::HashSet; -use crate::{BlueprintAnimationPlayerLink, BlueprintAnimations, BlueprintPath}; +use crate::{BlueprintAnimationPlayerLink, BlueprintAnimations, BlueprintInfo}; use crate::{SpawnHere, Spawned}; use crate::{ BlenvyAssetsLoadState, BlueprintAssetsLoaded, BlueprintEvent, CopyComponents, InBlueprint, NoInBlueprint, OriginalChildren @@ -28,7 +28,7 @@ pub(crate) fn spawned_blueprint_post_process( &BlueprintAnimations, Option<&NoInBlueprint>, Option<&Name>, - &BlueprintPath + &BlueprintInfo ), (With, With, With), >, @@ -39,7 +39,7 @@ pub(crate) fn spawned_blueprint_post_process( mut blueprint_events: EventWriter, ) { - for (original, children, original_children, animations, no_inblueprint, name, blueprint_path) in + for (original, children, original_children, animations, no_inblueprint, name, blueprint_info) in unprocessed_entities.iter() { info!("post processing blueprint for entity {:?}", name); @@ -103,7 +103,7 @@ pub(crate) fn spawned_blueprint_post_process( //commands.entity(original).remove::(); commands.entity(root_entity).despawn_recursive(); - blueprint_events.send(BlueprintEvent::Spawned {blueprint_name:"".into(), blueprint_path: blueprint_path.0.clone() }); + blueprint_events.send(BlueprintEvent::Spawned {blueprint_name: blueprint_info.name.clone(), blueprint_path: blueprint_info.path.clone() }); debug!("DONE WITH POST PROCESS"); } diff --git a/testing/bevy_example/src/game/in_game.rs b/testing/bevy_example/src/game/in_game.rs index c3c017c..9ecc56a 100644 --- a/testing/bevy_example/src/game/in_game.rs +++ b/testing/bevy_example/src/game/in_game.rs @@ -1,6 +1,5 @@ use bevy::prelude::*; -// use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, BlueprintPath, GameWorldTag}; -use blenvy::{BluePrintBundle, BlueprintName, BlueprintPath, GameWorldTag, SpawnHere}; +use blenvy::{BluePrintBundle, BlueprintInfo, GameWorldTag, SpawnHere}; use crate::{GameState, InAppRunning}; //use bevy_rapier3d::prelude::Velocity; @@ -23,8 +22,7 @@ pub fn setup_game( ));*/ commands.spawn(( - BlueprintName("World".into()), - BlueprintPath("levels/World.glb".into()), + BlueprintInfo{name: "World".into(), path: "levels/World.glb".into()}, bevy::prelude::Name::from("world"), //FIXME: not really needed ? could be infered from blueprint's name/ path SpawnHere, GameWorldTag, @@ -64,11 +62,10 @@ pub fn spawn_test( let new_entity = commands .spawn(( BluePrintBundle { - blueprint: BlueprintName("Health_Pickup".to_string()), + blueprint: BlueprintInfo{name: "Health_Pickup".into() , path:"foo/bar.glb".into()}, // FIXME ..Default::default() }, bevy::prelude::Name::from(format!("test{}", name_index)), - // BlueprintName("Health_Pickup".to_string()), // SpawnHere, TransformBundle::from_transform(Transform::from_xyz(x, 2.0, y)), /*Velocity { diff --git a/testing/bevy_example/src/game/mod.rs b/testing/bevy_example/src/game/mod.rs index 7c8ed52..7ec724a 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::{ - BlenvyAssets, BlueprintAnimationPlayerLink, BlueprintEvent, BlueprintName, GltfBlueprintsSet, SceneAnimations + BlenvyAssets, BlueprintAnimationPlayerLink, BlueprintEvent, BlueprintInfo, GltfBlueprintsSet, SceneAnimations }; use bevy::{ @@ -25,7 +25,7 @@ fn start_game(mut next_app_state: ResMut>) { } // if the export from Blender worked correctly, we should have animations (simplified here by using AnimationPlayerLink) -// if the export from Blender worked correctly, we should have an Entity called "Blueprint4_nested" that has a child called "Blueprint3" that has a "BlueprintName" component with value Blueprint3 +// if the export from Blender worked correctly, we should have an Entity called "Blueprint4_nested" that has a child called "Blueprint3" that has a "BlueprintInfo" component with value Blueprint3 // if the export from Blender worked correctly, we should have an assets_list // if the export from Blender worked correctly, we should have the correct tree of entities #[allow(clippy::too_many_arguments)] @@ -34,7 +34,7 @@ fn validate_export( parents: Query<&Parent>, children: Query<&Children>, names: Query<&Name>, - blueprints: Query<(Entity, &Name, &BlueprintName)>, + blueprints: Query<(Entity, &Name, &BlueprintInfo)>, animation_player_links: Query<(Entity, &BlueprintAnimationPlayerLink)>, scene_animations: Query<(Entity, &SceneAnimations)>, empties_candidates: Query<(Entity, &Name, &GlobalTransform)>, @@ -46,13 +46,13 @@ fn validate_export( !animation_player_links.is_empty() && scene_animations.into_iter().len() == 4; let mut nested_blueprint_found = false; - for (entity, name, blueprint_name) in blueprints.iter() { - if name.to_string() == *"Blueprint4_nested" && blueprint_name.0 == *"Blueprint4_nested" { + for (entity, name, blueprint_info) in blueprints.iter() { + if name.to_string() == *"Blueprint4_nested" && blueprint_info.name == *"Blueprint4_nested" { if let Ok(cur_children) = children.get(entity) { for child in cur_children.iter() { - if let Ok((_, child_name, child_blueprint_name)) = blueprints.get(*child) { + if let Ok((_, child_name, child_blueprint_info)) = blueprints.get(*child) { if child_name.to_string() == *"Blueprint3" - && child_blueprint_name.0 == *"Blueprint3" + && child_blueprint_info.name == *"Blueprint3" { nested_blueprint_found = true; } diff --git a/tools/blenvy/README_auto_export.md b/tools/blenvy/README_auto_export.md index fb577bd..d3a3869 100644 --- a/tools/blenvy/README_auto_export.md +++ b/tools/blenvy/README_auto_export.md @@ -133,7 +133,7 @@ This issue has been resolved in v0.9. You can enable this option to automatically replace all the **collection instances** inside your main scene with blueprints - whenever you change your main scene (or your library scene , if that option is enabled), all your collection instances * will be replaced with empties (this will not be visible to you) - * those empties will have additional custom properties / components : ```BlueprintName``` & ```SpawnHere``` + * those empties will have additional custom properties / components : ```BlueprintInfo``` & ```SpawnHere``` * your main scene/ level will be exported to a much more trimmed down gltf file (see next point) * all the original collections (that you used to create the instances) will be exported as **seperate gltf files** into the "library" folder diff --git a/tools/blenvy/TODO.md b/tools/blenvy/TODO.md index 8617551..b7b273e 100644 --- a/tools/blenvy/TODO.md +++ b/tools/blenvy/TODO.md @@ -153,8 +153,8 @@ General issues: - [ ] scan for used materials per blueprint ! - [ ] for scenes, scan for used materials of all non instance objects (TODO: what about overrides ?) - [ ] find a solution for the new color handling -- [ ] add back lighting_components -- [ ] check if scene components are being deleted through our scene re-orgs in the spawn post process +- [x] add back lighting_components +- [x] check if scene components are being deleted through our scene re-orgs in the spawn post process - [ ] should "blueprint spawned" only be triggered after all its sub blueprints have spawned ? - [ ] simplify testing example: @@ -171,6 +171,11 @@ General issues: - [ ] rename repo to "Blenvy" - [ ] do a deprecation release of all bevy_gltf_xxx crates to point at the new Blenvy crate - [ ] hidden objects/collections not respected at export !!! +- [ ] add a way of overriding assets for collection instances + - [ ] add a way of visualizing per blueprint instances +- [ ] cleanup all the spurious debug messages +- [ ] deprecate BlueprintName & BlueprintPath & use BlueprintInfo instead +- [ ] fix animation handling clear && pytest -svv --blender-template ../../testing/bevy_example/art/testing_library.blend --blender-executable /home/ckaos/tools/blender/blender-4.1.0-linux-x64/blender tests/test_bevy_integration_prepare.py && pytest -svv --blender-executable /home/ckaos/tools/blender/blender-4.1.0-linux-x64/blender tests/test_bevy_integration.py \ No newline at end of file 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 4f28c69..10e2a4c 100644 --- a/tools/blenvy/add_ons/auto_export/blueprints/export_blueprints.py +++ b/tools/blenvy/add_ons/auto_export/blueprints/export_blueprints.py @@ -10,7 +10,11 @@ def assets_to_fake_ron(list_like): result = [] for item in list_like: result.append(f"(name: \"{item['name']}\", path: \"{item['path']}\")") - return f"({result})".replace("'", '')#.join(", ") + + return f"(assets: {result})".replace("'", '') + + return f"({result})".replace("'", '') + def export_blueprints(blueprints, settings, blueprints_data): blueprints_path_full = getattr(settings, "blueprints_path_full") diff --git a/tools/blenvy/add_ons/auto_export/common/duplicate_object.py b/tools/blenvy/add_ons/auto_export/common/duplicate_object.py index 87a2bac..5bfefc9 100644 --- a/tools/blenvy/add_ons/auto_export/common/duplicate_object.py +++ b/tools/blenvy/add_ons/auto_export/common/duplicate_object.py @@ -97,10 +97,9 @@ def duplicate_object(object, parent, combine_mode, destination_collection, bluep object.name = original_name + "____bak" empty_obj = make_empty(original_name, object.location, object.rotation_euler, object.scale, destination_collection) - """we inject the collection/blueprint name, as a component called 'BlueprintName', but we only do this in the empty, not the original object""" - empty_obj['BlueprintName'] = f'("{blueprint_name}")' - empty_obj["BlueprintPath"] = f'("{blueprint_path}")' + """we inject the collection/blueprint name & path, as a component called 'BlueprintInfo', but we only do this in the empty, not the original object""" empty_obj['SpawnHere'] = '()' + empty_obj['BlueprintInfo'] = f'(name: "{blueprint_name}", path: "{blueprint_path}")' # we copy custom properties over from our original object to our empty for component_name, component_value in object.items(): diff --git a/tools/blenvy/add_ons/auto_export/common/to_remove_later.py b/tools/blenvy/add_ons/auto_export/common/to_remove_later.py index f9bd4c7..4357aae 100644 --- a/tools/blenvy/add_ons/auto_export/common/to_remove_later.py +++ b/tools/blenvy/add_ons/auto_export/common/to_remove_later.py @@ -64,7 +64,7 @@ class ExampleExtensionProperties(bpy.types.PropertyGroup): # blueprint settings auto_export_blueprints: BoolProperty( name='Export Blueprints', - description='Replaces collection instances with an Empty with a BlueprintName custom property', + description='Replaces collection instances with an Empty with a BlueprintInfo custom property', default=True ) auto_export_blueprints_path: StringProperty( 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 e6c6bea..22eab4f 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 @@ -14,7 +14,10 @@ def assets_to_fake_ron(list_like): result = [] for item in list_like: result.append(f"(name: \"{item['name']}\", path: \"{item['path']}\")") - return f"({result})".replace("'", '')#.join(", ") + + return f"(assets: {result})".replace("'", '') + + return f"({result})".replace("'", '') def export_main_scene(scene, settings, blueprints_data): diff --git a/tools/blenvy/add_ons/auto_export/settings.py b/tools/blenvy/add_ons/auto_export/settings.py index f2ccea2..dd6cfdb 100644 --- a/tools/blenvy/add_ons/auto_export/settings.py +++ b/tools/blenvy/add_ons/auto_export/settings.py @@ -59,7 +59,7 @@ class AutoExportSettings(PropertyGroup): # blueprint settings export_blueprints: BoolProperty( name='Export Blueprints', - description='Replaces collection instances with an Empty with a BlueprintName custom property, and enabled a lot more features !', + description='Replaces collection instances with an Empty with a BlueprintInfo custom property, and enabled a lot more features !', default=True, update=save_settings ) # type: ignore diff --git a/tools/blenvy/tests/expected_component_values.py b/tools/blenvy/tests/expected_component_values.py index 88ec17f..84c7b1f 100644 --- a/tools/blenvy/tests/expected_component_values.py +++ b/tools/blenvy/tests/expected_component_values.py @@ -88,7 +88,6 @@ expected_custom_property_values = {'bevy_animation::AnimationPlayer': '(animatio 'bevy_gltf_blueprints::animation::BlueprintAnimations': '(named_animations: "")', 'bevy_gltf_blueprints::animation::SceneAnimations': '(named_animations: "")', 'bevy_gltf_blueprints::materials::MaterialInfo': '(name: " ", source: " ")', - 'bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName': '(" ")', 'bevy_gltf_blueprints::spawn_from_blueprints::BlueprintsList': '({})', 'bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere': '()', 'bevy_gltf_components::GltfProcessed': '()', @@ -347,7 +346,6 @@ expected_custom_property_values_randomized = {'bevy_animation::AnimationPlayer': 'bevy_gltf_blueprints::animation::BlueprintAnimations': '(named_animations: "")', 'bevy_gltf_blueprints::animation::SceneAnimations': '(named_animations: "")', 'bevy_gltf_blueprints::materials::MaterialInfo': '(name: "sbnpsago", source: "piuzfbqp")', - 'bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName': '("sbnpsago")', 'bevy_gltf_blueprints::spawn_from_blueprints::BlueprintsList': '({})', 'bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere': '()', 'bevy_gltf_components::GltfProcessed': '()',