mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-12-23 08:04:10 +00:00
chore(clippy): minor tweaks
This commit is contained in:
parent
f561112704
commit
00bf63cbd3
@ -62,14 +62,9 @@ pub enum GltfComponentsSet {
|
||||
#[derive(Clone, Resource)]
|
||||
pub struct GltfComponentsConfig {}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct ComponentsFromGltfPlugin {}
|
||||
|
||||
impl Default for ComponentsFromGltfPlugin {
|
||||
fn default() -> Self {
|
||||
Self {}
|
||||
}
|
||||
}
|
||||
|
||||
impl Plugin for ComponentsFromGltfPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_plugins(blender_settings::plugin)
|
||||
|
@ -15,16 +15,15 @@ pub fn ronstring_to_reflect_component(
|
||||
let mut components: Vec<(Box<dyn Reflect>, TypeRegistration)> = Vec::new();
|
||||
// println!("ron_string {:?}", ron_string);
|
||||
for (name, value) in lookup.into_iter() {
|
||||
let parsed_value: String;
|
||||
match value.clone() {
|
||||
let parsed_value: String = match value.clone() {
|
||||
Value::String(str) => {
|
||||
parsed_value = str;
|
||||
str
|
||||
}
|
||||
_ => parsed_value = ron::to_string(&value).unwrap().to_string(),
|
||||
}
|
||||
_ => ron::to_string(&value).unwrap().to_string(),
|
||||
};
|
||||
|
||||
if name.as_str() == "bevy_components" {
|
||||
bevy_components_string_to_components(parsed_value, type_registry, &mut components)
|
||||
bevy_components_string_to_components(parsed_value, type_registry, &mut components);
|
||||
} else {
|
||||
components_string_to_components(
|
||||
name,
|
||||
@ -32,7 +31,7 @@ pub fn ronstring_to_reflect_component(
|
||||
parsed_value,
|
||||
type_registry,
|
||||
&mut components,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
components
|
||||
@ -95,13 +94,12 @@ fn bevy_components_string_to_components(
|
||||
) {
|
||||
let lookup: HashMap<String, Value> = ron::from_str(&parsed_value).unwrap();
|
||||
for (key, value) in lookup.into_iter() {
|
||||
let parsed_value: String;
|
||||
match value.clone() {
|
||||
let parsed_value: String = match value.clone() {
|
||||
Value::String(str) => {
|
||||
parsed_value = str;
|
||||
str
|
||||
}
|
||||
_ => parsed_value = ron::to_string(&value).unwrap().to_string(),
|
||||
}
|
||||
_ => ron::to_string(&value).unwrap().to_string(),
|
||||
};
|
||||
|
||||
if let Some(type_registration) = type_registry.get_with_type_path(key.as_str()) {
|
||||
debug!("TYPE INFO {:?}", type_registration.type_info());
|
||||
|
@ -17,7 +17,6 @@ pub fn export_types(world: &mut World) {
|
||||
|
||||
let asset_root = world.resource::<AssetRoot>();
|
||||
let registry_save_path = Path::join(&asset_root.0, &config.save_path);
|
||||
println!("registry_save_path {}", registry_save_path.display());
|
||||
let writer = File::create(registry_save_path).expect("should have created schema file");
|
||||
|
||||
let components_to_filter_out = &config.component_filter.clone();
|
||||
@ -29,8 +28,8 @@ pub fn export_types(world: &mut World) {
|
||||
.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);
|
||||
components_to_filter_out.is_allowed_by_id(type_id)
|
||||
&& resources_to_filter_out.is_allowed_by_id(type_id)
|
||||
})
|
||||
.map(export_type)
|
||||
.collect::<Map<_, _>>();
|
||||
|
Loading…
Reference in New Issue
Block a user