Sometimes doing OpenGL render active viewport is a very fast way of rendering an animation, especially 2D animations, when no lighting or fancy shading is needed.
There is a problem where materials don’t update in the viewport, like switching textures or animating UV’s.
This little script helped me to fix that problem for both scrubbing through the timeline, and rendering/playblasting the viewport:
Tested in Blender v2.77. Just run it once after opening the .blend you are working on.
import bpy mats = bpy.data.materials def my_handler(scene): for m in mats: m.invert_z = False bpy.app.handlers.frame_change_pre.append(my_handler)
It adds a custom handler that loops through all the materials and sets a material property so Blender thinks it needs an update. I just picked invert_z because it has that value by default, and it doesnt ruin anything else.
I hope this helps some other people out!
Edit: Thanks for the code wrapping tip MCHammond and proxe!