nx_boneheat.nx source
↩ module page · 31 lines · 1543 B
1// nx_boneheat.nx -- SOVEREIGN AUTO-WEIGHTS CLI: geodesic bone-heat skin weights for a rigged NXA (Blender Automatic
2// Weights and Maya geodesic-voxel class, integer, deterministic, sealed-or-not announced). Also the NEAREST control
3// that modding MD4's accept rule names. Everything that decides lives in nx_boneheat_lib.nx; this is the door.
4// nx_boneheat <in.nxa> <out.nxa> [geodesic|nearest] [conf path]
5// exit 0 written, 2 usage, 3 refused by name (no VERT/TRIS/SKEL, unreadable, unwritable).
6// license_tier: ORIGINAL
7import "nx_syscalls.nx"
8import "nx_boneheat_lib.nx"
9
10func main(argc: i64, argv: *i64) -> i64 {
11 if argc < 3 {
12 bh_puts("usage: nx_boneheat <in.nxa> <out.nxa> [geodesic|nearest] [conf path]\n" as *u8)
13 return BH_EXIT_USAGE
14 }
15 var mode: i64 = BH_MODE_GEODESIC
16 if argc >= 4 {
17 if bh_streq(argv[3] as *u8, "nearest" as *u8) == 1 { mode = BH_MODE_NEAREST }
18 else { if bh_streq(argv[3] as *u8, "geodesic" as *u8) == 0 {
19 bh_puts("BONEHEAT-REFUSE mode must be geodesic or nearest\n" as *u8)
20 return BH_EXIT_USAGE
21 } }
22 }
23 var conf: *u8 = BH_CONF_PATH
24 if argc >= 5 { conf = argv[4] as *u8 }
25 let rep: *i64 = sys_mmap(BR_WORDS * 8) as *i64
26 let rc: i64 = bh_run(argv[1] as *u8, argv[2] as *u8, mode, bh_conf_cells(conf), rep)
27 if rc != BH_EXIT_OK { bh_puts("BONEHEAT verdict=REFUSED\n" as *u8); return rc }
28 bh_report(mode, rep, argv[1] as *u8, argv[2] as *u8)
29 bh_puts("BONEHEAT verdict=OK\n" as *u8)
30 return BH_EXIT_OK
31}