In my script I get access to all selected strips using below code:
selection = [ seq for seq in context.scene.sequence_editor.sequences if seq.select and seq.type == 'SPEED' ]
Now, this gives me a list of speed effects from the selection. I want to modify (basically remove and insert new) the FCurve for the
However I can't see how can I access the FCurves for this specific property.
I see than I can access all scene FCurves through
bpy.context.scene.animation_data.action.fcurves. However this seems to have at least two problems:
- I don't know how to properly create
SpeedControlSequenceinstance (the only thing I can think of is some string concatenations, but it doesn't sound like right solution),
- even if I had
data_pathvalue I am looking for I would have to scan through all FCurves for the whole scene to get to the one I want, which doesn't sound very efficient.
How can I access, modify and replace FCurves if I have specific instance of
One solution seems to be:
seq = # code to get one sequence instance f = None for f in bpy.context.scene.animation_data.action.fcurves: if f.data_path == seq.path_from_id("speed_factor"): break else: f = None
However it seems to be highly inefficient way of approaching that issue. Is there a better way to do it?