// ▄████████▄ + ███ + ▄█████████ ███ + // ███▀ ▀███ + + ███ ███▀ + ███ + + // ███ + ███ ███ ███ █████████ ███ ███ ███ ███ // ███ +███ ███ ███ ███ ███▐██████ ███ ███ ███ // ███ + ███ ███+ ███ +███ ███ + ███ ███ + ███ // ███▄ ▄███ ███▄ ███ ███ + ███ + ███ ███▄ ███ // ▀████████▀ + ▀███████ ███▄ ███▄ ▀████ ▀███████ // + + + ███ // + ▀████████████████████████████████████████████████████▀ use blend::Blend; use std::fs::File; use std::io::Write; fn main() { let target = std::env::var("TARGET").unwrap(); if target.contains("windows") { println!("cargo:warning=Embedding Windows Icon"); embed_resource::compile("build/windows/icon.rc"); } let file = File::create("src/data/scenes.in"); if let Ok(mut file) = file { generate_scenes(&mut file, "src/blender/suit_v2.blend"); generate_scenes(&mut file, "src/blender/cruiser.blend"); } } fn generate_scenes(stream: &mut File, source_blend_file: &str) { let blend = Blend::from_path(source_blend_file).expect("error loading blend file"); for obj in blend.root_instances() { let loc: Vec = if obj.is_valid("loc") { obj.get_f32_vec("loc") } else { vec![0.0, 0.0, 0.0] }; let rot: Vec = if obj.is_valid("rot") { obj.get_f32_vec("rot") } else { vec![0.0, 0.0, 0.0] }; let name = obj.get("id").get_string("name"); let result = write!(stream, "(\"{}\", {:?}, {:?}),\n", name, loc, rot); if result.is_err() { println!("{:?}", result); break; } } }