Results 1 to 7 of 7
  1. #1

    [SOLVED] Add Effect Strip Transform for Image VSE LM18

    Hello Blender Friends, Im from Germany and my english is not so good but I hope your understand my and can help.

    I will create a simple Slide show in VSE automatically but it don't work. I try some Scripts but they don't work.

    The first what I do, I make it manuel and look in the Info for the code.

    Until now I have one line that works.

    Code:
    import os
    import bpy
    
    bpy.context.scene.sequence_editor.active_strip.frame_final_duration = 26

    The second lines I try in different forms but they give my errors like this.
    I enter this in the Blender Console

    Code:
    >>> bpy.ops.sequencer.effect_strip_add(frame_start=0, frame_end=25, type='TRANSFORM')
    Traceback (most recent call last):
      File "<blender_console>", line 1, in <module>
      File "/home/tron/Downloads/blender-2.78c-linux-glibc219-x86_64/2.78/scripts/modules/bpy/ops.py", line 189, in __call__
        ret = op_call(self.idname_py(), None, kw)
    RuntimeError: Operator bpy.ops.sequencer.effect_strip_add.poll() failed, context is incorrect
    The code line from Blender Info if I make manuel add a Effect Strip.
    I try this in different other forms like this.

    Code:
    >>> bpy.ops.sequencer.active_strip.effect_strip_add(frame_start=0, frame_end=25, type='TRANSFORM')
    Traceback (most recent call last):
      File "<blender_console>", line 1, in <module>
    AttributeError: 'BPyOpsSubModOp' object has no attribute 'effect_strip_add'

    Does anyone know how I do can Add Effect Strip Transform for active strip Image?

    Greeting Tron


    blender-2.78c-linux-glibc219-x86_64

    Distro: Linux Mint 18 Sarah
    Kernel: 4.4.0-64-generic x86_64 (64 bit)
    Desktop: Cinnamon 3.0.7

    CPU: Quad core Intel Core2 Quad Q6600 (-MCP-) cache: 4096 KB
    clock speeds: max: 2400 MHz 1: 1600 MHz 2: 1600 MHz 3: 1600 MHz 4: 2400 MHz

    Graphics: Card: Advanced Micro Devices [AMD/ATI] Oland PRO [Radeon R7 240/340]
    Display Server: X.Org 1.18.3 drivers: ati,radeon (unloaded: fbdev,vesa)
    Resolution: 1280x1024@60.02hz, 1280x1024@60.02hz
    GLX Renderer: Gallium 0.4 on AMD OLAND (DRM 2.43.0, LLVM 3.8.0) GLX Version: 3.0 Mesa 11.2.0
    Last edited by Tron0070; 11-May-17 at 16:31.



  2. #2
    Member emu's Avatar
    Join Date
    Mar 2007
    Location
    GMT +2 (Czech Republic)
    Posts
    341
    The problem you encountered is that you can't call VSE operators from within Console or Text window, it must be VSE window. That would be possible if you define a new VSE operator from your code and then call it -- but I guess that would be too tricky for the simple thing you're trying to do.

    There are basically two ways of data access in blender python: Operators and direct data access. Unfortunately, the Sequencer data api is quite clumsy compared to Mesh or others, but still it can do anything that Operators would.

    To access the VSE at all, do this:
    Code:
    seq = bpy.context.scene.sequence_editor_create()
    Then, you can add a new Image strip (for example) like this:
    Code:
    slide = seq.sequences.new_image("slide", "~/tmp/00000008.IMG_2655.JPG", 0, 15)
    You'll have the slide saved in a variable, which allows you to easily access it (no matter if it's selected or not):
    Code:
    slide.frame_final_end = slide.frame_start + 5
    Read the API documentation if you need other types of video strips.
    Since I've got an interesting signature, I don't have to write interesting posts.



  3. #3
    Member doakey3's Avatar
    Join Date
    Sep 2011
    Location
    Oregon, United States
    Posts
    128
    If you want to use an operator, you can. You just need to set the context. Here's how I did it in my addon Bligify:

    Code:
    import bpy
    
    def find_sequencer_area():
        screens = list(bpy.data.screens)
        for screen in screens:
            for area in screen.areas:
                if area.type == "SEQUENCE_EDITOR":
                    return screen, area
    
    scene = bpy.data.scenes['Scene']
    sequence = scene.sequence_editor
    bpy.ops.sequencer.select_all(action="DESELECT")
    
    mystrip = sequence.sequences_all['a_picture.jpg']
    sequence.active_strip = mystrip
    
    screen, area = find_sequencer_area()
    window = bpy.context.window
    location = {
        "window": window,
        "scene": scene,
        "area": area,
        "screen": screen,
        "region": area.regions[0]
         }
    
    bpy.ops.sequencer.effect_strip_add(location, type="TRANSFORM")
    emu's solution looks promising though.



  4. #4
    Hello emu and doakey3, thank you for help.

    Both solutions work.
    But a name must always be specified in the script.

    With this small script it work without specifying a name and I've tried to adjust your scripts accordingly

    Code:
    import bpy
    bpy.context.scene.sequence_editor.active_strip.frame_final_duration = 100
    Actually, I just wanted to mark the strip and press on Run Script.

    Because there are several steps that must be executed. And only for one image strip. And there will be many more.

    1. 1 frame length get
    2. Add Transform
    3. from 16: 9 to 4: 3 or rotation and 3: 4
    4. Make Meta Strip
    5. get 100 frame length


    If you ask yourself why step 1 is set to 1
    And step 5 is set to 100
    I have just made a video here which explains it better.
    But this will make rendering faster with a slide show.

    https://youtu.be/L5k4Yfm19l4



  5. #5
    Member doakey3's Avatar
    Join Date
    Sep 2011
    Location
    Oregon, United States
    Posts
    128
    You don't need to specify a name. Just collect the strips into a list based on criteria (is it's type = 'IMAGE', or is it's channel = 1 etc.) Then use a for loop to iterate over each one and add your transform effect and do whatever else you want to it.

    Code:
    all_strips = list(sorted(sequence.sequences, key=lambda x: x.frame_start))
    
    image_strips = []
    for strip in all_strips:
        if strip.type == 'IMAGE':
            image_strips.append(strip)
    
    for image in image_strips:
        <here's where you add your transforms to each one>
    You could use a similar method to go back and iterate over each transform strip to adjust it's settings.



  6. #6
    I've tried it so. But I get an error. Do you know what I can do? I know this is a bit much but I can not Python I can only a bit Bash.


    Code:
    import os
    import bpy
    
    all_strips = list(sorted(sequence.sequences, key=lambda x: x.frame_start))
    
    image_strips = []
    for strip in all_strips:
        if strip.type == 'IMAGE':
            image_strips.append(strip)
    
    for image in image_strips:
        bpy.ops.sequencer.effect_strip_add(type='TRANSFORM')



  7. #7
    I have come to the decision that it is too complicated with Blender to create a slideshow.
    I now use the software "PhotoFilmStrip" to create a slideshow and then paste it into Blender.
    Then put together video material and picture material.

    Nevertheless, thanks for the great help.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •