TransWikia.com

How to color code strips in blender VSE?

Blender Asked by blenderuser001 on January 4, 2021

I created a button for the operator that I’m trying to create, but know I’m trying to figure out how to tell the operator to combine a color strip with MOVIE, IMAGE, and SOUND strips to change the color and therefore serve as a highlighter(for organization and categorizing). I intend to do this with blend_type(Method for controlling how the strip combines with other strips according to blender) but even with edit source code i cant find examples of how to use blend_type, any ideas or research tips?

class SimpleOperator(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.simple_operator"
    bl_label = "Simple Object Operator"

    @classmethod
    def poll(cls, context):
        return context.active_object is not None

    def execute(self, context): #combine color strip and strips
        #bend_type [CROSS] #COLOR,VALUE, HUE
        #type [] #'IMAGE’, ‘META’, ‘SCENE’, ‘MOVIE’, ‘MOVIECLIP’, ‘MASK’, ‘SOUND’,
        
        strip = act_strip(context)
        if strip.type = 'SOUND','IMAGE','AUDIO','MOVIE' 
        blend_type = 'HUE'

    
        return {'FINISHED'}
     
     #def invoke(self, context, event):
        #return self.execute(context)



    # test call
    #bpy.ops.object.simple_operator()

One Answer

The following code creates a color strip of the same length as the selection, puts it in channel 1 and creates a metastrip. It's a bare code with no checks of whatever. Hope this can get you on the way.

To test the code: open the scripting workspace and create a new text block. Copy the code in the text block. Select 1 or more clips in the video sequencer and run the code.

import bpy

sel_strips= bpy.context.selected_sequences


first_frame = 9999
last_frame = 0

#calculate first and last frame of selected strips to set the length of the color strip
for strip in sel_strips:
    if strip.frame_final_start < first_frame:
        first_frame = strip.frame_final_start
    if strip.frame_final_end > last_frame:
        last_frame = strip.frame_final_end


#the color strip is always put in channel 1; no check for replace or whatever
color_strip = bpy.context.scene.sequence_editor.sequences.new_effect(name='test', type='COLOR', frame_start=first_frame, frame_end=last_frame, channel=1)
#the color is set to red
color_strip.color = (1,0,0)

#this operator creates the metastrip
bpy.ops.sequencer.meta_make()

Answered by Husch on January 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP