0
$\begingroup$

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()
$\endgroup$
  • $\begingroup$ Hi! Please consider that this site is not a forum rather a Q&A site. You don't have to ask the same question over and over again, you can just edit your question updating your research effort. How this site works: blender.stackexchange.com/tour My personal tip would be: Try Davinci Resolve. $\endgroup$ – brockmann Oct 27 '20 at 20:35
2
$\begingroup$

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()
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.