1
$\begingroup$

I wrote the code below, in Blender 2.8, to remove fcurve modifiers from fcurves.

def main_step():
        obs = bpy.context.selected_objects
        for ob in obs:
            fc = ob.animation_data.action.fcurves
            for i in fc:
                for j in i.modifiers:
                    i.modifiers.remove(j) 

It works, but the actual animation will not update. Only after I touch some animation curve points with the mouse the animation will update.

Is there a way to 'refresh' or update the graph editor?

$\endgroup$

1 Answer 1

3
$\begingroup$

Ok, damn, figured it out. I added one line of code that fixed it.

i.modifiers.update()

So now the function looks like this, and it works:

def main_step():
    obs = bpy.context.selected_objects
    for ob in obs:
        fc = ob.animation_data.action.fcurves
        for i in fc:
            for j in i.modifiers:
                i.modifiers.remove(j)
            i.modifiers.update()
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .