This branch predates CI on `main`. `cargo fmt --all` only; no behaviour. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
44 lines
1.7 KiB
Rust
44 lines
1.7 KiB
Rust
//! The PARENT elements that host the sweep leaves — `ptloop01`/`ptloop02` as
|
|
//! they are declared in the title build itself, not in their nested records.
|
|
//!
|
|
//! The leaves' own alpha is non-zero at their t=0 (`pteff03` declares 255), yet
|
|
//! the capture shows the sweep fading in from ~8. So the gate is the parent's
|
|
//! alpha, and this prints it.
|
|
//!
|
|
//! cargo run -p sylpheed-formats --example ptloop_parent_keyframes -- GP_TITLE 5
|
|
use std::path::PathBuf;
|
|
use sylpheed_formats::{pak::PakArchive, ui_layout};
|
|
|
|
fn main() {
|
|
let root = PathBuf::from(std::env::var("SYLPHEED_DISC").expect("SYLPHEED_DISC"));
|
|
let argv: Vec<String> = std::env::args().skip(1).collect();
|
|
let pak = argv
|
|
.iter()
|
|
.find(|a| a.parse::<usize>().is_err())
|
|
.cloned()
|
|
.unwrap_or_else(|| "GP_TITLE".to_string());
|
|
let ar = PakArchive::open(root.join(format!("dat/{pak}.pak"))).expect("pak");
|
|
let builds: Vec<usize> = argv.iter().filter_map(|a| a.parse().ok()).collect();
|
|
for e in if builds.is_empty() {
|
|
vec![5usize]
|
|
} else {
|
|
builds
|
|
} {
|
|
let Ok(by) = ar.read(&ar.entries()[e]) else {
|
|
continue;
|
|
};
|
|
let Some(b) = ui_layout::parse_build(&by) else {
|
|
continue;
|
|
};
|
|
println!("=== {pak} entry {e}: {} elements ===", b.elements.len());
|
|
for el in &b.elements {
|
|
for (i, k) in el.keyframes.iter().enumerate() {
|
|
println!(" {:<20} kf{i:<2} t={:<5} x={:<6} y={:<6} sx={:<4} sy={:<4} fade={:08X} (alpha {:3})",
|
|
el.name,
|
|
k.time.map(|t| t.to_string()).unwrap_or_else(|| "-".into()),
|
|
k.x, k.y, k.scale_x, k.scale_y, k.fade, k.fade >> 24);
|
|
}
|
|
}
|
|
}
|
|
}
|