diff options
author | Lukas Stockner <lukas.stockner@freenet.de> | 2019-01-18 02:45:21 +0300 |
---|---|---|
committer | Lukas Stockner <lukas.stockner@freenet.de> | 2019-01-18 02:58:28 +0300 |
commit | c9eef24903479a70783efb2e00766d0eeec43823 (patch) | |
tree | e8b7434dd06068e2030146fcd1922d44e95b5dcc /source/blender/nodes/composite | |
parent | af316e8bc87b053e5b50453c8c5081546777d4a9 (diff) |
Fix T56799: Custom render passes missing when using Save Buffers
The problem here was that when a render result is allocated, the standard render passes are added according to the
pass bitfield. Then, when the render engine sets the result, it adds the additional passes which are then merged
into the main render result.
However, when using Save Buffers, the EXR is created before the actual render starts, so it's missing all those
additional passes.
To fix that, we need to query the render engine for a list of additional passes so they can be added before the EXR
is created. Luckily, there already is a function to do that for the node editor.
The same needs to be done when the EXR is loaded back.
Due to how that is implemented though (Render API calls into engine, engine calls back for each pass), if we have
multiple places that call this function there needs to be a way to tell which one the call came from in the pass
registration callback. Therefore, the original caller now provides a callback that is called for each pass.
Diffstat (limited to 'source/blender/nodes/composite')
-rw-r--r-- | source/blender/nodes/composite/nodes/node_composite_image.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c index eb48d332f19..7f906ae27ce 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.c +++ b/source/blender/nodes/composite/nodes/node_composite_image.c @@ -213,6 +213,21 @@ void node_cmp_rlayers_register_pass(bNodeTree *ntree, bNode *node, Scene *scene, } } +static void cmp_node_rlayer_create_outputs_cb(RenderEngine *UNUSED(engine), Scene *scene, SceneRenderLayer *srl, + const char *name, int UNUSED(channels), const char *UNUSED(chanid), int type) +{ + /* Register the pass in all scenes that have a render layer node for this layer. + * Since multiple scenes can be used in the compositor, the code must loop over all scenes + * and check whether their nodetree has a node that needs to be updated. */ + /* NOTE: using G_MAIN seems valid here, + * unless we want to register that for every other temp Main we could generate??? */ + for (Scene *sce = G_MAIN->scene.first; sce; sce = sce->id.next) { + if (sce->nodetree) { + ntreeCompositRegisterPass(sce->nodetree, scene, srl, name, type); + } + } +} + static void cmp_node_rlayer_create_outputs(bNodeTree *ntree, bNode *node, LinkNodePair *available_sockets) { Scene *scene = (Scene *)node->id; @@ -228,7 +243,7 @@ static void cmp_node_rlayer_create_outputs(bNodeTree *ntree, bNode *node, LinkNo node->storage = data; RenderEngine *engine = RE_engine_create(engine_type); - engine_type->update_render_passes(engine, scene, srl); + RE_engine_update_render_passes(engine, scene, srl, cmp_node_rlayer_create_outputs_cb); RE_engine_free(engine); MEM_freeN(data); |