mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-12-22 23:54:10 +00:00
feat(Blenvy): removed local assets, as they are useless, renamed AllAssets to BlenvyAssets
This commit is contained in:
parent
c162c33575
commit
ed5dfeb3cd
@ -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>);
|
||||
|
||||
|
||||
|
||||
|
@ -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>>>()
|
||||
|
@ -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>
|
||||
>,
|
||||
|
||||
|
||||
|
@ -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>);
|
||||
|
||||
|
||||
|
||||
|
@ -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>()
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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"
|
||||
},
|
||||
|
@ -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 =
|
||||
|
@ -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![];
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user