Python error importing FBX file #83467
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
7 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#83467
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Operating system: Windows 10
Graphics card: NVIDIA GeForce RTX 2070 SUPER
Blender Version
Broken: 2.91, downloaded from blender.org
Importing a FBX model downloaded from Unity asset store causes a Python traceback error and results in an incomplete import.
Exact steps for others to reproduce the error
Go to File -> Import -> FBX. Find the dragon model in "\Assets\InfinityPBR_InfinityPBR - Dragons\Models\Dragon_Master05 DEMO.FBX" under your Unity project and import it.
Expected: This should import.
Observed: It imports about halfway, then throws a Python error. There are no textures and no animations.
(Sorry about the somewhat involved process for obtaining the model. I don't know if there are any simpler models that reproduce the problem, and I can't exactly attach the model to a bug report because copyright.)
Added subscriber: @Stormhunter_Studios
Added subscriber: @rjg
Changed status from 'Needs Triage' to: 'Needs User Info'
I'm sorry, we won't be purchasing a model to reproduce the issue. Please try to create a minimal example file that you can share freely.
How exactly am I supposed to create an example, when the problem is in your FBX importer? Are you asking me to purchase Maya?
@Stormhunter_Studios For instance you could try to find another FBX that has the same problem but is freely accessible or inspect the structure of the FBX in another application that is able to open it. Apparently Blender expects a
DragonRoot
to be part of the armature but is unable to load it properly. This could be because Blender handles the file improperly or because the FBX is not following the specification. You could also try if previous versions of Blender can successfully import the file.All bug reports need to provide the necessary information and files that allow us to reproduce the issue.
DragonRoot is the root bone of the armature for this model. It's present, and in fact it actually shows up in Blender after the failed import. The file is correctly structured as far as I can tell. It imports without any problems in both Unity and Unreal, at the very least.
I've contacted the author and asked him to weigh in on this. If available, he'd be far more helpful to you on this than I can be.
After speaking with the author, he encouraged me to submit the FBX file here. So here you go. With this you should be able to reproduce the problem. It's literally as simple as running the FBX importer on this file, under the default settings. (Preferably in your Python IDE of choice with the debugger attached.)
Dragon_Master05 DEMO.zip
@Stormhunter_Studios Thank you for the file, we will look at this tomorrow.
Changed status from 'Needs User Info' to: 'Needs Developer To Reproduce'
I can reproduce the problem with the provided file, I'll investigate.
When trying to access
mesh.armature_setup[self]
inlink_hierarchy()
the entries for the some keys do not exist when trying to import the provided file. Therefore, accessing the dictionary like this results in the error described in the bug report. The meshes for which an entry is missing, are:The listed names are the content of their respective
.fbx_name
. The missing entry for all those meshes is theDragonRoot☺Model
. I have yet to identify why these keys aren't set in the dictionary and whether this is an issue with the file or the importer.There are multiple times where the
helper_node.armature
isNone
when entries are created withmesh_node.armature_setup[helper_node.armature] = (mesh_matrix, armature_matrix)
inload()
. The followinghelper_node
s have anhelper_node.armature
ofNULL
:Edit: This is related to the problem at hand, as for instance when the entries for
BridleHeadB
should be created withmesh_node.armature_setup[helper_node.armature] = (mesh_matrix, armature_matrix)
inload()
theEnglish DragonNeck5
,English DragonHead
andEnglish DragonJaw
are used ashelper_node
, but their.armature
returnsNone
.Maybe this is just a case of differing philosophies, but as a coder myself, it seems to me that if the end-user sees a stack trace from Blender's code for any reason, it's a flaw in Blender's code. If the input file is malformed, it should report that fact to the user with some human-readable explanation as to what's wrong with the file, rather than throw an uncaught exception.
(Yes, I know end users can write their own code for plugins, etc. I'm referring specifically to code that comes from Blender and is fully under your control.)
There are even more objects that should get an armature modifier assigned with Object set to DragonRoot, e.g. the Male_Body object, but currently don't.
@Stormhunter_Studios I'm in the process of analyzing this and just shared my notes so other developers don't do the redundant work.
Added subscriber: @mont29
Seems like the support of more complex rigs is limited in Blender's FBX importer. I will give it another look tomorrow and see if I can find the core problem, but based on comments by @mont29 in past reports #70244 and #61011 this is a known limitation.
Changed status from 'Needs Developer To Reproduce' to: 'Needs User Info'
Such giant FBX file is totally unusable to investigate an issue, we'd need a minimal basic demo file exhibiting it to seriously check on it... But even then, as already said, recursive layers of rigs are not exactly well supported currently, FBX uses Maya/3DSMax kinds of rigs, which are fairly different from Blender ones, and since there is no clear specs for FBX, doing a fully proper conversion is fairly difficult.
Added subscriber: @EthicalVegan
This comment was removed by @EthicalVegan
Added subscriber: @ankitm
Changed status from 'Needs User Info' to: 'Archived'
No activity for more than a week. As per the tracker policy we assume the issue is gone and can be closed.
Thanks again for the report. If the problem persists please report with the required information.
Added subscriber: @RiverNyxx
I just came across what I believe to be the same problem, myself. Again, with an asset from the Unity Asset Store.
This is what I changed to fix it (Blender 3.0):
import_fbx.py
You'll notice that the only change was to move the recursive find_armature_bones() call out of the if block.
This is because, at least for my example file, some of the bone objects are children of a mesh object, so we don't want the recursive function to abort when it reaches the mesh object, but before reaching its children (which are bone objects).
Now those bone objects are properly assigned their armatures.
Thanks @RiverNyxx , that solved the problem for me too (the orc model from the Must Have Fantasy Villains Pack on the Unity store).
If there are any Blender developers still following this ticket, is there any reason why the change shouldn't be merged?