[Bf-blender-cvs] [09e419fa8da] blender2.8: Move Clay properties into scene

Dalai Felinto noreply at git.blender.org
Wed May 16 23:16:18 CEST 2018


Commit: 09e419fa8da930b13651997417a434de308e697d
Author: Dalai Felinto
Date:   Wed May 16 21:28:05 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB09e419fa8da930b13651997417a434de308e697d

Move Clay properties into scene

Per collection overrides are gone now.

===================================================================

M	release/scripts/startup/bl_ui/properties_render.py
M	source/blender/blenkernel/intern/scene.c
M	source/blender/blenloader/intern/versioning_280.c
M	source/blender/draw/engines/clay/clay_engine.c
M	source/blender/makesdna/DNA_scene_types.h
M	source/blender/makesrna/intern/rna_layer.c
M	source/blender/makesrna/intern/rna_scene.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py
index 170f2627af5..93de404245f 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -431,25 +431,13 @@ class RENDER_PT_stereoscopy(RenderButtonsPanel, Panel):
             row.prop(rv, "camera_suffix", text="")
 
 
-class RENDER_PT_clay_layer_settings(RenderButtonsPanel, Panel):
-    bl_label = "Clay Layer Settings"
+class RENDER_PT_clay_settings(RenderButtonsPanel, Panel):
+    bl_label = "Clay Settings"
     COMPAT_ENGINES = {'BLENDER_CLAY'}
 
     def draw(self, context):
         layout = self.layout
-        props = context.scene.layer_properties['BLENDER_CLAY']
-
-        col = layout.column()
-        col.prop(props, "ssao_samples")
-
-
-class RENDER_PT_clay_collection_settings(RenderButtonsPanel, Panel):
-    bl_label = "Clay Collection Settings"
-    COMPAT_ENGINES = {'BLENDER_CLAY'}
-
-    def draw(self, context):
-        layout = self.layout
-        props = context.scene.collection_properties['BLENDER_CLAY']
+        props = context.scene.display
 
         col = layout.column()
         col.template_icon_view(props, "matcap_icon")
@@ -457,11 +445,12 @@ class RENDER_PT_clay_collection_settings(RenderButtonsPanel, Panel):
         col.prop(props, "matcap_hue")
         col.prop(props, "matcap_saturation")
         col.prop(props, "matcap_value")
-        col.prop(props, "ssao_factor_cavity")
-        col.prop(props, "ssao_factor_edge")
-        col.prop(props, "ssao_distance")
-        col.prop(props, "ssao_attenuation")
-        col.prop(props, "hair_brightness_randomness")
+        col.prop(props, "matcap_ssao_samples")
+        col.prop(props, "matcap_ssao_factor_cavity")
+        col.prop(props, "matcap_ssao_factor_edge")
+        col.prop(props, "matcap_ssao_distance")
+        col.prop(props, "matcap_ssao_attenuation")
+        col.prop(props, "matcap_hair_brightness_randomness")
 
 
 class RENDER_PT_eevee_ambient_occlusion(RenderButtonsPanel, Panel):
@@ -756,8 +745,7 @@ classes = (
     RENDER_PT_encoding,
     RENDER_UL_renderviews,
     RENDER_PT_stereoscopy,
-    RENDER_PT_clay_layer_settings,
-    RENDER_PT_clay_collection_settings,
+    RENDER_PT_clay_settings,
     RENDER_PT_eevee_sampling,
     RENDER_PT_eevee_film,
     RENDER_PT_eevee_shadows,
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index f387ad0d4ef..eb2b1bbe26f 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -827,6 +827,17 @@ void BKE_scene_init(Scene *sce)
 	copy_v3_v3(sce->display.light_direction, (float[3]){-M_SQRT1_3, -M_SQRT1_3, M_SQRT1_3});
 	sce->display.shadow_shift = 0.1;
 
+	sce->display.matcap_icon = 1;
+	sce->display.matcap_type = CLAY_MATCAP_NONE;
+	sce->display.matcap_hue = 0.5f;
+	sce->display.matcap_saturation = 0.5f;
+	sce->display.matcap_value = 0.5f;
+	sce->display.matcap_ssao_distance = 0.2f;
+	sce->display.matcap_ssao_attenuation = 1.0f;
+	sce->display.matcap_ssao_factor_cavity = 1.0f;
+	sce->display.matcap_ssao_factor_edge = 1.0f;
+	sce->display.matcap_ssao_samples = 16;
+
 	/* SceneEEVEE */
 	sce->eevee.gi_diffuse_bounces = 3;
 	sce->eevee.gi_cubemap_resolution = 512;
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 9c0ad15831b..eb351a247ab 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -1286,5 +1286,20 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
 #undef EEVEE_GET_BOOL
 			}
 		}
