delta animation plugin

[TLDR]
here is a plugin I wrote a year ago: https://github.com/gavlig/blender-delta-anim/blob/master/delta_anim.py?ts=4

It calculates differences between 1-frame animation(delta) and a normal target animation and applies them across the whole target animation. However plugin doesn’t work anymore because left handles of bezier keyframes get corrupted(lowered) and target animation gets ruined. I recall it working for me before with this cheat applied https://www.blender.org/api/blender_python_api_2_78a_release/bpy.types.FCurve.html#bpy.types.FCurve.update but I can’t find where the regression happened and it’s time to find what the real problem is anyway.

here is a video explanation: https://youtu.be/YP_23DjCJQU

you can try that on this .blend: https://drive.google.com/open?id=0B_q1Py-dLG62YnBIcl80LUFBdlE
install plugin from github, select two strips(if they are not yet selected) and click “Apply” in “Delta Animation” section on the right panel in NLA editor.
[/TLDR]

Hello folks, I’ve got a little problem here and I might need your help to deal with it. It might be a long story, so go make a coffee or whatever your preferred kind of beer is. So for a few years now i’m slowly working on animations for this project unvanquished.net and most of them were looped actions, like walking, running, crouching etc and after making like 10th walk animation i’ve realized that pipeline can be improved but these two were stopping me from looking into blender api: https://xkcd.com/1319/ https://xkcd.com/1205/

Finally I gave up and wrote a plugin a year ago that allowed me to apply offsets to bones on all keyframes without tweaking them all separately. I take a 1-frame long animation(delta), compared its every bone position to 0th frame of a target animation(the one I want to change), created an offset for those bones and applied them across all animation. The implementation is not efficient, UX is terrible and overall plugin was quite slow since I probably used api in the most unorthodox way possible, but I didn’t spend too much time on writing it and the most pleasant part is that it worked and I actually used it and it saved me some time. I was going to publish that thing, but something happened and my memory of it got completely erased, Now all of a sudden my services were required once again, the dust was blown off blender, I tweaked some bones here and there and realized that there is still that plugin waiting. So I prepared a demo scene to record a video manual with, tried to use my plugin and failed miserably, because it has stopped working. After delta matrices got applied on target animation, all left handles on keyframes with bezier curves get messed up(lowered, to be precise) and that just ruins everything. I remember that this issue was present even before, but i somehow fixed it with this: https://www.blender.org/api/blender_python_api_2_78a_release/bpy.types.FCurve.html#bpy.types.FCurve.update (i guess i googled hard), but it doesn’t seem to work now. As you can see here https://github.com/gavlig/blender-delta-anim/blob/master/delta_anim.py?ts=4#L144 I’ve tried the dirtiest cheat possible and copied left/right handle values before changing them, but that didn’t work either, so my guess is that something else messes with my precious curves. So here comes the dearest audience, have any of you guys experienced anything like that before? Is it by design and I just don’t know something or it’s a bug and I should just report it? Anyway, I was in a mood for this wall of text, congrats if you finished reading it!

Any suggestions and comments are welcome!