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$
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()
|improve this answer|||||
$\endgroup$

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.