Addition
To make this answer clearer, here is the code for an operator and panel. The panel is added as the "TLA" tab in the Video Sequence Editor's side panel and contains a button labeled "Add Images". Pressing the button will bring up the file dialog, but with no filtering (I've removed the glob
variable). It assumes that Channel 1 is empty and appends all of the files from the dialog to that image strip.
import bpy
from bpy.types import Operator
from bpy.types import Panel
from bpy.props import StringProperty
from bpy.props import CollectionProperty
from bpy_extras.io_utils import ImportHelper
from pathlib import Path
class TLA_OT_addimages(Operator, ImportHelper):
""" add images to an image strip in the VSE"""
bl_idname = "vse.addimages"
bl_label = "Add Images"
bl_options = {"REGISTER", "UNDO"}
directory: StringProperty(
options={'HIDDEN'}
)
# This is used by fileselect_add if it is present.
files: CollectionProperty(type=bpy.types.PropertyGroup)
@classmethod
def poll(cls, context):
return True
def execute(self, context):
self.report({'INFO'},
f"execute()")
directory_path = Path(self.filepath).parent
file_list = []
for file in self.files:
file_list.append({"name":file.name})
bpy.ops.sequencer.image_strip_add(
directory=str(directory_path),
files=file_list,
relative_path=True,
channel=1,
fit_method='FIT'
)
return {'FINISHED'}
class TLA_PT_sidebar(Panel):
"""Display test button"""
bl_label = "Add images"
bl_space_type = "SEQUENCE_EDITOR"
bl_region_type = "UI"
bl_category = "TLA"
def draw(self, context):
col = self.layout.column(align=True)
prop = col.operator("vse.addimages")
classes = [
TLA_OT_addimages,
TLA_PT_sidebar,
]
def register():
for c in classes:
bpy.utils.register_class(c)
def unregister():
for c in classes:
bpy.utils.unregister_class(c)
because the operator is invoked from the UI of the sequence editor it does not need a context overrride.