I want to do an animated gltf file that shows how a set of molecules move. Using python, I created an object for each atom, 1558 atoms in total and then I added keyframes for updating the locations each frame. Then I exported to gltf and I can see the molecules moving alright in the online viewer. The problem is that there is an animation per each atom and I want only one animation in the file that includes all the atoms.
I tried putting all the actions in a single NLA strip but when I export the file I don't even see the strip in the viewer, not sure why (I do select the option for exporting NLA strips) and I still see the 1558 different animations. Any help would be appreciated.
If I create a few spheres and add keyframes manually, then everything is exported to a single animation as I want. When I compare this to the file generated with python, I see that the F curves created for the objects actions are grouped into an ActionGroup called 'object tranfroms' but that group is not generated when I insert the keyframes by scripting. I don't know if that grouping makes the GLTF have a single animation as I want.
How can I insert a keyframe programmatically that exactly replicates what happens when you manually press I over the object to insert it? I already tried adding an ActionGroup to the object but it is a read-only type and I think you can't add a F Curve to it.