Skip to content

thinkrapido/blender-file

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

blender-file

rust blender-file interpreter

Prepare

Create an executable project in sibling folder.

Execute cp -r ../blender-file/resources . && cargo watch -x run -w . -w ../blender-file -s 'mkdir -p target/debug && cp -r resources target/debug'

Example Code

  let bf = BlenderFile::new(&"resources/rust-cube.blend");

  let fbh_map = FileBlockHeaderMap::new(&bf);

  let sdna = SDNA::new(&bf, &fbh_map);

  if let Some(s) = sdna.structure(&String::from("Object")) {
    println!("{}", &s.pretty_print());
  }

  if let Some(s) = sdna.structure(&String::from("Mesh")) {
    println!("{}", &s.pretty_print());
  }

  let me = fbh_map.find("ME");
  println!("{:?}", me);

  let out = bf.u64(me[0].content_offset + 232) as usize;
  println!("{}", out);

  let vert = &fbh_map.get(&out);
  println!("{:?}", vert);

  let structure = sdna.get_structure_by_index(vert.unwrap().sdna_index);
  println!("{}", structure.unwrap().pretty_print());

Run

cargo run --bin blender-file-example

About

rust blender-file interpreter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages