write to file
This commit is contained in:
parent
7e3350739a
commit
325cea6da7
1 changed files with 13 additions and 1 deletions
|
@ -1,3 +1,5 @@
|
|||
use std::fs::{File, OpenOptions};
|
||||
|
||||
use bevy::prelude::*;
|
||||
use bevy::reflect::{
|
||||
ArrayInfo, EnumInfo, ListInfo, MapInfo, NamedField, OpaqueInfo, SetInfo, StructInfo,
|
||||
|
@ -22,10 +24,20 @@ fn create_registry(config: Res<BevyBlenderConfig>, type_registry: Res<AppTypeReg
|
|||
let filter = &config.type_filter;
|
||||
let types: Vec<RegistryEntry> = type_registry
|
||||
.iter()
|
||||
// TODO: somehow filter by components?
|
||||
//.filter(|t| is_component(t))
|
||||
.filter(|t| filter.is_allowed_by_id(t.type_id()))
|
||||
.map(RegistryEntry::from)
|
||||
.collect();
|
||||
println!("{types:?}");
|
||||
|
||||
if let Ok(file) = File::create(&config.registry_path) {
|
||||
if let Err(e) = serde_json::to_writer(&file, &types) {
|
||||
warn!(
|
||||
"Failed to write registry to {:?}: {e:?}",
|
||||
&config.registry_path
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
|
|
Loading…
Reference in a new issue