prerendering for sequencer

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
AkhIL
Posts: 0
Joined: Tue Aug 30, 2005 12:51 pm
Location: Kemerovo, Siberia
Contact:

prerendering for sequencer

Post by AkhIL »

Hi.
I did simple script to increase sequencer functionality.

Idea is simple:

You select some _hard_ strip like scene or glow or even transitions which slowdowns playback and push rendering->sequencer preredner
script renders region where this hard strip located and puts rendered sequence over all strips. After it sequencer should play this sequence instead of rendering its source.

OK. But I have one problem.
BSE evaluates strips in _CRAZY_ order and I can't overlay part of timeline.

Please make some predictable order for strip rendering like render topmost strip.

This is cript listing:
sequencer_prerender.py

Code: Select all

#!BPY
"""
Name: 'Sequencer prerenderer'
Blender: 245
Group: 'Render'
Tooltip: 'renders selected strip to plain png sequence'
"""

##
#   Author: IL'dar AKHmetgaleev aka AkhIL
#   e-mail: akhilman at gmail dot com
#   web:    http://akhil.nm.ru
#
#   This code is licensed under 
#   Creative Commons Attribution 3.0 Unported License
#   http://creativecommons.org/licenses/by/3.0/
##

from Blender import *
scn = Scene.GetCurrent()
seq = scn.sequence

active_strip = seq.active

if not active_strip:
    print 'select one strip'
    raise Exception

start = active_strip.start \
        + active_strip.startOffset - active_strip.startStill
end = active_strip.start + active_strip.length - 1 \
        - active_strip.endOffset + active_strip.endStill

start = max(start,1)
end = max(end,1)

context = scn.getRenderingContext()

old_start = context.startFrame()
old_end = context.endFrame()
old_renderpath = context.renderPath
old_extensions = context.extensions
old_imagetype = context.imageType

context.startFrame(start)
context.endFrame(end)
context.renderPath = '//tmp/seq.prerender/'
context.extensions = True
context.imageType = Scene.Render.PNG

context.renderAnim()

channel = max( map( lambda x: x.channel, seq ) ) + 1
data = ( context.renderPath, map(lambda x: '%04d.png'%x, range(start,end+1)))
strip = seq.new(data,start,channel)
strip.name = "prerender"

context.startFrame(old_start)
context.endFrame(old_end)
context.renderPath = old_renderpath
context.extensions = old_extensions
context.imageType = old_imagetype

Window.RedrawAll()


spamagnet
Posts: 0
Joined: Tue Jul 01, 2008 3:28 am

Re: prerendering for sequencer

Post by spamagnet »

AkhIL wrote:I did simple script to increase sequencer functionality.
That looks cool, thanks! I have been thinking about implementing a simple media management system for the Blender VSE, and this script might give me some ideas.

Post Reply