Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorJeroen Bakker <j.bakker@atmind.nl>2019-09-05 13:47:20 +0300
committerJeroen Bakker <j.bakker@atmind.nl>2019-09-11 13:19:44 +0300
commit7e61e597253f3ca75f2fb86a57212ca750ffbbe8 (patch)
tree6dbe0bf05fc3380f9729bf719ed1223997d5b0e3 /source
parentd4f8bc80a4bd69707a92e7141a2fb67d3f668c58 (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')
-rw-r--r--source/blender/blenkernel/intern/scene.c5
-rw-r--r--source/blender/blenloader/intern/readfile.c12
-rw-r--r--source/blender/blenloader/intern/writefile.c10
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c6
-rw-r--r--source/blender/makesdna/DNA_view3d_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_space.c14
6 files changed, 49 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 3ea009b0014..5054a0d1a4f 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -550,6 +550,11 @@ void BKE_scene_free_ex(Scene *sce, const bool do_id_user)
sce->eevee.light_cache = NULL;
}
+ if (sce->display.shading.prop) {
+ IDP_FreeProperty(sce->display.shading.prop);
+ sce->display.shading.prop = NULL;
+ }
+
/* These are freed on doversion. */
BLI_assert(sce->layer_properties == NULL);
}
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;
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 5974100b534..a8f662991b6 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -39,6 +39,7 @@
#include "BKE_context.h"
#include "BKE_curve.h"
#include "BKE_icons.h"
+#include "BKE_idprop.h"
#include "BKE_lattice.h"
#include "BKE_main.h"
#include "BKE_mball.h"
@@ -363,6 +364,11 @@ static void view3d_free(SpaceLink *sl)
if (vd->fx_settings.dof) {
MEM_freeN(vd->fx_settings.dof);
}
+
+ if (vd->shading.prop) {
+ IDP_FreeProperty(vd->shading.prop);
+ vd->shading.prop = NULL;
+ }
}
/* spacetype; init callback */
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index 3a7675eb92a..106bf1252b2 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -179,6 +179,8 @@ typedef struct View3DShading {
float curvature_ridge_factor;
float curvature_valley_factor;
+
+ struct IDProperty *prop;
} View3DShading;
/** 3D Viewport Overlay settings. */
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 4da0dd1d4ce..43f77a3cf88 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -458,6 +458,7 @@ const EnumPropertyItem rna_enum_file_sort_items[] = {
# include "BKE_brush.h"
# include "BKE_colortools.h"
# include "BKE_context.h"
+# include "BKE_idprop.h"
# include "BKE_layer.h"
# include "BKE_global.h"
# include "BKE_nla.h"
@@ -938,6 +939,18 @@ static bool rna_RegionView3D_is_orthographic_side_view_get(PointerRNA *ptr)
return RV3D_VIEW_IS_AXIS(rv3d->view);
}
+static IDProperty *rna_View3DShading_idprops(PointerRNA *ptr, bool create)
+{
+ View3DShading *shading = ptr->data;
+
+ if (create && !shading->prop) {
+ IDPropertyTemplate val = {0};
+ shading->prop = IDP_New(IDP_GROUP, &val, "View3DShading ID properties");
+ }
+
+ return shading->prop;
+}
+
static void rna_3DViewShading_type_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
ID *id = ptr->owner_id;
@@ -3003,6 +3016,7 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna)
RNA_def_struct_path_func(srna, "rna_View3DShading_path");
RNA_def_struct_ui_text(
srna, "3D View Shading Settings", "Settings for shading in the 3D viewport");
+ RNA_def_struct_idprops_func(srna, "rna_View3DShading_idprops");
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, rna_enum_shading_type_items);