blob: 66276df10c5a999d58316e0e7b6d86594ef27467 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
use std::{env::args, fs::File, io::BufReader};
use unity_tools::{assetbundle::AssetBundle, classes::transform::Transform};
fn main() -> anyhow::Result<()> {
env_logger::init_from_env("LOG");
let file = BufReader::new(File::open(args().nth(1).unwrap()).unwrap());
let mut bundle = AssetBundle::open(file, "samples")?;
println!("digraph {{");
for ob in bundle.all_toplevel_of_class("Transform") {
let i = ob.path_id;
let tr = ob.load(&mut bundle)?.parse::<Transform>()?;
let mut name = "(no gameobject)".to_string();
if !tr.gameobject.is_null() {
let go = tr.gameobject.load(&mut bundle)?;
name = go.name;
}
println!("n{i} [label={name:?}];");
if !tr.father.is_null() {
let j = tr.father.path_id;
println!("n{j} -> n{i};")
}
}
println!("}}");
Ok(())
}
|