How do I update the image editor with rendered image?

Hi all, I’m working on putting pieces of scripts together to get a more integrated Appleseed exporter/rendering interface (just for fun? Just for my own personal use? I dunno).

Rendering can be done either via command line or via the GUI. Either way, I’d like to be able to update the image editor with the rendered image after rendering finishes. Hey, even WHILE it’s rendering, that would be great.

Can someone tell me how that’s done? Is there a particular function in bpy.types.RenderEngine that can be called to assist with that?

See the check for ‘preview’ in the example code, maybe that helps

Here is a code section from the 3Delight exporter.

        def update_image():
            result = engine.begin_result(0, 0, engine.rpass.resolution[0], engine.rpass.resolution[1])
            lay = result.layers[0]
            # possible the image wont load early on.

layers has a load_from_file method otherwise you will have to construct an array of pixels.

How does one ‘construct an array of pixels’ here? I’m slowly getting these examples, but it’s still really vague to me…

The custom render engine example code shows how to construct a pixel array. Inside def render_scene.

Mmkay, thank you. The words in that section are kind of ambiguous to me for some reason, I guess I just need to test it out and see what it does in order to make it “real” to me.