Backtrace when importing FBX file from the Unity asset store #62984

Closed
opened 2019-03-26 20:48:11 +01:00 by Pete Chown · 6 comments

System Information
Operating system: Linux-4.15.0-46-generic-x86_64-with-debian-buster-sid 64 Bits
Graphics card: GeForce RTX 2080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 415.27

Blender Version
Broken: version: 2.80 (sub 51), branch: blender2.7, commit date: 2019-03-25 23:15, hash: adfdae3fc2
Worked: (optional)

Short description of error
Backtrace when importing some FBX files.

Exact steps for others to reproduce the error
Unfortunately providing exact reproduction steps is difficult because the FBX file is not mine to distribute; it's from the Unity asset store. However I have a fix and I think it makes sense bearing in mind the surrounding code. First of all, this is the backtrace:

Traceback (most recent call last):
  File "/nobackup/src/blender-2.80-adfdae3fc2f4-linux-glibc224-x86_64/2.80/scripts/addons/io_scene_fbx/__init__.py", line 231, in execute
    return import_fbx.load(self, context, **keywords)
  File "/nobackup/src/blender-2.80-adfdae3fc2f4-linux-glibc224-x86_64/2.80/scripts/addons/io_scene_fbx/import_fbx.py", line 2889, in load
    _(); del _
  File "/nobackup/src/blender-2.80-adfdae3fc2f4-linux-glibc224-x86_64/2.80/scripts/addons/io_scene_fbx/import_fbx.py", line 2887, in _
    blen_read_animations(fbx_tmpl_astack, fbx_tmpl_alayer, stacks, scene, settings.anim_offset)
  File "/nobackup/src/blender-2.80-adfdae3fc2f4-linux-glibc224-x86_64/2.80/scripts/addons/io_scene_fbx/import_fbx.py", line 720, in blen_read_animations
    if id_data.type == 'MESH' and id_data.parent and id_data.parent.type == 'ARMATURE':
AttributeError: 'NoneType' object has no attribute 'type'

That section of code looks like this (from 2.80/scripts/addons/io_scene_fbx/import_fbx.py):

                if isinstance(item, Material):
                    id_data = item
                elif isinstance(item, ShapeKey):
                    id_data = item.id_data
                elif isinstance(item, Camera):
                    id_data = item
                else:
                    id_data = item.bl_obj
                    - XXX Ignore rigged mesh animations - those are a nightmare to handle, see note about it in
                    - FbxImportHelperNode class definition.
                    if id_data.type == 'MESH' and id_data.parent and id_data.parent.type == 'ARMATURE':
                        continue
                if id_data is None:
                    continue

The exception is thrown on the id_data.type == 'MESH' line and it happens because id_data is None. The next statement tests for this condition and if it holds, executes continue. It seems reasonable then to change the line to read:

                    if id_data is not None and id_data.type == 'MESH' and id_data.parent and id_data.parent.type == 'ARMATURE':

What do you think? This fix seems to allow correct imports of the FBX file concerned on my system.

**System Information** Operating system: Linux-4.15.0-46-generic-x86_64-with-debian-buster-sid 64 Bits Graphics card: GeForce RTX 2080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 415.27 **Blender Version** Broken: version: 2.80 (sub 51), branch: blender2.7, commit date: 2019-03-25 23:15, hash: `adfdae3fc2` Worked: (optional) **Short description of error** Backtrace when importing some FBX files. **Exact steps for others to reproduce the error** Unfortunately providing exact reproduction steps is difficult because the FBX file is not mine to distribute; it's from the Unity asset store. However I have a fix and I think it makes sense bearing in mind the surrounding code. First of all, this is the backtrace: ``` Traceback (most recent call last): File "/nobackup/src/blender-2.80-adfdae3fc2f4-linux-glibc224-x86_64/2.80/scripts/addons/io_scene_fbx/__init__.py", line 231, in execute return import_fbx.load(self, context, **keywords) File "/nobackup/src/blender-2.80-adfdae3fc2f4-linux-glibc224-x86_64/2.80/scripts/addons/io_scene_fbx/import_fbx.py", line 2889, in load _(); del _ File "/nobackup/src/blender-2.80-adfdae3fc2f4-linux-glibc224-x86_64/2.80/scripts/addons/io_scene_fbx/import_fbx.py", line 2887, in _ blen_read_animations(fbx_tmpl_astack, fbx_tmpl_alayer, stacks, scene, settings.anim_offset) File "/nobackup/src/blender-2.80-adfdae3fc2f4-linux-glibc224-x86_64/2.80/scripts/addons/io_scene_fbx/import_fbx.py", line 720, in blen_read_animations if id_data.type == 'MESH' and id_data.parent and id_data.parent.type == 'ARMATURE': AttributeError: 'NoneType' object has no attribute 'type' ``` That section of code looks like this (from 2.80/scripts/addons/io_scene_fbx/import_fbx.py): ``` if isinstance(item, Material): id_data = item elif isinstance(item, ShapeKey): id_data = item.id_data elif isinstance(item, Camera): id_data = item else: id_data = item.bl_obj - XXX Ignore rigged mesh animations - those are a nightmare to handle, see note about it in - FbxImportHelperNode class definition. if id_data.type == 'MESH' and id_data.parent and id_data.parent.type == 'ARMATURE': continue if id_data is None: continue ``` The exception is thrown on the `id_data.type == 'MESH'` line and it happens because `id_data` is `None`. The next statement tests for this condition and if it holds, executes `continue`. It seems reasonable then to change the line to read: ``` if id_data is not None and id_data.type == 'MESH' and id_data.parent and id_data.parent.type == 'ARMATURE': ``` What do you think? This fix seems to allow correct imports of the FBX file concerned on my system.
Author

Added subscriber: @PeteX-2

Added subscriber: @PeteX-2

Added subscriber: @mont29

Added subscriber: @mont29
Bastien Montagne self-assigned this 2019-03-27 08:51:11 +01:00

Indeed seems to make sense, thanks for the investigation and patch, will commit.

Indeed seems to make sense, thanks for the investigation and patch, will commit.

This issue was referenced by blender/blender-addons@ad2ee4cd6f

This issue was referenced by blender/blender-addons@ad2ee4cd6f97d2bfbe6a77e76baa5ad4de8e4b34

This issue was referenced by blender/blender-addons@d0aa840bff

This issue was referenced by blender/blender-addons@d0aa840bff2c7007d7f8595fa5f0475f9872e3f0

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
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
3 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#62984
No description provided.