+
+		if (!DNA_struct_elem_find(fd->filesdna, "SceneDisplay", "int", "matcap_icon")) {
+			for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
+				scene->display.matcap_icon = 1;
+				scene->display.matcap_type = CLAY_MATCAP_NONE;
+				scene->display.matcap_hue = 0.5f;
+				scene->display.matcap_saturation = 0.5f;
+				scene->display.matcap_value = 0.5f;
+				scene->display.matcap_ssao_distance = 0.2f;
+				scene->display.matcap_ssao_attenuation = 1.0f;
+				scene->display.matcap_ssao_factor_cavity = 1.0f;
+				scene->display.matcap_ssao_factor_edge = 1.0f;
+				scene->display.matcap_ssao_samples = 16;
+			}
+		}
 	}
 }
diff --git a/source/blender/draw/engines/clay/clay_engine.c b/source/blender/draw/engines/clay/clay_engine.c
index 78d2d7b344c..9c4bc90d3a1 100644
--- a/source/blender/draw/engines/clay/clay_engine.c
+++ b/source/blender/draw/engines/clay/clay_engine.c
@@ -41,6 +41,8 @@
 
 #include "DRW_render.h"
 
+#include "DEG_depsgraph_query.h"
+
 #include "clay_engine.h"
 
 #ifdef WITH_CLAY_ENGINE
@@ -273,7 +275,7 @@ static struct GPUTexture *load_matcaps(PreviewImage *prv[24], int nbr)
 
 static int matcap_to_index(int matcap)
 {
-	return (int)matcap - (int)ICON_MATCAP_01;
+	return matcap - 1;
 }
 
 /* Using Hammersley distribution */
@@ -437,10 +439,8 @@ static void clay_engine_init(void *vedata)
 	/* SSAO setup */
 	{
 		const DRWContextState *draw_ctx = DRW_context_state_get();
-		ViewLayer *view_layer = draw_ctx->view_layer;
-		IDProperty *props = BKE_view_layer_engine_evaluated_get(
-		        view_layer, RE_engine_id_BLENDER_CLAY);
-		int ssao_samples = BKE_collection_engine_property_value_get_int(props, "ssao_samples");
+		Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph);
+		const int ssao_samples = scene_eval->display.matcap_ssao_samples;
 
 		float invproj[4][4];
 		float dfdyfacs[2];
@@ -639,18 +639,17 @@ static int hair_mat_in_ubo(CLAY_Storage *storage, const CLAY_HAIR_UBO_Material *
 static void ubo_mat_from_object(CLAY_Storage *storage, Object *UNUSED(ob), bool *r_needs_ao, int *r_id)
 {
 	const DRWContextState *draw_ctx = DRW_context_state_get();
-	ViewLayer *view_layer = draw_ctx->view_layer;
-	IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, RE_engine_id_BLENDER_CLAY);
-
-	int matcap_icon = BKE_collection_engine_property_value_get_int(props, "matcap_icon");
-	float matcap_rot = BKE_collection_engine_property_value_get_float(props, "matcap_rotation");
-	float matcap_hue = BKE_collection_engine_property_value_get_float(props, "matcap_hue");
-	float matcap_sat = BKE_collection_engine_property_value_get_float(props, "matcap_saturation");
-	float matcap_val = BKE_collection_engine_property_value_get_float(props, "matcap_value");
-	float ssao_distance = BKE_collection_engine_property_value_get_float(props, "ssao_distance");
-	float ssao_factor_cavity = BKE_collection_engine_property_value_get_float(props, "ssao_factor_cavity");
-	float ssao_factor_edge = BKE_collection_engine_property_value_get_float(props, "ssao_factor_edge");
-	float ssao_attenuation = BKE_collection_engine_property_value_get_float(props, "ssao_attenuation");
+	const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph);
+
+	const int matcap_icon = scene_eval->display.matcap_icon;
+	const float matcap_rot = scene_eval->display.matcap_rotation;
+	const float matcap_hue = scene_eval->display.matcap_hue;
+	const float matcap_sat = scene_eval->display.matcap_saturation;
+	const float matcap_val = scene_eval->display.matcap_value;
+	const float ssao_distance = scene_eval->display.matcap_ssao_distance;
+	const float ssao_factor_cavity = scene_eval->display.matcap_ssao_factor_cavity;
+	const float ssao_factor_edge = scene_eval->display.matcap_ssao_factor_edge;
+	const float ssao_attenuation = scene_eval->display.matcap_ssao_attenuation;
 
 	CLAY_UBO_Material r_ubo = {{0.0f}};
 
