Page MenuHome

Fix T76566: Fix slow FBX import of long animations
ClosedPublic

Authored by Philipp (Hotox) on Mon, May 18, 5:40 AM.

Details

Summary

This fixes the issue described here: T76566

Instead of adding the keyframe points one by one to the fcurves, add them all at once and modify them after. This drastically improves import speed of long animations.
As an example an animation that took over 10 minutes to import now only takes 20 seconds.

Diff Detail

Event Timeline

Philipp (Hotox) requested review of this revision.Mon, May 18, 5:40 AM
Philipp (Hotox) created this revision.

Ah very nice find, thanks for the patch, will do noted changes in remarks below and commit it.

Note that it slightly changes the behavior of the code though (not using 'NEEDED' option of keyframe_points.insert means that we may add more keyframes than needed... But think this is totally acceptable trade-of here.

io_scene_fbx/import_fbx.py
583

There is no reason to turn this into a string, can just be a tuple (path, index). Also fix issue noted below.

711–712

This assumes index is a single digit, which may be wrong sometimes.

720–722

using foreach_set instead increases further the performances (by about twice for me), will do that in a separate commit though, as it requires some changes in Blender itself (enum properties are not supported currently).

This revision is now accepted and ready to land.Fri, May 22, 3:23 PM