3
$\begingroup$

Hello all blenderheads ! i'm trying to write a simple tool to split a frame in piece with the great animated render border addon ! so far so good, all's working but i need a way to delete the created keyframes of the border render, i can't figure it out ! so far i've got :

for scene in bpy.data.scenes:
for fcurves in scene.animation_data.action.fcurves:
    if fcurves.data_path.startswith("animated_render_border"):
        fcurves.animation_data_clear()

The startswith method work to change interpolation of the keyframe, so my problem comes from the

fcurves.animation_data_clear()

I tried several other ways, nothing works... any idea out there ? Thanks you all !

$\endgroup$
3
$\begingroup$

As you know the scenes animation fcurves are found in

fc = bpy.context.scene.animation_data.action.fcurves

The fcurves list has a remove method -

fc.remove(fc[0])

Which leads to changing your code to

for scene in bpy.data.scenes:
    fcurves = scene.animation_data.action.fcurves
    for c in fcurves:
        if c.data_path.startswith("animated_render_border"):
            fcurves.remove(c)
$\endgroup$
  • $\begingroup$ perfect thank you very much sir ! i tried this one, but did'nt fill the () argument, didn't really get it ! (sorry, new to python) Works like a charm ! $\endgroup$ – tonton Mar 6 '17 at 12:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.