tin2tin / Blender_Screenwriter

Blender add-on for writing screenplays and convert them directly into timed storyboards.
193 stars 20 forks source link

Convert Script Scenes/Dialogue to Scene/Text Strips in the VSE #3

Closed tin2tin closed 5 years ago

tin2tin commented 5 years ago

The basic idea is to collect all script headings and make a new scene for each, and add them to the sequencer master scene(current scene) as scene strips(or dialogue as text strips). The duration of the scene/text strips should be calculated against one script page(56 lines) equals 1 minute.

This is a feature which should go into a tab in the Sequencer Sidebar, where you would have to select what text-block from text Text Editor should be converted into scene strips.

Bay Raitt writes: That screenplay editor in blender is so awesome I thought I'd share some of my code.

Since bender has the sequencer, and can create scene clips it makes sense that if fountain supports a "scene" concept it should generate a simple scene. you could even populate characters etc directly from the script.

To that end, I thought I'd share this. If the screenplay code generates a scene per scene call,

i.e. bpy.ops.scene.new ()

then the code below will generate a scene strip and add every scene loaded as a scene strip clip.

class BR_OT_regenerate_scene_video(bpy.types.Operator):
    """remake video sequencer scene strip from all scenes"""
    bl_idname = "view3d.regenerate_scene_video"
    bl_label = "Regenerate Video"
    bl_options = {'REGISTER', 'UNDO'}

    def execute(self, context):
        main_scene = bpy.context.scene
        count = 0
        original_type = bpy.context.area.type

        for a in bpy.context.screen.areas:
            if a.type == 'SEQUENCE_EDITOR':
                if a.spaces[0].view_type == 'SEQUENCER':  
                    bpy.context.area.type ="SEQUENCE_EDITOR"
                    for scene in http://bpy.data.scenes :
                        if scene is not main_scene :
                            bpy.ops.sequencer.scene_strip_add(frame_start=count, channel=1, scene=bpy.data.scenes[count].name)
                            activeStrip = bpy.context.scene.sequence_editor.active_strip            
                            bpy.context.scene.sequence_editor.sequences_all[activeStrip.name].frame_final_duration = 1
                        count = count + 1
                    bpy.context.area.type = original_type
        return {'FINISHED'}
spiraloid commented 5 years ago

wicked

tin2tin commented 5 years ago

Added this in v. 0.12.