blend-converter

Crates.ioblend-converter
lib.rsblend-converter
version0.4.0
sourcesrc
created_at2023-05-14 12:58:07.891698
updated_at2023-05-29 20:49:23.504173
descriptionConvert blend files to other 3D formats
homepage
repositoryhttps://github.com/RuairidhWilliamson/blend_converter
max_upload_size
id864241
size15,113
Ruairidh Williamson (RuairidhWilliamson)

documentation

README

Blend Converter

Converts blend files to other 3D formats.

There aren't any export options exposed yet, but I plan to add these when needed or someone asks. https://docs.blender.org/api/current/bpy.ops.export_scene.html

Build Script

You can use this in your build script to automatically convert blender files when they change. To do so your build script should look something like:

use std::path::Path;

let input_dir = Path::new("blends");
blend_converter::ConversionOptions::default()
    .convert_dir_build_script(input_dir)
    .expect("failed to convert blends");
println!("cargo:rerun-if-changed={}", input_dir.display());

Then assuming you have blends/test.blend, in your code you can open the converted files using something like:

use std::path::Path;

let path = Path::new(env!("OUT_DIR")).join("blends").join("test.glb");
let f = std::fs::File::open(path);

Blender executable

You will need blender installed and either visible in the path or pass a path to ConversionOptions. If you have blender installed using flatpak then this should be detected. For more information about the search strategy see https://docs.rs/blend-converter

Commit count: 9

cargo fmt