aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-05-15 14:56:55 +0200
committermetamuffin <metamuffin@disroot.org>2025-05-15 14:56:55 +0200
commitc30c4d2928eb724e79dcbdb293a0db6cafaf6123 (patch)
treed2d1d2f31a97b50c211ee0911161826bc8a59167
parentf2f2c32e9d419a390cf1bf9833254994d6101227 (diff)
downloadunity-tools-c30c4d2928eb724e79dcbdb293a0db6cafaf6123.tar
unity-tools-c30c4d2928eb724e79dcbdb293a0db6cafaf6123.tar.bz2
unity-tools-c30c4d2928eb724e79dcbdb293a0db6cafaf6123.tar.zst
scenetree: draw children
-rw-r--r--exporter/src/bin/scenetree.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/exporter/src/bin/scenetree.rs b/exporter/src/bin/scenetree.rs
index 091fda2..71f0db6 100644
--- a/exporter/src/bin/scenetree.rs
+++ b/exporter/src/bin/scenetree.rs
@@ -1,4 +1,8 @@
-use std::{env::args, fs::File, io::BufReader};
+use std::{
+ env::{args, var},
+ fs::File,
+ io::BufReader,
+};
use unity_tools::{assetbundle::AssetBundle, classes::transform::Transform};
fn main() -> anyhow::Result<()> {
@@ -6,6 +10,7 @@ fn main() -> anyhow::Result<()> {
let file = BufReader::new(File::open(args().nth(1).unwrap()).unwrap());
let mut bundle = AssetBundle::open(file, "samples")?;
+ let draw_children = var("DRAW_CHILDREN").is_ok();
println!("digraph {{");
for ob in bundle.all_toplevel_of_class("Transform") {
let i = ob.path_id;
@@ -23,6 +28,13 @@ fn main() -> anyhow::Result<()> {
let j = tr.father.path_id;
println!("n{j} -> n{i};")
}
+ if draw_children {
+ for ch in tr.children {
+ assert_eq!(ch.file_id, 0);
+ let j = ch.path_id;
+ println!("n{i} -> n{j} [color=red];")
+ }
+ }
}
println!("}}");