build.rs: automatically find all scene_*.blend
files
This commit is contained in:
parent
26e5d3456c
commit
2c83b199cb
20
build.rs
20
build.rs
|
@ -9,6 +9,7 @@
|
||||||
// + ▀████████████████████████████████████████████████████▀
|
// + ▀████████████████████████████████████████████████████▀
|
||||||
|
|
||||||
use blend::Blend;
|
use blend::Blend;
|
||||||
|
use std::fs;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
|
|
||||||
|
@ -27,13 +28,18 @@ fn main() -> std::io::Result<()> {
|
||||||
"// DO NOT MODIFY MANUALLY, CHANGES WILL BE OVERWRITTEN!\n"
|
"// DO NOT MODIFY MANUALLY, CHANGES WILL BE OVERWRITTEN!\n"
|
||||||
)?;
|
)?;
|
||||||
write!(&file, "[\n")?;
|
write!(&file, "[\n")?;
|
||||||
extract_scene(&mut file, "test", "src/blender/scene_test.blend")?;
|
|
||||||
extract_scene(&mut file, "workshop", "src/blender/scene_workshop.blend")?;
|
// find all scene_*.blend files and extract+export their scenes
|
||||||
extract_scene(
|
for entry in fs::read_dir("src/blender")? {
|
||||||
&mut file,
|
let path = entry?.path();
|
||||||
"greenhouse",
|
if let Some(file_name) = path.file_name().and_then(|s| s.to_str()) {
|
||||||
"src/blender/scene_greenhouse.blend",
|
if file_name.starts_with("scene_") && file_name.ends_with(".blend") {
|
||||||
)?;
|
let scene_name = &file_name["scene_".len()..file_name.len() - ".blend".len()];
|
||||||
|
|
||||||
|
extract_scene(&mut file, scene_name, path.to_str().unwrap())?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
write!(&file, "]\n")?;
|
write!(&file, "]\n")?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
Loading…
Reference in a new issue