feat(Blenvy): removed local assets, as they are useless, renamed AllAssets to BlenvyAssets

This commit is contained in:
kaosat.dev 2024-06-22 13:58:05 +02:00
parent c162c33575
commit ed5dfeb3cd
12 changed files with 22 additions and 66 deletions

View File

@ -20,7 +20,7 @@ pub struct LocalAssets(pub Vec<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 AllAssets(pub Vec<MyAsset>);
pub struct BlenvyAssets(pub Vec<MyAsset>);

View File

@ -123,7 +123,7 @@ impl Plugin for BlueprintsPlugin {
.register_type::<Vec<MyAsset>>()
.register_type::<Vec<String>>()
.register_type::<LocalAssets>()
.register_type::<AllAssets>()
.register_type::<BlenvyAssets>()
.register_type::<HashMap<String, Vec<String>>>()

View File

@ -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<AllAssets>), // Added<AllAssets>
(Added<BlenvyAssets>), // Added<BlenvyAssets>
>,

View File

@ -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<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 AllAssets(pub Vec<MyAsset>);
pub struct BlenvyAssets(pub Vec<MyAsset>);

View File

@ -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::<MyAsset>()
.register_type::<Vec<MyAsset>>()
.register_type::<Vec<String>>()
.register_type::<LocalAssets>()
.register_type::<AllAssets>()
.register_type::<BlenvyAssets>()
.add_event::<BlueprintEvent>()

View File

@ -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<AllAssets>), // Added<AllAssets>
(Added<BlenvyAssets>), // Added<BlenvyAssets>
>,
@ -111,7 +111,7 @@ pub(crate) fn blueprints_prepare_spawn(
&BlueprintName,
&BlueprintPath,
Option<&Parent>,
Option<&AllAssets>,
Option<&BlenvyAssets>,
),(Added<BlueprintPath>)
>,
mut commands: Commands,

View File

@ -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<blenvy::blueprints::assets::MyAsset>"
}
}
],
"short_name": "LocalAssets",
"short_name": "BlenvyAssets",
"type": "array",
"typeInfo": "TupleStruct"
},

View File

@ -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<Parent>, With<Children>)>,
) {
let animations_found =

View File

@ -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<HiearchyDebugTag>>,
){
let mut hierarchy_display: Vec<String> = vec![];

View File

@ -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

View File

@ -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

View File

@ -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: