[Bf-committers] Patch: Render API preview function

Matt Ebb matt at mke3.net
Wed Dec 8 06:46:45 CET 2010


( Re-posted from the patch tracker, since it'll be down soon )

A while ago, Brecht added the do_preview flag for the render API, to
allow external renderers to generate preview renders for the property
editors (eg. materials). This was a good start, but it's not really
enough - it just exposes blender's internal preview.blend scene to the
render API, which often isn't very useful - it's heavily tailored to
blender's internal renderer and most other renderers are better served
by their own specific preview scenes that take advantage of that
renderer's capabilities.

This forces exporters to do all kinds of dodgy voodoo to replace the
blender preview scene - checking for a scene name of 'preview' and
trying to guess which is the active material being previewed by
looking over object names in the preview scene file, which is not very
robust.

The attached patch provides an optional 'render_preview' function for
exporters to implement, which gets called upon doing a preview render
(rather than the normal 'render' function). This means that exporters
know explicitly when a preview render is being called. Additionally,
as well as the scene, it passes in a pointer to the material in
question that's being previewed so you don't need to guess it. This
makes it much easier to send the material properties to a custom
preview scene for that render engine.

patch: http://mke3.net/blender/devel/2.5/render_api_preview.txt

https://projects.blender.org/tracker/index.php?func=detail&aid=25092&group_id=9&atid=127


cheers

Matt


More information about the Bf-committers mailing list