nx_nxa_anim.nx
buildroot/runtime/nx_nxa_anim.nx
about
nx_nxa_anim.nx -- ANIMATION IMPORTER v2: extracts the FBX's authored animation and BAKES it
to the NXA's normative delta-LBS convention. v1 wrote raw Lcl-space Euler quats (channel 1)
which are NOT drivable without the FBX local hierarchy (pre-rotations, parent chain); v2
evaluates full integer FK per 30Hz sample -- local = PreRotation x LclRotation(t) chained
down the joint parents -- and emits per-joint WORLD-SPACE deltas about the bind pose
(channel 2, packed 2-word keys), the exact form the LBS viewer consumes: M x = D(x-b)+b+dt.
SELF-VALIDATING: the static FK must reproduce the SKEL bind translations (TransformLink
ground truth) or the tool REFUSES (exit 7) -- pre-rotation/hierarchy math is proven against
data already trusted, never assumed.
usage: nx_nxa_anim <in.fbx> <in.nxa5> <out.nxa>
rc: 0 ok, 2 usage, 3 fbx unreadable, 4 no animation, 5 in.nxa bad, 7 rig-mismatch, 9 io
license_tier: ORIGINAL
dependencies 5 imports · 0 importers
imports: nx_syscalls.nxnx_zlib_wrap.nxnx_nxa.nxnx_itrig.nxnx_nxa_fk.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 18 | const A_MAGIC_1500: i64 = 1500 |
| 19 | const A_MAGIC_2047: i64 = 2047 |
| 20 | const A_MAGIC_1048575: i64 = 1048575 |
| 21 | const A_MAGIC_4503599627370496: i64 = 4503599627370496 |
| 22 | const A_MAGIC_8388607: i64 = 8388607 |
| 23 | const A_MAGIC_8388608: i64 = 8388608 |
| 24 | const A_MAGIC_4090: i64 = 4090 |
| 25 | const A_MAGIC_2040: i64 = 2040 |
| 26 | const A_MAGIC_119990: i64 = 119990 |
| 27 | const A_MAGIC_4096: i64 = 4096 |
| 28 | const A_MAGIC_46186158: i64 = 46186158 |
| 29 | const A_MAGIC_180000: i64 = 180000 |
| 30 | const A_MAGIC_360000: i64 = 360000 |
| 31 | const A_MAGIC_7500: i64 = 7500 |
| 32 | const A_MAGIC_500000: i64 = 500000 |
| 33 | const A_MAGIC_60000: i64 = 60000 |
| 34 | const A_MAGIC_20000: i64 = 20000 |
| 35 | const A_MAGIC_4611686018427387903: i64 = 4611686018427387903 |
| 36 | const A_MAGIC_2000: i64 = 2000 |
| 37 | const A_MAGIC_200000: i64 = 200000 |
| 38 | const A_MAGIC_32767: i64 = 32767 |
| 39 | const A_MAGIC_65535: i64 = 65535 |
| 40 | const A_MAGIC_1024: i64 = 1024 |
| 43 | const A_MO: i64 = 16 // model ids x4096 |
| 44 | const A_LO: i64 = 4112 // limb flags x4096 |
| 45 | const A_AN: i64 = 8208 // AnimationCurveNode ids x2048 |
| 46 | const A_CID: i64 = 10256 // curve ids x2048 |
| 47 | const A_CKT: i64 = 12304 // curve KeyTime meta (off,alen,enc,clen) x2048x4 |
| 48 | const A_CKV: i64 = 20496 // curve KeyValueFloat meta x2048x4 |
| 49 | const A_CONN: i64 = 28688 // conns (src,dst,ptag) x120000x3 |
| 50 | const A_PR: i64 = 388688 // per-model PreRotation millideg x3 |
| 51 | const A_LR: i64 = 400976 // per-model Lcl Rotation default millideg x3 |
| 52 | const A_LT: i64 = 413264 // per-model Lcl Translation default units x3 |
| 53 | const A_PF: i64 = 425552 // per-model flags: 1=pre 2=lclrot 4=lclt |
| 54 | const A_NO: i64 = 430000 // per-model name byte offset (into the mapped fbx) |
| 55 | const A_NL: i64 = 434096 // per-model name length |
| 56 | const A_WORDS: i64 = 440000 |
functions
| 58 | func aw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 59 | func an(v: i64) -> i64 |
| 71 | func a_u32(b: *u8, o: i64) -> i64 |
| 75 | func a_u64(b: *u8, o: i64) -> i64 { return a_u32(b, o) | (a_u32(b, o + 4) << 32) } |
| 77 | func a_f64(b: *u8, o: i64, scale: i64) -> i64 |
| 96 | func a_f32(b: *u8, o: i64, scale: i64) -> i64 |
| 113 | func a_walk(b: *u8, flen: i64, off0: i64, big: i64, G: *i64, cctx: i64, mctx: i64) -> i64 |
| 287 | func a_arr(b: *u8, off: i64, alen: i64, enc: i64, clen: i64, esz: i64) -> *u8 |
| 294 | func a_sample(kt: *u8, kv: *u8, nk: i64, tms: i64) -> i64 |
| 317 | func a_sample_ang(kt: *u8, kv: *u8, nk: i64, tms: i64) -> i64 |
| 343 | func a_wname(b: *u8, off: i64, len: i64) -> i64 |
| 356 | func a_namehas(b: *u8, off: i64, len: i64, pat: *u8) -> i64 called by 1: main |
| 374 | func main(argc: i64, argv: *i64) -> i64 |