4

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 !

tonton
  • 211
  • 2
  • 16

1 Answers1

4

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)
sambler
  • 55,387
  • 3
  • 59
  • 192
  • 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 ! – tonton Mar 06 '17 at 12:05