Hello Everyone,
What is the correct way to add a color strip to the VSE using python.
Nothing fancy, just add the default color strip at the current frame - for now, assuming the VSE is empty - no strips, so the channel could be any reasonable value.
I have viewed this post, and this one, but I am not having any luck.
when adding manually and referencing the info window, I see:
bpy.ops.sequencer.effect_strip_add(type=‘COLOR’, frame_start=64, frame_end=89, channel=2)
Keying this directly into the console throws an error:
Traceback (most recent call last):
File “<blender_console>”, line 1, in
File “/programs/Blender_2.83/2.83/scripts/modules/bpy/ops.py”, line 201, in call
ret = op_call(self.idname_py(), None, kw)
RuntimeError: Operator bpy.ops.sequencer.effect_strip_add.poll() failed, context is incorrect
From the post linked above, I have tried the following:
import bpy
bpy.context.active_object
get scene name, current frame, end frame & render resolution
CAS = bpy.context.scene.name
CFR = bpy.data.scenes[CAS].frame_current
EFR = CFR + 25
RRX = bpy.data.scenes[CAS].render.resolution_x
RRY = bpy.data.scenes[CAS].render.resolution_y
set initial values for location and line width
BBL = 10
BBW = 100
BBH = 50
BBX = RRX / 2
BBY = RRY / 2
create color strip
seq = bpy.context.scene.sequence_editor_create()
BBG = seq.effect_strip_add(type=‘COLOR’, frame_start=CFR, frame_end=EFR, channel=5)
print(CAS,CFR,EFR,RRX,RRY,BBL,BBX,BBY,BBL,BBW,BBH)
Which throws this error:
Traceback (most recent call last):
File “/home/MYDIR/Projects/PythonScripts/BorderBox_001.blend/BorderBox.py”, line 18, in
AttributeError: ‘SequenceEditor’ object has no attribute ‘effect_strip_add’
Error: Python script failed, check the message in the system console
This seems that it should be so simple, yet from searching, it seems that VSE, with respect to python is somewhat under-developed.
Any advice will be greatly appreciated.