Fix missing animations when converting some FBX from json to binary
commitdad3a29a123f6ef6a42226e071274b4bae1efb10
authorThomas Barlow <github@mysterymayhem.co.uk>
Thu, 5 Oct 2023 22:06:07 +0000 (6 00:06 +0200)
committerMysteryem <mysteryem@noreply.localhost>
Thu, 5 Oct 2023 22:06:07 +0000 (6 00:06 +0200)
tree080631c0e44dd5490cf4cf9cb73556ad12fb7178
parent9b77553c6e717824967e7382bd1dde7732e6fd10
Fix missing animations when converting some FBX from json to binary

Animations would be missing in external software when importing FBX that
have their AnimationLayer or AnimationStack element as the last element
in a block. Importing such files through Blender, however, would import
the animations without issue.

AnimationLayer and AnimationStack elements are an exception to normal
FBX behaviour in that they always need to write a block sentinel after
them. However, this was not happening when the AnimationLayer was the
last element in a block.

With this patch, the block sentinel is now always written for
AnimationLayer and AnimationStack elements.

This patch should only affect FBX files converted from json to binary
with the json2fbx.py script because FBX exported from Blender always
writes the AnimationStack, AnimationLayer and then AnimationCurveNodes
and AnimationCurves of that AnimationLayer, so the only time the
AnimationLayer could be the last element in the block is when there are
no animations in the AnimationLayer to begin with.

Pull Request: https://projects.blender.org/blender/blender-addons/pulls/104911
io_scene_fbx/__init__.py
io_scene_fbx/encode_bin.py