Vse New - Py

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

import bpy

bl_info = { "name": "VSE Transaction and Filters", "author": "Your Name",


"version": (1, 0), "blender": (2, 80, 0), "location": "Video Sequence Editor >
Strip > VSE Transaction and Filters", "description": "Perform transactions and
filters on VSE strips", "warning": "", "wiki_url": "", "category": "Video Editing",
}

class VSE_Transaction_Filter(bpy.types.Operator): """Perform transactions and


filters on VSE strips""" bl_idname = "sequencer.vse_transaction_filter" bl_label =
"VSE Transaction and Filters"

action: bpy.props.EnumProperty(
name="Action",
items=[
("TRANSLATE", "Translate", "Translate the selected strip"),
("ROTATE", "Rotate", "Rotate the selected strip"),
("SCALE", "Scale", "Scale the selected strip"),
("CROP", "Crop", "Crop the selected strip"),
("BLUR", "Blur", "Blur the selected strip"),
("BRIGHTNESS", "Brightness", "Adjust the brightness of the selected
strip"),
("CONTRAST", "Contrast", "Adjust the contrast of the selected strip"),
],
default="TRANSLATE",
)

def execute(self, context):


scene = context.scene
strips = scene.sequence_editor.selected_sequences

for strip in strips:


if self.action == "TRANSLATE":
strip.transform_offset_x += 10
strip.transform_offset_y += 10
elif self.action == "ROTATE":
strip.rotation += 45
elif self.action == "SCALE":
strip.scale_start_x += 0.1
strip.scale_start_y += 0.1
elif self.action == "CROP":
strip.crop_start_x += 0.1
strip.crop_start_y += 0.1
strip.crop_end_x -= 0.1
strip.crop_end_y -= 0.1
elif self.action == "BLUR":
strip.use_gaussian_blur = True
strip.gaussian_blur_sigma = 10
elif self.action == "BRIGHTNESS":
strip.use_brightness_contrast = True
strip.brightness = 0.5
elif self.action == "CONTRAST":
strip.use_brightness_contrast = True
strip.contrast = 0.5

return {"FINISHED"}
def menu_func(self, context):
self.layout.operator(VSE_Transaction_Filter.bl_idname)
def register(): bpy.utils.register_class(VSE_Transaction_Filter)
bpy.types.SEQUENCER_MT_strip.append(menu_func)

def unregister(): bpy.utils.unregister_class(VSE_Transaction_Filter)


bpy.types.SEQUENCER_MT_strip.remove(menu_func)

if name == "main": register()

You might also like