I am implementing RenderEngine.render_preview(self, scene) and want to export the scene data, to then render it with my engine. I wrote the export script myself, so modifying it is an option, if that helps.

Any ideas are greatly appreciated!

PS: I tried:

  • Overriding the context for the operator: seems not to be an option, since it needs to contain active_object from the scene the material preview scene was created for. Results in a Blender crash, actually.
  • Adding a scene attribute to my exporter: cannot be passed to bpy.ops.export_scene.foo as blender properties would be.
  • bpy.props.PointerProperty: not an option, since you cannot point to Scenes. Usually you would pass the scene index, but in this case the material preview scene is special enough to not show up in bpy.data.
  • 1
    $\begingroup$ What exactly is your problem? $\endgroup$
    – JakeD
    Aug 22, 2016 at 16:08
  • $\begingroup$ It's a little unclear what you're trying to accomplish. Keep in mind that this is a CGI site, so we're not quite as familiar with code as you seem to be ;-) It sounds like you're wanting to "extract" or otherwise access the scene that Blender uses for previewing material settings (in the Preview panel). Does that sound right? $\endgroup$
    – Matt
    Aug 22, 2016 at 21:18
  • $\begingroup$ <Keep in mind that this is a CGI site>: I kinda though Blender specific coding problems might be fine here, too, sorry! I misunderstood :/ Any idea where I should go for coding questions? I will try to ask the question somewhere else then, thank you for pointing it out! <Does that sound right?>: Almost. I have access to it, but in a slightly different way as opposed to a normal Blender scene and therefore cannot export it. It is pretty coding specific, though, as you noticed. $\endgroup$
    – Squareys
    Aug 23, 2016 at 7:09

1 Answer 1


Two options:

  1. If you really wanted to go the route of exporting the material preview scene, which would allow for forward compatibility in case the preview scene should ever change in blender, the only option would probably be to create a temporary scene, copy all the data from the scene received in the render_preview function and then export that.

But this is probably not worth the hassle, so I recommend to anybody who needs something like this:

  1. Get the material preview scene as a .blend from the blender code repository and export that once. Finally in the render_preview method, just manually serialize the material properties to get those into your custom engine.

I hope this helps somebody else struggling with this.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .