diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2019-09-05 13:47:20 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2019-09-11 13:19:44 +0300 |
commit | 7e61e597253f3ca75f2fb86a57212ca750ffbbe8 (patch) | |
tree | 6dbe0bf05fc3380f9729bf719ed1223997d5b0e3 /source/blender/blenloader | |
parent | d4f8bc80a4bd69707a92e7141a2fb67d3f668c58 (diff) |
Cycles: Display RenderPass in Viewport
This change allows the user to select a renderpass in the 3d viewport.
Added support for external renderers to extend the `View3DShading` struct.
This way Blender doesn't need to know the features an external render engine wants to support.
Note that the View3DShading is also available in the scene->display.shading; although this is
supported, it does not make sense for render engines to put something here as it is really
scene/workbench related.
Currently cycles assumes that it always needs to calculate the combined pass; it ignores the
`pass_flag` in KernelFilm. We could optimize this but that was not in scope of this change
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D5689
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 12 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 10 |
2 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index bd2580dba74..e9d4af447e0 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -6353,6 +6353,14 @@ static void direct_link_lightcache(FileData *fd, LightCache *cache) cache->grid_data = newdataadr(fd, cache->grid_data); } +static void direct_link_view3dshading(FileData *fd, View3DShading *shading) +{ + if (shading->prop) { + shading->prop = newdataadr(fd, shading->prop); + IDP_DirectLinkGroup_OrFree(&shading->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd); + } +} + /* check for cyclic set-scene, * libs can cause this case which is normally prevented, see (T#####) */ #define USE_SETSCENE_CHECK @@ -6987,6 +6995,8 @@ static void direct_link_scene(FileData *fd, Scene *sce) } } + direct_link_view3dshading(fd, &sce->display.shading); + sce->layer_properties = newdataadr(fd, sce->layer_properties); IDP_DirectLinkGroup_OrFree(&sce->layer_properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd); } @@ -7255,6 +7265,8 @@ static void direct_link_area(FileData *fd, ScrArea *area) v3d->fx_settings.ssao = newdataadr(fd, v3d->fx_settings.ssao); } + direct_link_view3dshading(fd, &v3d->shading); + blo_do_versions_view3d_split_250(v3d, &sl->regionbase); } else if (sl->spacetype == SPACE_GRAPH) { diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index c9c3a96fb32..d698c94dbfb 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2413,6 +2413,13 @@ static void write_view_settings(WriteData *wd, ColorManagedViewSettings *view_se } } +static void write_view3dshading(WriteData *wd, View3DShading *shading) +{ + if (shading->prop) { + IDP_WriteProperty(shading->prop, wd); + } +} + static void write_paint(WriteData *wd, Paint *p) { if (p->cavity_curve) { @@ -2684,6 +2691,8 @@ static void write_scene(WriteData *wd, Scene *sce) write_lightcache(wd, sce->eevee.light_cache); } + write_view3dshading(wd, &sce->display.shading); + /* Freed on doversion. */ BLI_assert(sce->layer_properties == NULL); } @@ -2850,6 +2859,7 @@ static void write_area_regions(WriteData *wd, ScrArea *area) if (v3d->fx_settings.dof) { writestruct(wd, DATA, GPUDOFSettings, 1, v3d->fx_settings.dof); } + write_view3dshading(wd, &v3d->shading); } else if (sl->spacetype == SPACE_GRAPH) { SpaceGraph *sipo = (SpaceGraph *)sl; |