mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-11-22 11:50:53 +00:00
chore(): minor tweaks & experiments
This commit is contained in:
parent
f25829f8cd
commit
75d7f940ae
@ -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<BlenderToneMapping>>,
|
||||
tonemappings: Query<(Entity, &BlenderToneMapping) , Added<BlenderToneMapping>>,
|
||||
cameras: Query<Entity, With<Camera>>,
|
||||
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::<BlenderToneMapping>();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// FIXME: this logic should not depend on if toneMapping or Cameras where added first
|
||||
fn process_colorgrading(
|
||||
blender_colorgradings: Query<&BlenderColorGrading , Added<BlenderColorGrading>>,
|
||||
blender_colorgradings: Query<(Entity, &BlenderColorGrading) , Added<BlenderColorGrading>>,
|
||||
cameras: Query<Entity, With<Camera>>,
|
||||
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::<ColorGrading>();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -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<alloc::string::String, bevy_example::test_components::EnumComplex, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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<alloc::string::String, bevy_example::test_components::BasicTest, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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<alloc::string::String, bevy_example::test_components::BasicTest, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>": {
|
||||
"isComponent": false,
|
||||
"isResource": false,
|
||||
"keyType": {
|
||||
"type": {
|
||||
"$ref": "#/$defs/alloc::string::String"
|
||||
}
|
||||
},
|
||||
"long_name": "bevy_utils::hashbrown::HashMap<alloc::string::String, bevy_example::test_components::BasicTest, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>",
|
||||
"short_name": "HashMap<String, BasicTest, DefaultHashBuilder>",
|
||||
"type": "object",
|
||||
"typeInfo": "Map",
|
||||
"valueType": {
|
||||
"type": {
|
||||
"$ref": "#/$defs/bevy_example::test_components::BasicTest"
|
||||
}
|
||||
}
|
||||
},
|
||||
"bevy_utils::hashbrown::HashMap<alloc::string::String, bevy_example::test_components::EnumComplex, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>": {
|
||||
"isComponent": false,
|
||||
"isResource": false,
|
||||
"keyType": {
|
||||
"type": {
|
||||
"$ref": "#/$defs/alloc::string::String"
|
||||
}
|
||||
},
|
||||
"long_name": "bevy_utils::hashbrown::HashMap<alloc::string::String, bevy_example::test_components::EnumComplex, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>",
|
||||
"short_name": "HashMap<String, EnumComplex, DefaultHashBuilder>",
|
||||
"type": "object",
|
||||
"typeInfo": "Map",
|
||||
"valueType": {
|
||||
"type": {
|
||||
"$ref": "#/$defs/bevy_example::test_components::EnumComplex"
|
||||
}
|
||||
}
|
||||
},
|
||||
"bevy_utils::hashbrown::HashMap<alloc::string::String, bevy_utils::hashbrown::HashMap<u32, alloc::vec::Vec<alloc::string::String>, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>": {
|
||||
"isComponent": false,
|
||||
"isResource": false,
|
||||
|
@ -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<AssetServ
|
||||
"",
|
||||
TextStyle {
|
||||
color: LinearRgba { red: 1.0, green:0.0, blue: 0.0, alpha: 1.0}.into(),
|
||||
font_size: 10.,
|
||||
font_size: 20.,
|
||||
..default()
|
||||
},
|
||||
)
|
||||
@ -133,12 +133,31 @@ for (id, name, scene_extras, extras, mesh_extras, material_extras) in
|
||||
}
|
||||
}
|
||||
|
||||
fn check_for_component(
|
||||
foo: Query<(Entity, Option<&Name>, &EnumComplex)>,
|
||||
mut display: Query<&mut Text, With<HiearchyDebugTag>>,
|
||||
|
||||
){
|
||||
let mut info_lines: Vec<String> = 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)
|
||||
|
||||
;
|
||||
|
@ -188,6 +188,18 @@ pub struct HashmapTestStringColor {
|
||||
pub inner: HashMap<String, Color>,
|
||||
}
|
||||
|
||||
#[derive(Component, Reflect, Default, Debug)]
|
||||
#[reflect(Component)]
|
||||
pub struct HashmapTestStringEnum {
|
||||
pub inner: HashMap<String, EnumComplex>,
|
||||
}
|
||||
|
||||
#[derive(Component, Reflect, Default, Debug)]
|
||||
#[reflect(Component)]
|
||||
pub struct HashmapTestStringStruct {
|
||||
pub inner: HashMap<String, BasicTest>,
|
||||
}
|
||||
|
||||
#[derive(Component, Reflect, Default, Debug)]
|
||||
#[reflect(Component)]
|
||||
pub struct HashmapTestStringColorFlat(HashMap<String, Color>);
|
||||
@ -259,6 +271,9 @@ impl Plugin for ComponentsTestPlugin {
|
||||
.register_type::<HashMap<String, Color>>()
|
||||
.register_type::<HashmapTestStringColor>()
|
||||
.register_type::<HashmapTestStringColorFlat>()
|
||||
.register_type::<HashmapTestStringEnum>()
|
||||
.register_type::<HashmapTestStringStruct>()
|
||||
|
||||
.register_type::<ComponentAToFilterOut>()
|
||||
.register_type::<ComponentBToFilterOut>()
|
||||
.register_type::<ComponentWithFieldsOfIdenticalType>()
|
||||
|
Loading…
Reference in New Issue
Block a user