Working on new animations
This commit is contained in:
1 parent
fe01a5d1b2
commit
52c4ad8ee0
33 files changed
+417542
-134
No files matched your search
@@ -5,11 +5,11 @@ Convert a text-based bone animation file to the BSAF binary format.
|
||||
Usage:
|
||||
python convert_anim_to_binary.py <input.txt> <output.bin>
|
||||
|
||||
Binary format (BSAF v1) -- all values little-endian:
|
||||
Binary format (BSAF v2) -- all values little-endian:
|
||||
|
||||
HEADER
|
||||
4 bytes magic "BSAF"
|
||||
uint32 version (1)
|
||||
uint32 version (2)
|
||||
|
||||
BONES
|
||||
uint32 numBones
|
||||
@@ -21,6 +21,11 @@ Binary format (BSAF v1) -- all values little-endian:
|
||||
uint32 numChildren
|
||||
numChildren x int32 childIndices
|
||||
|
||||
BONE NAMES (v2+)
|
||||
per bone:
|
||||
uint32 nameLen
|
||||
nameLen bytes UTF-8 name (no terminator)
|
||||
|
||||
VERTICES
|
||||
uint32 numVertices
|
||||
numVertices x 3 x float positions
|
||||
@@ -248,7 +253,7 @@ def convert(input_path, output_path):
|
||||
with open(output_path, 'wb') as out:
|
||||
# Header
|
||||
out.write(b'BSAF')
|
||||
out.write(struct.pack('<I', 1))
|
||||
out.write(struct.pack('<I', 2))
|
||||
|
||||
# Bones
|
||||
out.write(struct.pack('<I', num_bones))
|
||||
@@ -262,6 +267,12 @@ def convert(input_path, output_path):
|
||||
for c in b['children']:
|
||||
out.write(struct.pack('<i', c))
|
||||
|
||||
# Bone names (v2+)
|
||||
for name in bone_names:
|
||||
name_bytes = name.encode('utf-8')
|
||||
out.write(struct.pack('<I', len(name_bytes)))
|
||||
out.write(name_bytes)
|
||||
|
||||
# Vertices
|
||||
out.write(struct.pack('<I', num_vertices))
|
||||
for v in vertices:
|
||||
|
||||
Reference in new issue
Block a user