Part of #41: the comments of `benilla-formats` (the library, its extract tools, examples and tests) are rewritten to the rule in `docs/METHOD.md`, which is what the code does and the reference fact behind it, in a line. 19,654 comment lines become 7,264. Fixes #105: the WMO collision comments now name walking's box-query leaf `0x6bca50` and the camera and line-of-sight segment-query leaf `0x6bc700`, in `models/collision.rs`, `examples/wmo_bsp.rs` and `tests/chain.rs`. - **The mechanical strip.** The citations that were only a private record number go first, and each edit is shown to be a pure removal. - **Wrong facts corrected.** The rewrite corrects the comments that stated wrong facts. Among them: - A placed doodad's material alpha reads file slot 0 on its spawn clock, while the reference reads bone 0's armed sequence, re-rolled every play window. The old text said doodads are armed once at load. - The fog end is stored ×36 and scaled once at load (`0x6d6090`). It is not raw. - The MCSH bit picks a map doodad's sun scale, 1.0 lit or 0.5 shadowed. 2.5 belongs to an entity's light node. - `SpellRec` is the row as stored, column × 4, not a translated copy. - A global sequence's clock is anchored at the instance's attach time (`0x714352`). - Particle twinkle is a gated size multiplier (`0x7b2adc`). - The blob shadow sizes from the Stand box. - Data claims are checked against the install: the weapon-trail kits' parameters and alphas, the beam rows' noise, and the maps' `field_16`. - Dozens more turned up on the way: renamed or deleted items, docs sitting on the wrong item, stale counts and links. - **Deviation labels.** "Deviation:" now marks only a choice with a reason. An unbuilt behaviour says so plainly. - **Verification.** Every file strips to identical code, and `cargo fmt --check` is clean. Four second readers compared every file old against new, restored the facts the rewrite had dropped, and checked each new citation against the reference, the code and the shipped data. String literals are untouched; they are #92. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
91 lines
3.2 KiB
Rust
91 lines
3.2 KiB
Rust
//! Every animation channel family a model has ([`M2AnimSummary`](benilla_formats::M2AnimSummary))
|
|
//! and its texture-transform tracks, for one M2 or each animated M2 matching a substring. A fully
|
|
//! static model that changes on screen is being changed by something drawn over it, or by the
|
|
//! renderer. Output is Blizzard data: never commit it.
|
|
//! `cargo run -p benilla-formats --example dump_model_anim -- <m2 path | substring>`
|
|
|
|
use std::io::Cursor;
|
|
|
|
fn main() -> anyhow::Result<()> {
|
|
let arg = std::env::args()
|
|
.nth(1)
|
|
.ok_or_else(|| anyhow::anyhow!("usage: dump_model_anim <m2 path | substring>"))?;
|
|
let data = benilla_formats::wow_data().expect("no WoW install found (set $WOW_DATA)");
|
|
let mut chain = benilla_formats::open_chain(&data)?;
|
|
|
|
// An exact path dumps in full; a substring sweep skips fully static models.
|
|
let exact = chain.contains(&arg);
|
|
let names: Vec<String> = if exact {
|
|
vec![arg]
|
|
} else {
|
|
let pat = arg.to_lowercase();
|
|
chain
|
|
.list()?
|
|
.into_iter()
|
|
.map(|e| e.name)
|
|
.filter(|n| {
|
|
let l = n.to_lowercase();
|
|
l.ends_with(".m2") && l.contains(&pat)
|
|
})
|
|
.collect()
|
|
};
|
|
|
|
for name in names {
|
|
let Ok(bytes) = chain.read_file(&name) else {
|
|
continue;
|
|
};
|
|
let Ok(sum) = benilla_formats::parse_m2_animation_summary(&bytes) else {
|
|
continue;
|
|
};
|
|
if !exact && sum.is_fully_static() {
|
|
continue;
|
|
}
|
|
println!("{name}");
|
|
if sum.is_fully_static() {
|
|
println!(" FULLY STATIC — no channel family animates anything");
|
|
}
|
|
println!(
|
|
" bones {} (seq0 motion {}) gseq {} alpha {:?} rgb {:?} transp {:?} \
|
|
texanim {} particles {} ribbons {}",
|
|
sum.seq0_animated_bone_count,
|
|
sum.seq0_has_bone_motion,
|
|
sum.global_seq_channels.len(),
|
|
sum.color_alpha_tracks,
|
|
sum.color_rgb_tracks,
|
|
sum.transparency_tracks,
|
|
sum.texture_transform_count,
|
|
sum.particle_emitter_count,
|
|
sum.ribbon_emitter_count,
|
|
);
|
|
if sum.texture_transform_count == 0 {
|
|
continue;
|
|
}
|
|
let Ok(fmt) = parse_m2(&bytes) else { continue };
|
|
let m = fmt.model();
|
|
println!(
|
|
" global_sequences {:?} texAnimLookup {:?}",
|
|
m.global_sequences, m.texture_transform_lookup
|
|
);
|
|
for (i, t) in m.texture_transforms.iter().enumerate() {
|
|
let tr = &t.translation;
|
|
println!(
|
|
" tt[{i}] translation: interp {} gseq {:#x} keys {}",
|
|
tr.interp,
|
|
tr.gseq,
|
|
tr.keys.len()
|
|
);
|
|
for (ts, v) in tr.keys.iter().take(8) {
|
|
println!(" t={ts:>7} ms {v:?}");
|
|
}
|
|
if tr.keys.len() > 8 {
|
|
println!(" … {} more", tr.keys.len() - 8);
|
|
}
|
|
}
|
|
}
|
|
Ok(())
|
|
}
|
|
|
|
fn parse_m2(bytes: &[u8]) -> anyhow::Result<benilla_m2::M2Format> {
|
|
benilla_m2::parse_m2(&mut Cursor::new(bytes)).map_err(|e| anyhow::anyhow!("parsing M2: {e}"))
|
|
}
|