mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-11-22 20:00:53 +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
|
/// helper component, is used to store the list of sub blueprints to enable automatic loading of dependend blueprints
|
||||||
#[derive(Component, Reflect, Default, Debug)]
|
#[derive(Component, Reflect, Default, Debug)]
|
||||||
#[reflect(Component)]
|
#[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<MyAsset>>()
|
||||||
.register_type::<Vec<String>>()
|
.register_type::<Vec<String>>()
|
||||||
.register_type::<LocalAssets>()
|
.register_type::<LocalAssets>()
|
||||||
.register_type::<AllAssets>()
|
.register_type::<BlenvyAssets>()
|
||||||
|
|
||||||
|
|
||||||
.register_type::<HashMap<String, Vec<String>>>()
|
.register_type::<HashMap<String, Vec<String>>>()
|
||||||
|
@ -2,7 +2,7 @@ use std::path::{Path, PathBuf};
|
|||||||
|
|
||||||
use bevy::{gltf::Gltf, prelude::*, utils::hashbrown::HashMap};
|
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
|
/// this is a flag component for our levels/game world
|
||||||
#[derive(Component)]
|
#[derive(Component)]
|
||||||
@ -76,9 +76,9 @@ pub(crate) fn test_thingy(
|
|||||||
&BlueprintPath,
|
&BlueprintPath,
|
||||||
Option<&Parent>,*/
|
Option<&Parent>,*/
|
||||||
Option<&Name>,
|
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
|
/// helper component, is used to store the list of sub blueprints to enable automatic loading of dependend blueprints
|
||||||
#[derive(Component, Reflect, Default, Debug)]
|
#[derive(Component, Reflect, Default, Debug)]
|
||||||
#[reflect(Component)]
|
#[reflect(Component)]
|
||||||
pub struct LocalAssets(pub Vec<MyAsset>);
|
pub struct BlenvyAssets(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>);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -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)]
|
#[derive(Debug, Clone)]
|
||||||
/// Plugin for gltf blueprints
|
/// Plugin for gltf blueprints
|
||||||
pub struct BlueprintsPlugin {
|
pub struct BlueprintsPlugin {
|
||||||
@ -112,8 +92,7 @@ impl Plugin for BlueprintsPlugin {
|
|||||||
.register_type::<MyAsset>()
|
.register_type::<MyAsset>()
|
||||||
.register_type::<Vec<MyAsset>>()
|
.register_type::<Vec<MyAsset>>()
|
||||||
.register_type::<Vec<String>>()
|
.register_type::<Vec<String>>()
|
||||||
.register_type::<LocalAssets>()
|
.register_type::<BlenvyAssets>()
|
||||||
.register_type::<AllAssets>()
|
|
||||||
|
|
||||||
.add_event::<BlueprintEvent>()
|
.add_event::<BlueprintEvent>()
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ use std::path::{Path, PathBuf};
|
|||||||
|
|
||||||
use bevy::{gltf::Gltf, prelude::*, utils::hashbrown::HashMap};
|
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
|
/// this is a flag component for our levels/game world
|
||||||
#[derive(Component)]
|
#[derive(Component)]
|
||||||
@ -99,9 +99,9 @@ pub(crate) fn blueprints_prepare_spawn(
|
|||||||
&BlueprintPath,
|
&BlueprintPath,
|
||||||
Option<&Parent>,*/
|
Option<&Parent>,*/
|
||||||
Option<&Name>,
|
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,
|
&BlueprintName,
|
||||||
&BlueprintPath,
|
&BlueprintPath,
|
||||||
Option<&Parent>,
|
Option<&Parent>,
|
||||||
Option<&AllAssets>,
|
Option<&BlenvyAssets>,
|
||||||
),(Added<BlueprintPath>)
|
),(Added<BlueprintPath>)
|
||||||
>,
|
>,
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
|
@ -13231,11 +13231,11 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"typeInfo": "Struct"
|
"typeInfo": "Struct"
|
||||||
},
|
},
|
||||||
"blenvy::blueprints::assets::AllAssets": {
|
"blenvy::blueprints::assets::BlenvyAssets": {
|
||||||
"isComponent": true,
|
"isComponent": true,
|
||||||
"isResource": false,
|
"isResource": false,
|
||||||
"items": false,
|
"items": false,
|
||||||
"long_name": "blenvy::blueprints::assets::AllAssets",
|
"long_name": "blenvy::blueprints::assets::BlenvyAssets",
|
||||||
"prefixItems": [
|
"prefixItems": [
|
||||||
{
|
{
|
||||||
"type": {
|
"type": {
|
||||||
@ -13243,23 +13243,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"short_name": "AllAssets",
|
"short_name": "BlenvyAssets",
|
||||||
"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",
|
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"typeInfo": "TupleStruct"
|
"typeInfo": "TupleStruct"
|
||||||
},
|
},
|
||||||
|
@ -7,7 +7,7 @@ pub use animation::*;
|
|||||||
use std::{collections::HashMap, fs, time::Duration};
|
use std::{collections::HashMap, fs, time::Duration};
|
||||||
|
|
||||||
use blenvy::{
|
use blenvy::{
|
||||||
AllAssets, BlueprintAnimationPlayerLink, BlueprintEvent, BlueprintName, GltfBlueprintsSet, SceneAnimations
|
BlenvyAssets, BlueprintAnimationPlayerLink, BlueprintEvent, BlueprintName, GltfBlueprintsSet, SceneAnimations
|
||||||
};
|
};
|
||||||
|
|
||||||
use bevy::{
|
use bevy::{
|
||||||
@ -39,7 +39,7 @@ fn validate_export(
|
|||||||
scene_animations: Query<(Entity, &SceneAnimations)>,
|
scene_animations: Query<(Entity, &SceneAnimations)>,
|
||||||
empties_candidates: Query<(Entity, &Name, &GlobalTransform)>,
|
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>)>,
|
root: Query<(Entity, &Name, &Children), (Without<Parent>, With<Children>)>,
|
||||||
) {
|
) {
|
||||||
let animations_found =
|
let animations_found =
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use bevy::{gltf::{GltfMaterialExtras, GltfMeshExtras, GltfSceneExtras}, prelude::*};
|
use bevy::{gltf::{GltfMaterialExtras, GltfMeshExtras, GltfSceneExtras}, prelude::*};
|
||||||
use blenvy::{AllAssets, BlueprintInstanceReady};
|
use blenvy::{BlenvyAssets, BlueprintInstanceReady};
|
||||||
|
|
||||||
use crate::BasicTest;
|
use crate::BasicTest;
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ pub fn get_descendants(
|
|||||||
all_children: &Query<&Children>,
|
all_children: &Query<&Children>,
|
||||||
all_names:&Query<&Name>, root: &Entity,
|
all_names:&Query<&Name>, root: &Entity,
|
||||||
nesting: usize,
|
nesting: usize,
|
||||||
to_check: &Query<&BasicTest>//&Query<(&BlueprintInstanceReady, &AllAssets)>,
|
to_check: &Query<&BasicTest>//&Query<(&BlueprintInstanceReady, &BlenvyAssets)>,
|
||||||
)
|
)
|
||||||
-> String
|
-> String
|
||||||
{
|
{
|
||||||
@ -67,7 +67,7 @@ pub fn draw_hierarchy_debug(
|
|||||||
all_children: Query<&Children>,
|
all_children: Query<&Children>,
|
||||||
all_names:Query<&Name>,
|
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>>,
|
mut display: Query<&mut Text, With<HiearchyDebugTag>>,
|
||||||
){
|
){
|
||||||
let mut hierarchy_display: Vec<String> = vec![];
|
let mut hierarchy_display: Vec<String> = vec![];
|
||||||
|
@ -141,6 +141,7 @@ General issues:
|
|||||||
- [x] change "assets" tab to "levels"/worlds tab & modify UI accordingly
|
- [x] change "assets" tab to "levels"/worlds tab & modify UI accordingly
|
||||||
- [ ] add option to 'split out' meshes from blueprints ?
|
- [ ] add option to 'split out' meshes from blueprints ?
|
||||||
- [ ] ie considering meshletts etc , it would make sense to keep blueprints seperate from purely mesh gltfs
|
- [ ] 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] remove 'export_marked_assets' it should be a default setting
|
||||||
- [x] disable/ hide asset editing ui for external assets
|
- [x] disable/ hide asset editing ui for external assets
|
||||||
|
@ -37,8 +37,7 @@ def export_blueprints(blueprints, settings, blueprints_data):
|
|||||||
|
|
||||||
all_assets = []
|
all_assets = []
|
||||||
auto_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["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)
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
# do the actual export
|
# 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}")
|
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
|
material_assets = [{"name": materials_library_name, "path": materials_exported_path}] # we also add the material library as an asset
|
||||||
|
|
||||||
|
scene["BlenvyAssets"] = assets_to_fake_ron(all_assets + [{"name": asset.name, "path": asset.path} for asset in scene.user_assets] + auto_assets + material_assets)
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
if export_separate_dynamic_and_static_objects:
|
if export_separate_dynamic_and_static_objects:
|
||||||
|
Loading…
Reference in New Issue
Block a user