diff --git a/crates/bevy_gltf_components/src/process_gltfs.rs b/crates/bevy_gltf_components/src/process_gltfs.rs index f2f8e9e..241015f 100644 --- a/crates/bevy_gltf_components/src/process_gltfs.rs +++ b/crates/bevy_gltf_components/src/process_gltfs.rs @@ -31,7 +31,7 @@ pub fn add_components_from_gltf_extras(world: &mut World) { ); let type_registry: &AppTypeRegistry = world.resource(); - let type_registry = type_registry.read(); + let type_registry = type_registry.read(); let reflect_components = ronstring_to_reflect_component(&extra.value, &type_registry); // we assign the components specified /xxx_components objects to their parent node diff --git a/crates/bevy_gltf_components/src/ronstring_to_reflect_component.rs b/crates/bevy_gltf_components/src/ronstring_to_reflect_component.rs index ec81e22..cab89ac 100644 --- a/crates/bevy_gltf_components/src/ronstring_to_reflect_component.rs +++ b/crates/bevy_gltf_components/src/ronstring_to_reflect_component.rs @@ -15,8 +15,6 @@ pub fn ronstring_to_reflect_component( let mut components: Vec<(Box, TypeRegistration)> = Vec::new(); // println!("ron_string {:?}", ron_string); for (name, value) in lookup.into_iter() { - - let parsed_value: String; match value.clone() { Value::String(str) => { @@ -28,24 +26,30 @@ pub fn ronstring_to_reflect_component( if name.as_str() == "bevy_components" { bevy_components_string_to_components(parsed_value, type_registry, &mut components) } else { - components_string_to_components(name, value, parsed_value, type_registry, &mut components) + components_string_to_components( + name, + value, + parsed_value, + type_registry, + &mut components, + ) } } components } fn components_string_to_components( - name: String, + name: String, value: Value, parsed_value: String, type_registry: &TypeRegistry, - components: &mut Vec<(Box, TypeRegistration)> -){ + components: &mut Vec<(Box, TypeRegistration)>, +) { let type_string = name.replace("component: ", "").trim().to_string(); let capitalized_type_name = capitalize_first_letter(type_string.as_str()); if let Some(type_registration) = - type_registry.get_with_short_type_path(capitalized_type_name.as_str()) + type_registry.get_with_short_type_path(capitalized_type_name.as_str()) { debug!("TYPE INFO {:?}", type_registration.type_info()); @@ -87,8 +91,8 @@ fn components_string_to_components( fn bevy_components_string_to_components( parsed_value: String, type_registry: &TypeRegistry, - components: &mut Vec<(Box, TypeRegistration)> -){ + components: &mut Vec<(Box, TypeRegistration)>, +) { let lookup: HashMap = ron::from_str(&parsed_value).unwrap(); for (key, value) in lookup.into_iter() { let parsed_value: String; @@ -99,9 +103,7 @@ fn bevy_components_string_to_components( _ => parsed_value = ron::to_string(&value).unwrap().to_string(), } - if let Some(type_registration) = - type_registry.get_with_type_path(key.as_str()) - { + if let Some(type_registration) = type_registry.get_with_type_path(key.as_str()) { debug!("TYPE INFO {:?}", type_registration.type_info()); let ron_string = format!( @@ -131,4 +133,4 @@ fn bevy_components_string_to_components( warn!("no type registration for {}", key); } } -} \ No newline at end of file +} diff --git a/crates/bevy_registry_export/src/export_types.rs b/crates/bevy_registry_export/src/export_types.rs index 148cca9..7660f62 100644 --- a/crates/bevy_registry_export/src/export_types.rs +++ b/crates/bevy_registry_export/src/export_types.rs @@ -25,10 +25,12 @@ pub fn export_types(world: &mut World) { let types = world.resource_mut::(); let types = types.read(); - let schemas = types.iter() + let schemas = types + .iter() .filter(|type_info| { let type_id = type_info.type_id(); - return components_to_filter_out.is_allowed_by_id(type_id) && resources_to_filter_out.is_allowed_by_id(type_id); + return components_to_filter_out.is_allowed_by_id(type_id) + && resources_to_filter_out.is_allowed_by_id(type_id); }) .map(export_type) .collect::>(); diff --git a/testing/bevy_example/src/test_components.rs b/testing/bevy_example/src/test_components.rs index fee6c63..2eb0656 100644 --- a/testing/bevy_example/src/test_components.rs +++ b/testing/bevy_example/src/test_components.rs @@ -152,7 +152,6 @@ impl MaterialExtension for MyExtension { } } - use bevy::utils::HashMap; #[derive(Component, Reflect, Default, Debug)] @@ -189,7 +188,6 @@ pub struct HashmapTestStringColor { #[reflect(Component)] pub struct HashmapTestStringColorFlat(HashMap); - #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] pub struct ComponentAToFilterOut; @@ -237,17 +235,13 @@ impl Plugin for ComponentsTestPlugin { .register_type::() .register_type::>() .register_type::() - .register_type::>() .register_type::() - .register_type::>() .register_type::() .register_type::() - .register_type::() .register_type::() - .add_plugins(MaterialPlugin::< ExtendedMaterial, >::default());