diff options
author | Jeroen Bakker <jbakker> | 2020-03-17 10:57:04 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2020-03-20 09:47:04 +0300 |
commit | 8ba9efb7d8ff399aaf3c65fd14272d0bc6f2ab39 (patch) | |
tree | 9a515c7fd5748f151e086bcdf33700961334cd0c /source/blender/draw/intern/draw_manager.c | |
parent | 4fc45c7a2b75df1a0e07150c101b664e189550b7 (diff) |
Fix T74811: GreasePencil Stereo Rendering
When using grease pencil in a stereo rendering the grease pencil objects are
only visible in the left eye. In the viewport it renders both.
Issue is related that `DRW_render_gpencil` only renders a single view. But
`DRW_render_to_image` renders all views. This patch puts this in a loop to
render both eyes.
Reviewed By: fclem
Differential Revision: https://developer.blender.org/D7154
Diffstat (limited to 'source/blender/draw/intern/draw_manager.c')
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index adaa1dd6151..cc618c76ccd 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -1627,6 +1627,13 @@ bool DRW_render_check_grease_pencil(Depsgraph *depsgraph) return false; } +static void drw_view_reset(void) +{ + DST.view_default = NULL; + DST.view_active = NULL; + DST.view_previous = NULL; +} + static void DRW_render_gpencil_to_image(RenderEngine *engine, struct RenderLayer *render_layer, const rcti *rect) @@ -1701,10 +1708,13 @@ void DRW_render_gpencil(struct RenderEngine *engine, struct Depsgraph *depsgraph RenderResult *render_result = RE_engine_get_result(engine); RenderLayer *render_layer = RE_GetRenderLayer(render_result, view_layer->name); - - DST.buffer_finish_called = false; - - DRW_render_gpencil_to_image(engine, render_layer, &render_rect); + for (RenderView *render_view = render_result->views.first; render_view != NULL; + render_view = render_view->next) { + RE_SetActiveRenderView(render, render_view->name); + drw_view_reset(); + DST.buffer_finish_called = false; + DRW_render_gpencil_to_image(engine, render_layer, &render_rect); + } /* Force cache to reset. */ drw_viewport_cache_resize(); @@ -1728,13 +1738,6 @@ void DRW_render_gpencil(struct RenderEngine *engine, struct Depsgraph *depsgraph DST.buffer_finish_called = false; } -static void drw_view_reset(void) -{ - DST.view_default = NULL; - DST.view_active = NULL; - DST.view_previous = NULL; -} - void DRW_render_to_image(RenderEngine *engine, struct Depsgraph *depsgraph) { Scene *scene = DEG_get_evaluated_scene(depsgraph); |