DrawManager/GreasePencil: Select Correct ViewLayer

The DrawManager assumed that the first render layer was the render layer
where GP needed to render on. In viewport this is always the case as we
only have a single view layer. When rendering this can be multiple when
multiple layers are rendered and composited in the compositor.

In stead of the assumption that the first render layer is the render
layer we need to draw on, we search for the render layer with the same
name as the viewlayer.

Reviewed By: fclem, brecht, antoniov

Maniphest Tasks: T63099

Differential Revision: https://developer.blender.org/D4818
This commit is contained in:
Jeroen Bakker 2019-05-07 15:01:12 +02:00
parent 0764cfe3de
commit 6ef48b1318
Notes: blender-bot 2023-02-14 05:51:15 +01:00
Referenced by issue #65059, Shift Ctrl Alt LMB / Ctrl Alt LMB in an empty scene closes / crashes Blender
Referenced by issue #64721, scatter object pannel gone missing
Referenced by issue #64571, Selecting Faces in Texture Paint Crashes Blender
Referenced by issue #64405, Eevee: Screen Space Reflections break with rotated dupli instances
1 changed files with 4 additions and 4 deletions

View File

@ -1883,9 +1883,9 @@ static void DRW_render_gpencil_to_image(RenderEngine *engine,
void DRW_render_gpencil(struct RenderEngine *engine, struct Depsgraph *depsgraph)
{
/* This function is only valid for Cycles
* Eevee done all work in the Eevee render directly.
* Maybe it can be done equal for both engines?
/* This function is only valid for Cycles & Workbench
* Eevee does all work in the Eevee render directly.
* Maybe it can be done equal for all engines?
*/
if (STREQ(engine->type->name, "Eevee")) {
return;
@ -1952,7 +1952,7 @@ void DRW_render_gpencil(struct RenderEngine *engine, struct Depsgraph *depsgraph
}
RenderResult *render_result = RE_engine_get_result(engine);
RenderLayer *render_layer = render_result->layers.first;
RenderLayer *render_layer = RE_GetRenderLayer(render_result, view_layer->name);
DRW_render_gpencil_to_image(engine, render_layer, &render_rect);