diff --git a/crates/blenvy/src/components/blender_settings/lighting.rs b/crates/blenvy/src/components/blender_settings/lighting.rs index 0b44b1a..01312c7 100644 --- a/crates/blenvy/src/components/blender_settings/lighting.rs +++ b/crates/blenvy/src/components/blender_settings/lighting.rs @@ -119,13 +119,13 @@ fn process_background_shader( // FIXME: this logic should not depend on if toneMapping or Cameras where added first fn process_tonemapping( - tonemappings: Query<&BlenderToneMapping , Added>, + tonemappings: Query<(Entity, &BlenderToneMapping) , Added>, cameras: Query>, mut commands: Commands, ){ for entity in cameras.iter(){ - for tone_mapping in tonemappings.iter(){ + for (scene_id, tone_mapping) in tonemappings.iter(){ match tone_mapping { BlenderToneMapping::None => { println!("TONEMAPPING NONE"); @@ -140,19 +140,21 @@ fn process_tonemapping( commands.entity(entity).insert(Tonemapping::BlenderFilmic); } } + commands.entity(scene_id).remove::(); } } + } // FIXME: this logic should not depend on if toneMapping or Cameras where added first fn process_colorgrading( - blender_colorgradings: Query<&BlenderColorGrading , Added>, + blender_colorgradings: Query<(Entity, &BlenderColorGrading) , Added>, cameras: Query>, mut commands: Commands, ){ for entity in cameras.iter(){ - for blender_colorgrading in blender_colorgradings.iter(){ + for (scene_id, blender_colorgrading) in blender_colorgradings.iter(){ commands.entity(entity).insert( ColorGrading{ global: ColorGradingGlobal{ @@ -175,6 +177,8 @@ fn process_colorgrading( ..Default::default() } ); + commands.entity(scene_id).remove::(); + } } } \ No newline at end of file diff --git a/testing/bevy_example/assets/registry.json b/testing/bevy_example/assets/registry.json index b1d8208..6df0ddf 100644 --- a/testing/bevy_example/assets/registry.json +++ b/testing/bevy_example/assets/registry.json @@ -4019,6 +4019,25 @@ "type": "array", "typeInfo": "TupleStruct" }, + "bevy_example::test_components::HashmapTestStringEnum": { + "additionalProperties": false, + "isComponent": true, + "isResource": false, + "long_name": "bevy_example::test_components::HashmapTestStringEnum", + "properties": { + "inner": { + "type": { + "$ref": "#/$defs/bevy_utils::hashbrown::HashMap" + } + } + }, + "required": [ + "inner" + ], + "short_name": "HashmapTestStringEnum", + "type": "object", + "typeInfo": "Struct" + }, "bevy_example::test_components::HashmapTestStringFloat": { "additionalProperties": false, "isComponent": true, @@ -4038,6 +4057,25 @@ "type": "object", "typeInfo": "Struct" }, + "bevy_example::test_components::HashmapTestStringStruct": { + "additionalProperties": false, + "isComponent": true, + "isResource": false, + "long_name": "bevy_example::test_components::HashmapTestStringStruct", + "properties": { + "inner": { + "type": { + "$ref": "#/$defs/bevy_utils::hashbrown::HashMap" + } + } + }, + "required": [ + "inner" + ], + "short_name": "HashmapTestStringStruct", + "type": "object", + "typeInfo": "Struct" + }, "bevy_example::test_components::NestedTupleStuff": { "isComponent": true, "isResource": false, @@ -11880,6 +11918,42 @@ } } }, + "bevy_utils::hashbrown::HashMap": { + "isComponent": false, + "isResource": false, + "keyType": { + "type": { + "$ref": "#/$defs/alloc::string::String" + } + }, + "long_name": "bevy_utils::hashbrown::HashMap", + "short_name": "HashMap", + "type": "object", + "typeInfo": "Map", + "valueType": { + "type": { + "$ref": "#/$defs/bevy_example::test_components::BasicTest" + } + } + }, + "bevy_utils::hashbrown::HashMap": { + "isComponent": false, + "isResource": false, + "keyType": { + "type": { + "$ref": "#/$defs/alloc::string::String" + } + }, + "long_name": "bevy_utils::hashbrown::HashMap", + "short_name": "HashMap", + "type": "object", + "typeInfo": "Map", + "valueType": { + "type": { + "$ref": "#/$defs/bevy_example::test_components::EnumComplex" + } + } + }, "bevy_utils::hashbrown::HashMap, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>": { "isComponent": false, "isResource": false, diff --git a/testing/bevy_example/src/hierarchy_debug.rs b/testing/bevy_example/src/hierarchy_debug.rs index 7962188..9c6dd39 100644 --- a/testing/bevy_example/src/hierarchy_debug.rs +++ b/testing/bevy_example/src/hierarchy_debug.rs @@ -1,7 +1,7 @@ use bevy::{gltf::{GltfMaterialExtras, GltfMeshExtras, GltfSceneExtras}, prelude::*}; use blenvy::{BlueprintAssets, BlueprintInstanceReady}; -use crate::BasicTest; +use crate::{BasicTest, EnumComplex}; #[derive(Component)] pub struct HiearchyDebugTag; @@ -13,7 +13,7 @@ pub fn setup_hierarchy_debug(mut commands: Commands, asset_server: Res, &EnumComplex)>, + mut display: Query<&mut Text, With>, + +){ + let mut info_lines: Vec = vec![]; + for (entiity, name , enum_complex) in foo.iter(){ + let data = format!(" We have a 'EnumComplex' component: {:?} (on {:?})", enum_complex, name); + info_lines.push(data); + println!("yoho component"); + + } + let mut display = display.single_mut(); + display.sections[0].value = info_lines.join("\n"); + +} + + pub struct HiearchyDebugPlugin; impl Plugin for HiearchyDebugPlugin { fn build(&self, app: &mut App) { app .add_systems(Startup, setup_hierarchy_debug) - .add_systems(Update, draw_hierarchy_debug) + .add_systems(Update, check_for_component) + //.add_systems(Update, draw_hierarchy_debug) //.add_systems(Update, check_for_gltf_extras) ; diff --git a/testing/bevy_example/src/test_components.rs b/testing/bevy_example/src/test_components.rs index d398964..47362ff 100644 --- a/testing/bevy_example/src/test_components.rs +++ b/testing/bevy_example/src/test_components.rs @@ -188,6 +188,18 @@ pub struct HashmapTestStringColor { pub inner: HashMap, } +#[derive(Component, Reflect, Default, Debug)] +#[reflect(Component)] +pub struct HashmapTestStringEnum { + pub inner: HashMap, +} + +#[derive(Component, Reflect, Default, Debug)] +#[reflect(Component)] +pub struct HashmapTestStringStruct { + pub inner: HashMap, +} + #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] pub struct HashmapTestStringColorFlat(HashMap); @@ -259,6 +271,9 @@ impl Plugin for ComponentsTestPlugin { .register_type::>() .register_type::() .register_type::() + .register_type::() + .register_type::() + .register_type::() .register_type::() .register_type::()