Slow FBX import of long animations #76566

Closed
opened 2020-05-08 21:39:49 +02:00 by Philipp · 3 comments

System Information
Operating system: Windows 10
Graphics card: RTX 2080

Blender Version
Broken:
2.83, 7a4e045d8f5f, 2020-05-07
2.90, c6cda3c09cd0, 2020-05-07
Worked: Never

Description of error
Long and complex FBX animations take extremely long to import while the exact same animations in BVH format get imported very quickly. As an example I attached a 50 second long motion capture animation of one armature. In BVH format it takes a few seconds to import, in FBX format it takes over 10 minutes.

This is caused by how the FBX importer adds keyframes to the fcurves compared to the BVH importer.
The FBX importer adds one keyframe at a time to the fcurve as seen here: (import_fbx.py, line 620)

for fc, v in zip(blen_curves, value):
    fc.keyframe_points.insert(frame, v, options={'NEEDED', 'FAST'}).interpolation = 'LINEAR'

The BVH importer adds all keyframes into one fcurve at once and modifies them afterwards: (import_bvh.py, line 587)

for axis_i in range(3):
    curve = action.fcurves.new(data_path=data_path, index=axis_i)
    keyframe_points = curve.keyframe_points
    keyframe_points.add(num_frame)

    for frame_i in range(num_frame):
        keyframe_points[frame_i].co = (
            time[frame_i],
            location[frame_i][axis_i],
        )

Solution
Adding all keyframes at once is significantly faster than adding them one after each other. So rewriting the FBX importer to use the same method as the BVH importer will significantly improve the import speed.

Exact steps for others to reproduce the error

  • Import the attached BVH animation
  • Import the attached FBX animation (it's exactly the same animation, but in FBX format)

ZombieWalk_DEFAULT_E89.bvh
ZombieWalk_DEFAULT_E89.fbx

**System Information** Operating system: Windows 10 Graphics card: RTX 2080 **Blender Version** Broken: 2.83, 7a4e045d8f5f, 2020-05-07 2.90, c6cda3c09cd0, 2020-05-07 Worked: Never **Description of error** Long and complex FBX animations take extremely long to import while the exact same animations in BVH format get imported very quickly. As an example I attached a 50 second long motion capture animation of one armature. In BVH format it takes a few seconds to import, in FBX format it takes over 10 minutes. This is caused by how the FBX importer adds keyframes to the fcurves compared to the BVH importer. The FBX importer adds one keyframe at a time to the fcurve as seen here: (import_fbx.py, line 620) ``` for fc, v in zip(blen_curves, value): fc.keyframe_points.insert(frame, v, options={'NEEDED', 'FAST'}).interpolation = 'LINEAR' ``` The BVH importer adds all keyframes into one fcurve at once and modifies them afterwards: (import_bvh.py, line 587) ``` for axis_i in range(3): curve = action.fcurves.new(data_path=data_path, index=axis_i) keyframe_points = curve.keyframe_points keyframe_points.add(num_frame) for frame_i in range(num_frame): keyframe_points[frame_i].co = ( time[frame_i], location[frame_i][axis_i], ) ``` **Solution** Adding all keyframes at once is significantly faster than adding them one after each other. So rewriting the FBX importer to use the same method as the BVH importer will significantly improve the import speed. **Exact steps for others to reproduce the error** - Import the attached BVH animation - Import the attached FBX animation (it's exactly the same animation, but in FBX format) [ZombieWalk_DEFAULT_E89.bvh](https://archive.blender.org/developer/F8521353/ZombieWalk_DEFAULT_E89.bvh) [ZombieWalk_DEFAULT_E89.fbx](https://archive.blender.org/developer/F8521352/ZombieWalk_DEFAULT_E89.fbx)
Author

Added subscriber: @Hotox

Added subscriber: @Hotox

This issue was referenced by 8e70aeae09

This issue was referenced by 8e70aeae091c5b3578ded4b6977150e6d19b3c48

Changed status from 'Needs Triage' to: 'Resolved'

Changed status from 'Needs Triage' to: 'Resolved'
Bastien Montagne self-assigned this 2020-05-22 15:45:49 +02:00
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#76566
No description provided.