@@ -683,15 +682,14 @@ static void ubo_mat_from_object(CLAY_Storage *storage, Object *UNUSED(ob), bool
 static void hair_ubo_mat_from_object(Object *UNUSED(ob), CLAY_HAIR_UBO_Material *r_ubo)
 {
 	const DRWContextState *draw_ctx = DRW_context_state_get();
-	ViewLayer *view_layer = draw_ctx->view_layer;
-	IDProperty *props = BKE_view_layer_engine_evaluated_get(view_layer, RE_engine_id_BLENDER_CLAY);
+	const Scene *scene_eval = DEG_get_evaluated_scene(draw_ctx->depsgraph);
 
-	int matcap_icon = BKE_collection_engine_property_value_get_int(props, "matcap_icon");
-	float matcap_rot = BKE_collection_engine_property_value_get_float(props, "matcap_rotation");
-	float matcap_hue = BKE_collection_engine_property_value_get_float(props, "matcap_hue");
-	float matcap_sat = BKE_collection_engine_property_value_get_float(props, "matcap_saturation");
-	float matcap_val = BKE_collection_engine_property_value_get_float(props, "matcap_value");
-	float hair_randomness = BKE_collection_engine_property_value_get_float(props, "hair_brightness_randomness");
+	const int matcap_icon = scene_eval->display.matcap_icon;
+	const float matcap_rot = scene_eval->display.matcap_rotation;
+	const float matcap_hue = scene_eval->display.matcap_hue;
+	const float matcap_sat = scene_eval->display.matcap_saturation;
+	const float matcap_val = scene_eval->display.matcap_value;
+	const float hair_randomness = scene_eval->display.matcap_hair_brightness_randomness;
 
 	memset(r_ubo, 0x0, sizeof(*r_ubo));
 
@@ -945,18 +943,7 @@ static void clay_layer_collection_settings_create(RenderEngine *UNUSED(engine),
 	BLI_assert(props &&
 	           props->type == IDP_GROUP &&
 	           props->subtype == IDP_GROUP_SUB_ENGINE_RENDER);
-
-	BKE_collection_engine_property_add_int(props, "matcap_icon", ICON_MATCAP_01);
-	BKE_collection_engine_property_add_int(props, "type", CLAY_MATCAP_NONE);
-	BKE_collection_engine_property_add_float(props, "matcap_rotation", 0.0f);
-	BKE_collection_engine_property_add_float(props, "matcap_hue", 0.5f);
-	BKE_collection_engine_property_add_float(props, "matcap_saturation", 0.5f);
-	BKE_collection_engine_property_add_float(props, "matcap_value", 0.5f);
-	BKE_collection_engine_property_add_float(props, "ssao_distance", 0.2f);
-	BKE_collection_engine_property_add_float(props, "ssao_attenuation", 1.0f);
-	BKE_collection_engine_property_add_float(props, "ssao_factor_cavity", 1.0f);
-	BKE_collection_engine_property_add_float(props, "ssao_factor_edge", 1.0f);
-	BKE_collection_engine_property_add_float(props, "hair_brightness_randomness", 0.0f);
+	UNUSED_VARS_NDEBUG(props);
 }
 
 static void clay_view_layer_set

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list