//! 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 = std::env::args().skip(1).collect(); let pak = argv .iter() .find(|a| a.parse::().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 = 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); } } } }