fbx import fails in some cases with AttributeError when id_data.type is checked on None object #53065

Closed
opened 2017-10-14 07:05:02 +02:00 by Gábor Vásárhelyi · 11 comments

System Information
Windows 10 Home, GeForce GTX 1050

Blender Version
2.78

Short description of error
the blen_read_animations() function inside import_fbx.py should change from this:

                if isinstance(item, ShapeKey):
                    id_data = item.id_data
                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

to this:

                if isinstance(item, ShapeKey):
                    id_data = item.id_data
                    if id_data is None:
                        continue
                else:
                    id_data = item.bl_obj
                    if id_data is None:
                        continue
                    - 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

as in some cases id_data does not exist and id_data.type throws AttributeError.

Exact steps for others to reproduce the error
import an .fbx with some id_data==None

**System Information** Windows 10 Home, GeForce GTX 1050 **Blender Version** 2.78 **Short description of error** the `blen_read_animations()` function inside `import_fbx.py` should change from this: ``` if isinstance(item, ShapeKey): id_data = item.id_data 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 ``` to this: ``` if isinstance(item, ShapeKey): id_data = item.id_data if id_data is None: continue else: id_data = item.bl_obj if id_data is None: continue - 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 ``` as in some cases `id_data` does not exist and `id_data.type` throws `AttributeError`. **Exact steps for others to reproduce the error** import an .fbx with some `id_data==None`

Changed status to: 'Open'

Changed status to: 'Open'

Added subscriber: @vasarhelyi

Added subscriber: @vasarhelyi

Added subscriber: @mont29

Added subscriber: @mont29

id_data being None should not happen… Please provide an FBX file demonstrating that issue. Also, please ensure issue is still valid in latest Blender -2.79 official release at least, even better if also checked with the latest build from our buildbot).

`id_data` being `None` should not happen… Please provide an FBX file demonstrating that issue. Also, please ensure issue is still valid in latest Blender -2.79 official release at least, even better if also checked with the latest build from [our buildbot](https://builder.blender.org/download)).

Should not happen, but happens. I cannot attach .fbx, sorry, it cannot be public as it is not mine, but I can confirm that the bug is there in 2.79 as well (just downloaded latest stable release). .fbx is exported from 3D Studio max. This is the console window output:

FBX version: 7400
        FBX import: Prepare...
                Done (0.000000 sec)

        FBX import: Templates...
                Done (0.000000 sec)

        FBX import: Nodes...
                Done (0.000000 sec)

        FBX import: Connections...
                Done (0.000000 sec)

        FBX import: Meshes...
                Done (0.015625 sec)

        FBX import: Materials & Textures...
                Done (0.015625 sec)

        FBX import: Cameras & Lamps...
                Done (0.000000 sec)

        FBX import: Objects & Armatures...
                Done (0.015625 sec)

        FBX import: ShapeKeys...
                Done (0.000000 sec)

        FBX import: Animations...
Traceback (most recent call last):
  File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_fbx\__init__.py", line 234, in execute
    return import_fbx.load(self, context, **keywords)
  File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_fbx\import_fbx.py", line 2843, in load
    _(); del _
  File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_fbx\import_fbx.py", line 2841, in _
    blen_read_animations(fbx_tmpl_astack, fbx_tmpl_alayer, stacks, scene, settings.anim_offset)
  File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_fbx\import_fbx.py", line 676, 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'

location: <unknown location>:-1

location: <unknown location>:-1
Should not happen, but happens. I cannot attach .fbx, sorry, it cannot be public as it is not mine, but I can confirm that the bug is there in 2.79 as well (just downloaded latest stable release). .fbx is exported from 3D Studio max. This is the console window output: ``` FBX version: 7400 FBX import: Prepare... Done (0.000000 sec) FBX import: Templates... Done (0.000000 sec) FBX import: Nodes... Done (0.000000 sec) FBX import: Connections... Done (0.000000 sec) FBX import: Meshes... Done (0.015625 sec) FBX import: Materials & Textures... Done (0.015625 sec) FBX import: Cameras & Lamps... Done (0.000000 sec) FBX import: Objects & Armatures... Done (0.015625 sec) FBX import: ShapeKeys... Done (0.000000 sec) FBX import: Animations... Traceback (most recent call last): File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_fbx\__init__.py", line 234, in execute return import_fbx.load(self, context, **keywords) File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_fbx\import_fbx.py", line 2843, in load _(); del _ File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_fbx\import_fbx.py", line 2841, in _ blen_read_animations(fbx_tmpl_astack, fbx_tmpl_alayer, stacks, scene, settings.anim_offset) File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\addons\io_scene_fbx\import_fbx.py", line 676, 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' location: <unknown location>:-1 location: <unknown location>:-1 ```

Am sorry, but we need a valid case to reproduce the issue, otherwise we can do nothing. Blender is an open, public project, generating a file demonstrating the issue should not be a real problem, if you cannot share the real one.

Am sorry, but we need a valid case to reproduce the issue, otherwise we can do nothing. Blender is an open, public project, generating a file demonstrating the issue should not be a real problem, if you cannot share the real one.

Uploaded .fbx produced error for me both in 2.78 and 2.79.
material_anim_test_1_sphere_stage_cleanLine.FBX

Uploaded .fbx produced error for me both in 2.78 and 2.79. [material_anim_test_1_sphere_stage_cleanLine.FBX](https://archive.blender.org/developer/F1044582/material_anim_test_1_sphere_stage_cleanLine.FBX)
Bastien Montagne self-assigned this 2017-10-18 15:26:24 +02:00

Thanks, could reproduce the issue. Think it's actually similar (if not same) issue as in #41712, some apps sometimes generate animation data linked to (virtual, non-existent) root node of the FBX file (your fix was indeed solving the problem, but more like treating the symptoms rather than the cause. ;) )…

Thanks, could reproduce the issue. Think it's actually similar (if not same) issue as in #41712, some apps sometimes generate animation data linked to (virtual, non-existent) root node of the FBX file (your fix was indeed solving the problem, but more like treating the symptoms rather than the cause. ;) )…

This issue was referenced by d42d87dde8

This issue was referenced by d42d87dde88e29df4f59241ba2e34967103492e5

This issue was referenced by 89285a88ab

This issue was referenced by 89285a88abbeb6886da3eefa9818012c6d760886

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
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-addons#53065
No description provided.