OpenBF1942-Plus
Refractor 1, rebuilt from scratch
Loading...
Searching...
No Matches
anim Namespace Reference

Functions

 _names (d, o, count)
 parse_ske (d)
 parse_skn (d)
 parse_baf (d)
 _mul (a, b)
 ske_local (m)
 quat_local (q, p)
 pose (skeleton, animations=(), frame=0, biped_root=False)
 skin (vertices, records, names, world)

Variables

 vm = load_mod(sys.argv[1], sys.argv[2])
 path = sys.argv[3].lower()
 data = vm.vfs.read(path)
 recs
 names
 nframes
 _

Detailed Description

Skeletons (.ske), skins (.skn) and animations (.baf). Stdlib only.

Spec: docs/formats/anim.md

Usage: anim.py <BF1942_DIR> <mod> <file.ske|.skn|.baf>   print a summary

Function Documentation

◆ _mul()

anim._mul ( a,
b )
protected

◆ _names()

anim._names ( d,
o,
count )
protected

◆ parse_baf()

anim.parse_baf ( d)
-> (bone names, frame count, [per bone: 7 channels of frame values]); channels qx qy qz qw px py pz.

◆ parse_ske()

anim.parse_ske ( d)
-> [(name, parent index or -1, 12 floats: row-major [R | t] relative to the parent)]

◆ parse_skn()

anim.parse_skn ( d)
-> (records [(pos, [(bone, weight, offset)])], bone names); bone indexes into the names.

◆ pose()

anim.pose ( skeleton,
animations = (),
frame = 0,
biped_root = False )
World matrix per bone name. Bones an animation covers use its frame; others keep the skeleton.

biped_root: biped rigs animate in 3ds Max space (up -z, facing +y); a quarter turn about x makes them
Y-up facing +z, standing on the origin.

◆ quat_local()

anim.quat_local ( q,
p )
Rotation of the conjugate quaternion (see engine/anim.cpp: read straight, soldiers lean back).

◆ ske_local()

anim.ske_local ( m)

◆ skin()

anim.skin ( vertices,
records,
names,
world )
Skinned position per mesh vertex; mesh vertices are matched to skin records by position.

Variable Documentation

◆ _

anim._
protected

◆ data

anim.data = vm.vfs.read(path)

◆ names

anim.names

◆ nframes

anim.nframes

◆ path

anim.path = sys.argv[3].lower()

◆ recs

anim.recs

◆ vm

anim.vm = load_mod(sys.argv[1], sys.argv[2])