Fix #104684: json2fbx.py script creates invalid FBX v7500+ files #104913

Merged
Thomas Barlow merged 3 commits from Mysteryem/blender-addons:fbx_fix_v7500_json2fbx into main 2023-09-26 03:57:19 +02:00
Member

As of FBX version 7500, the element metadata values are 64-bit as
opposed to being 32-bit in earlier versions.

FBX exported by Blender are currently always FBX version 7400, so the
fbx binary writing code was only set up to handle writing version 7400
files and earlier.

The json2fbx.py script however, can create FBX files with whatever
version is defined in the .json. Because the script uses the same code
as exporting an FBX with Blender, it would create invalid FBX version
7500+ files with 32-bit metadata values. Attempting to read one of these
files with Blender or external software would cause errors.

This patch sets global variables based on the version of the file being
exported and then uses those global variables when exporting to export
with the correct metadata values for the file version being exported.
This process is very similar to what is already done in parse_fbx.py
when importing FBX files.

There are no expected changes to FBX files exported by Blender with this
patch, only the json2fbx.py script should be affected.

As of FBX version 7500, the element metadata values are 64-bit as opposed to being 32-bit in earlier versions. FBX exported by Blender are currently always FBX version 7400, so the fbx binary writing code was only set up to handle writing version 7400 files and earlier. The json2fbx.py script however, can create FBX files with whatever version is defined in the .json. Because the script uses the same code as exporting an FBX with Blender, it would create invalid FBX version 7500+ files with 32-bit metadata values. Attempting to read one of these files with Blender or external software would cause errors. This patch sets global variables based on the version of the file being exported and then uses those global variables when exporting to export with the correct metadata values for the file version being exported. This process is very similar to what is already done in parse_fbx.py when importing FBX files. There are no expected changes to FBX files exported by Blender with this patch, only the json2fbx.py script should be affected.
Thomas Barlow added 1 commit 2023-09-25 04:55:50 +02:00
10028be6ce Fix #104684: json2fbx.py script creates invalid FBX v7500+ files
As of FBX version 7500, the element metadata values are 64-bit as
opposed to being 32-bit in earlier versions.

FBX exported by Blender are currently always FBX version 7400, so the
fbx binary writing code was only set up to handle writing version 7400
files and earlier.

The json2fbx.py script however, can create FBX files with whatever
version is defined in the .json. Because the script uses the same code
as exporting an FBX with Blender, it would create invalid FBX version
7500+ files with 32-bit metadata values. Attempting to read one of these
files with Blender or external software would cause errors.

This patch sets global variables based on the version of the file being
exported and then uses those global variables when exporting to export
with the correct metadata values for the file version being exported.
This process is very similar to what is already done in parse_fbx.py
when importing FBX files.

There are no expected changes to FBX files exported by Blender with this
patch, only the json2fbx.py script should be affected.
Thomas Barlow requested review from Bastien Montagne 2023-09-25 04:56:31 +02:00
Bastien Montagne approved these changes 2023-09-25 16:32:55 +02:00
Thomas Barlow added 2 commits 2023-09-26 03:48:29 +02:00
Thomas Barlow merged commit e6ca87f4a6 into main 2023-09-26 03:57:19 +02:00
Thomas Barlow deleted branch fbx_fix_v7500_json2fbx 2023-09-26 03:57:21 +02:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#104913
No description provided.