0
$\begingroup$

I have am using the VSE only in blender as a video editor. I have created three scenes:

  • Scene 1 - images (Add >> Image) in the VSE that render to mp4 movie
  • Scene 2 - movie clips (Add >> Movie) in the VSE that render to mp4 movie
  • Scene 3 - Scenes 1 and 2 (Add >> Scene) in the VSE that render to a mp4 movie

This seems to be working ok, but if I change Scene 1 or Scene 2 for example by adding more frames, it appears that I have to manually change Scene 3 to pick this up.

Is is possible for the Scene's in the VSE to automatically track their source objects?

$\endgroup$
  • 1
    $\begingroup$ The VSE has a button in its timeline window called Refresh Sequencer. You are supposed to click this each time you make a dependency change from other Blender components. $\endgroup$ – 3pointedit Oct 23 '16 at 9:34
1
$\begingroup$

This appears to be impossible.

We can force an update by setting the start and end frame values for Trim Hard. If the scene was not cut in the VSE and the values are 0 for both fields, we simply cycle through all the strips and set the fields to 0 for all scene type strips.

import bpy

def syncSceneLength(*pArgs):
    print("Syncing length of scene strips.")
    for s in bpy.context.scene.sequence_editor.sequences:
        if(s.type == "SCENE"):
            s.animation_offset_start = s.animation_offset_end = 0
def attachAsHandler():
    for f in bpy.app.handlers.frame_change_pre:
        bpy.app.handlers.frame_change_pre.remove(f)
    bpy.app.handlers.frame_change_pre.append(syncSceneLength)

syncSceneLength()
#attachAsHandler()

Paste the code in Blenders text editor. Pressing Run Script will update the scene strips in the VSE of the active scene.

I have added an option to attach the Update to the Frame Change Event. By removing the # character from the last line and running the script, the update function will be attached to the frame change event. On every frame change, the scene will sync the lengths of all scene strips. This may slow down Blender with an extremely large number of scene strips.

$\endgroup$
0
$\begingroup$

In the end, I used the following python script to automate this process for me.

Due to my lack of knowledge of the blender API, my approach was to delete all the strips in the third scene and then add in the strips again.

import bpy

def find_sequencer_area():
    screens = [bpy.context.screen]+list(bpy.data.screens)
    for screen in screens:
        for area in screen.areas:
            if area.type == 'SEQUENCE_EDITOR':
                return area
    return area

def add_strips(scene_name, scene_list):

    context = bpy.context
    scene = context.scene

    # check we are currently in the correct scene 
    if scene.name != scene_name:
        return None

    # delete strips
    seq = scene.sequence_editor
    for strip in seq.sequences:
        seq.sequences.remove(strip)

    # add strips
    start = 0
    channel = 0
    area = find_sequencer_area()

    for sc in scene_list:
        bpy.ops.sequencer.scene_strip_add({'area': area}, frame_start=start, channel=channel, scene=sc)
        bpy.data.scenes[scene_name].sequence_editor.sequences_all[sc].use_sequence = 1
        start = bpy.data.scenes[scene_name].sequence_editor.sequences_all[sc].frame_final_end + 1

    # set final frame position
    scene.frame_end = start - 1

add_strips('Scene.003', ['Scene.001', 'Scene.002'])
$\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.