From c9ee1d370c84f765b18f9883272725aedf0f0eed Mon Sep 17 00:00:00 2001 From: "Avenger Anubis (Ilya)" Date: Tue, 7 Jul 2026 03:16:02 +0500 Subject: [PATCH] fix: merge multiple KEYS chunks instead of overwriting When a B3D bone has multiple KEYS chunks (e.g., flags=1 for position, flags=4 for rotation), the previous code overwrote earlier chunks with later ones, losing position key data. Now key_flags is unioned and key vectors are extended, preserving all channel types. --- b3d/src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/b3d/src/lib.rs b/b3d/src/lib.rs index 1911691..609c65a 100644 --- a/b3d/src/lib.rs +++ b/b3d/src/lib.rs @@ -344,8 +344,9 @@ impl Node { "MESH" => mesh = Mesh::read(data, chunk.next)?, "BONE" => bones = Self::read_bones(data, chunk.next)?, "KEYS" => { - key_flags = data.read_u32::()?; - keys = Self::read_keys(data, chunk.next, key_flags)?; + let kf = data.read_u32::()?; + key_flags |= kf; + keys.extend(Self::read_keys(data, chunk.next, kf)?); }, "NODE" => children.push(Node::read(data, chunk.next)?), "ANIM" => animation = Animation::read(data, chunk.next)?,