Move Clay properties into scene

Per collection overrides are gone now.
This commit is contained in:
Dalai Felinto 2018-05-16 21:28:05 +02:00
parent 15c2801aac
commit 09e419fa8d
7 changed files with 163 additions and 250 deletions

@ -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,

@ -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;

@ -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;
}
}
}
}

@ -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);
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 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 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_settings_create(RenderEngine *UNUSED(engine), IDProperty *props)
@ -964,8 +951,7 @@ static void clay_view_layer_settings_create(RenderEngine *UNUSED(engine), IDProp
BLI_assert(props &&
props->type == IDP_GROUP &&
props->subtype == IDP_GROUP_SUB_ENGINE_RENDER);
BKE_collection_engine_property_add_int(props, "ssao_samples", 16);
UNUSED_VARS_NDEBUG(props);
}
static void clay_engine_free(void)

@ -1361,6 +1361,19 @@ typedef struct DisplaySafeAreas {
typedef struct SceneDisplay {
float light_direction[3]; /* light direction for shadows/highlight */
float shadow_shift;
int matcap_icon;
int matcap_type;
float matcap_rotation;
float matcap_hue;
float matcap_saturation;
float matcap_value;
float matcap_ssao_distance;
float matcap_ssao_attenuation;
float matcap_ssao_factor_cavity;
float matcap_ssao_factor_edge;
float matcap_hair_brightness_randomness;
int matcap_ssao_samples;
} SceneDisplay;
typedef struct SceneEEVEE {

@ -278,46 +278,16 @@ static void rna_LayerEngineSettings_##_ENGINE_##_##_NAME_##_set(PointerRNA *ptr,
BKE_collection_engine_property_value_set_##_TYPE_##_array(props, #_NAME_, values); \
}
#define RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(_NAME_) \
RNA_LAYER_ENGINE_GET_SET(float, Clay, _NAME_)
#define RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT_ARRAY(_NAME_, _LEN_) \
RNA_LAYER_ENGINE_GET_SET_ARRAY(float, Clay, _NAME_, _LEN_)
#define RNA_LAYER_ENGINE_CLAY_GET_SET_INT(_NAME_) \
RNA_LAYER_ENGINE_GET_SET(int, Clay, _NAME_)
#define RNA_LAYER_ENGINE_CLAY_GET_SET_BOOL(_NAME_) \
RNA_LAYER_ENGINE_GET_SET(bool, Clay, _NAME_)
/* clay engine */
#ifdef WITH_CLAY_ENGINE
/* ViewLayer settings. */
RNA_LAYER_ENGINE_CLAY_GET_SET_INT(ssao_samples)
/* LayerCollection settings. */
RNA_LAYER_ENGINE_CLAY_GET_SET_INT(matcap_icon)
RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(matcap_rotation)
RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(matcap_hue)
RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(matcap_saturation)
RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(matcap_value)
RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(ssao_factor_cavity)
RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(ssao_factor_edge)
RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(ssao_distance)
RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(ssao_attenuation)
RNA_LAYER_ENGINE_CLAY_GET_SET_FLOAT(hair_brightness_randomness)
#endif /* WITH_CLAY_ENGINE */
#undef RNA_LAYER_ENGINE_GET_SET
static void rna_ViewLayerEngineSettings_update(bContext *C, PointerRNA *UNUSED(ptr))
static void UNUSED_FUNCTION(rna_ViewLayerEngineSettings_update)(bContext *C, PointerRNA *UNUSED(ptr))
{
Scene *scene = CTX_data_scene(C);
/* TODO(sergey): Use proper flag for tagging here. */
DEG_id_tag_update(&scene->id, 0);
}
static void rna_LayerCollectionEngineSettings_update(bContext *UNUSED(C), PointerRNA *ptr)
static void UNUSED_FUNCTION(rna_LayerCollectionEngineSettings_update)(bContext *UNUSED(C), PointerRNA *ptr)
{
ID *id = ptr->id.data;
/* TODO(sergey): Use proper flag for tagging here. */
@ -376,11 +346,6 @@ static StructRNA *rna_ViewLayerSettings_refine(PointerRNA *ptr)
switch (props->subtype) {
case IDP_GROUP_SUB_ENGINE_RENDER:
#ifdef WITH_CLAY_ENGINE
if (STREQ(props->name, RE_engine_id_BLENDER_CLAY)) {
return &RNA_ViewLayerEngineSettingsClay;
}
#endif
break;
default:
BLI_assert(!"Mode not fully implemented");
@ -433,11 +398,6 @@ static StructRNA *rna_LayerCollectionSettings_refine(PointerRNA *ptr)
switch (props->subtype) {
case IDP_GROUP_SUB_ENGINE_RENDER:
#ifdef WITH_CLAY_ENGINE
if (STREQ(props->name, RE_engine_id_BLENDER_CLAY)) {
return &RNA_LayerCollectionEngineSettingsClay;
}
#endif
break;
default:
BLI_assert(!"Mode not fully implemented");
@ -897,146 +857,6 @@ static void rna_def_scene_collection(BlenderRNA *brna)
RNA_def_function_return(func, parm);
}
#ifdef WITH_CLAY_ENGINE
static void rna_def_view_layer_engine_settings_clay(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
srna = RNA_def_struct(brna, "ViewLayerEngineSettingsClay", "ViewLayerSettings");
RNA_def_struct_ui_text(srna, "Clay Scene Layer Settings", "Clay Engine settings");
RNA_define_verify_sdna(0); /* not in sdna */
/* see RNA_LAYER_ENGINE_GET_SET macro */
prop = RNA_def_property(srna, "ssao_samples", PROP_INT, PROP_NONE);
RNA_def_property_int_funcs(prop, "rna_LayerEngineSettings_Clay_ssao_samples_get",
"rna_LayerEngineSettings_Clay_ssao_samples_set", NULL);
RNA_def_property_ui_text(prop, "Samples", "Number of samples");
RNA_def_property_range(prop, 1, 500);
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_ViewLayerEngineSettings_update");
RNA_define_verify_sdna(1); /* not in sdna */
}
#endif /* WITH_CLAY_ENGINE */
#ifdef WITH_CLAY_ENGINE
static void rna_def_layer_collection_engine_settings_clay(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
static const EnumPropertyItem clay_matcap_items[] = {
{ICON_MATCAP_01, "01", ICON_MATCAP_01, "", ""},
{ICON_MATCAP_02, "02", ICON_MATCAP_02, "", ""},
{ICON_MATCAP_03, "03", ICON_MATCAP_03, "", ""},
{ICON_MATCAP_04, "04", ICON_MATCAP_04, "", ""},
{ICON_MATCAP_05, "05", ICON_MATCAP_05, "", ""},
{ICON_MATCAP_06, "06", ICON_MATCAP_06, "", ""},
{ICON_MATCAP_07, "07", ICON_MATCAP_07, "", ""},
{ICON_MATCAP_08, "08", ICON_MATCAP_08, "", ""},
{ICON_MATCAP_09, "09", ICON_MATCAP_09, "", ""},
{ICON_MATCAP_10, "10", ICON_MATCAP_10, "", ""},
{ICON_MATCAP_11, "11", ICON_MATCAP_11, "", ""},
{ICON_MATCAP_12, "12", ICON_MATCAP_12, "", ""},
{ICON_MATCAP_13, "13", ICON_MATCAP_13, "", ""},
{ICON_MATCAP_14, "14", ICON_MATCAP_14, "", ""},
{ICON_MATCAP_15, "15", ICON_MATCAP_15, "", ""},
{ICON_MATCAP_16, "16", ICON_MATCAP_16, "", ""},
{ICON_MATCAP_17, "17", ICON_MATCAP_17, "", ""},
{ICON_MATCAP_18, "18", ICON_MATCAP_18, "", ""},
{ICON_MATCAP_19, "19", ICON_MATCAP_19, "", ""},
{ICON_MATCAP_20, "20", ICON_MATCAP_20, "", ""},
{ICON_MATCAP_21, "21", ICON_MATCAP_21, "", ""},
{ICON_MATCAP_22, "22", ICON_MATCAP_22, "", ""},
{ICON_MATCAP_23, "23", ICON_MATCAP_23, "", ""},
{ICON_MATCAP_24, "24", ICON_MATCAP_24, "", ""},
{0, NULL, 0, NULL, NULL}
};
srna = RNA_def_struct(brna, "LayerCollectionEngineSettingsClay", "LayerCollectionSettings");
RNA_def_struct_ui_text(srna, "Collections Clay Engine Settings", "Engine specific settings for this collection");
RNA_define_verify_sdna(0); /* not in sdna */
/* see RNA_LAYER_ENGINE_GET_SET macro */
prop = RNA_def_property(srna, "matcap_icon", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_funcs(prop, "rna_LayerEngineSettings_Clay_matcap_icon_get", "rna_LayerEngineSettings_Clay_matcap_icon_set", NULL);
RNA_def_property_enum_items(prop, clay_matcap_items);
RNA_def_property_ui_text(prop, "Matcap", "Image to use for Material Capture by this material");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, 0, "rna_LayerCollectionEngineSettings_update");
prop = RNA_def_property(srna, "matcap_rotation", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Clay_matcap_rotation_get", "rna_LayerEngineSettings_Clay_matcap_rotation_set", NULL);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Matcap Rotation", "Orientation of the matcap on the model");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, 0, "rna_LayerCollectionEngineSettings_update");
prop = RNA_def_property(srna, "matcap_hue", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Clay_matcap_hue_get", "rna_LayerEngineSettings_Clay_matcap_hue_set", NULL);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Matcap Hue Shift", "Hue correction of the matcap");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, 0, "rna_LayerCollectionEngineSettings_update");
prop = RNA_def_property(srna, "matcap_saturation", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Clay_matcap_saturation_get", "rna_LayerEngineSettings_Clay_matcap_saturation_set", NULL);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Matcap Saturation", "Saturation correction of the matcap");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, 0, "rna_LayerCollectionEngineSettings_update");
prop = RNA_def_property(srna, "matcap_value", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Clay_matcap_value_get", "rna_LayerEngineSettings_Clay_matcap_value_set", NULL);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Matcap Value", "Value correction of the matcap");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, 0, "rna_LayerCollectionEngineSettings_update");
prop = RNA_def_property(srna, "ssao_factor_cavity", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Clay_ssao_factor_cavity_get", "rna_LayerEngineSettings_Clay_ssao_factor_cavity_set", NULL);
RNA_def_property_ui_text(prop, "Cavity Strength", "Strength of the Cavity effect");
RNA_def_property_range(prop, 0.0f, 250.0f);
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, 0, "rna_LayerCollectionEngineSettings_update");
prop = RNA_def_property(srna, "ssao_factor_edge", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Clay_ssao_factor_edge_get", "rna_LayerEngineSettings_Clay_ssao_factor_edge_set", NULL);
RNA_def_property_ui_text(prop, "Edge Strength", "Strength of the Edge effect");
RNA_def_property_range(prop, 0.0f, 250.0f);
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, 0, "rna_LayerCollectionEngineSettings_update");
prop = RNA_def_property(srna, "ssao_distance", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Clay_ssao_distance_get", "rna_LayerEngineSettings_Clay_ssao_distance_set", NULL);
RNA_def_property_ui_text(prop, "Distance", "Distance of object that contribute to the Cavity/Edge effect");
RNA_def_property_range(prop, 0.0f, 100000.0f);
RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, 0, "rna_LayerCollectionEngineSettings_update");
prop = RNA_def_property(srna, "ssao_attenuation", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Clay_ssao_attenuation_get", "rna_LayerEngineSettings_Clay_ssao_attenuation_set", NULL);
RNA_def_property_ui_text(prop, "Attenuation", "Attenuation constant");
RNA_def_property_range(prop, 1.0f, 100000.0f);
RNA_def_property_ui_range(prop, 1.0f, 100.0f, 1, 3);
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, 0, "rna_LayerCollectionEngineSettings_update");
prop = RNA_def_property(srna, "hair_brightness_randomness", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_Clay_hair_brightness_randomness_get", "rna_LayerEngineSettings_Clay_hair_brightness_randomness_set", NULL);
RNA_def_property_ui_text(prop, "Hair Brightness Randomness", "Brightness randomness for hair");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, 0, "rna_LayerCollectionEngineSettings_update");
RNA_define_verify_sdna(1); /* not in sdna */
}
#endif /* WITH_CLAY_ENGINE */
static void rna_def_view_layer_settings(BlenderRNA *brna)
{
StructRNA *srna;
@ -1070,10 +890,6 @@ static void rna_def_view_layer_settings(BlenderRNA *brna)
parm = RNA_def_string(func, "identifier", NULL, 0, "Property Name", "Name of the property to unset");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
#ifdef WITH_CLAY_ENGINE
rna_def_view_layer_engine_settings_clay(brna);
#endif
RNA_define_verify_sdna(1);
}
@ -1110,10 +926,6 @@ static void rna_def_layer_collection_settings(BlenderRNA *brna)
parm = RNA_def_string(func, "identifier", NULL, 0, "Property Name", "Name of the property to unset");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
#ifdef WITH_CLAY_ENGINE
rna_def_layer_collection_engine_settings_clay(brna);
#endif
RNA_define_verify_sdna(1);
}

@ -5678,6 +5678,34 @@ static void rna_def_scene_display(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
static const EnumPropertyItem clay_matcap_items[] = {
{1, "01", ICON_MATCAP_01, "", ""},
{2, "02", ICON_MATCAP_02, "", ""},
{3, "03", ICON_MATCAP_03, "", ""},
{4, "04", ICON_MATCAP_04, "", ""},
{5, "05", ICON_MATCAP_05, "", ""},
{6, "06", ICON_MATCAP_06, "", ""},
{7, "07", ICON_MATCAP_07, "", ""},
{8, "08", ICON_MATCAP_08, "", ""},
{9, "09", ICON_MATCAP_09, "", ""},
{10, "10", ICON_MATCAP_10, "", ""},
{11, "11", ICON_MATCAP_11, "", ""},
{12, "12", ICON_MATCAP_12, "", ""},
{13, "13", ICON_MATCAP_13, "", ""},
{14, "14", ICON_MATCAP_14, "", ""},
{15, "15", ICON_MATCAP_15, "", ""},
{16, "16", ICON_MATCAP_16, "", ""},
{17, "17", ICON_MATCAP_17, "", ""},
{19, "18", ICON_MATCAP_18, "", ""},
{19, "19", ICON_MATCAP_19, "", ""},
{20, "20", ICON_MATCAP_20, "", ""},
{21, "21", ICON_MATCAP_21, "", ""},
{22, "22", ICON_MATCAP_22, "", ""},
{23, "23", ICON_MATCAP_23, "", ""},
{24, "24", ICON_MATCAP_24, "", ""},
{0, NULL, 0, NULL, NULL}
};
static float default_light_direction[3] = {-0.577350269, -0.577350269, 0.577350269};
srna = RNA_def_struct(brna, "SceneDisplay", NULL);
@ -5700,6 +5728,66 @@ static void rna_def_scene_display(BlenderRNA *brna)
RNA_def_property_ui_range(prop, 0.00f, 1.0f, 1, 2);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_set_update");
#ifdef WITH_CLAY_ENGINE
/* Matcap. */
prop = RNA_def_property(srna, "matcap_icon", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, clay_matcap_items);
RNA_def_property_enum_default(prop, 1);
RNA_def_property_ui_text(prop, "Matcap", "Image to use for Material Capture by this material");
prop = RNA_def_property(srna, "matcap_rotation", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_default(prop, 0.0f);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Matcap Rotation", "Orientation of the matcap on the model");
prop = RNA_def_property(srna, "matcap_hue", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_default(prop, 0.5f);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Matcap Hue Shift", "Hue correction of the matcap");
prop = RNA_def_property(srna, "matcap_saturation", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_default(prop, 0.5f);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Matcap Saturation", "Saturation correction of the matcap");
prop = RNA_def_property(srna, "matcap_value", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_default(prop, 0.5f);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Matcap Value", "Value correction of the matcap");
prop = RNA_def_property(srna, "matcap_ssao_factor_cavity", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_ui_text(prop, "Cavity Strength", "Strength of the Cavity effect");
RNA_def_property_range(prop, 0.0f, 250.0f);
prop = RNA_def_property(srna, "matcap_ssao_factor_edge", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_ui_text(prop, "Edge Strength", "Strength of the Edge effect");
RNA_def_property_range(prop, 0.0f, 250.0f);
prop = RNA_def_property(srna, "matcap_ssao_distance", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_default(prop, 0.2f);
RNA_def_property_ui_text(prop, "Distance", "Distance of object that contribute to the Cavity/Edge effect");
RNA_def_property_range(prop, 0.0f, 100000.0f);
RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
prop = RNA_def_property(srna, "matcap_ssao_attenuation", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_ui_text(prop, "Attenuation", "Attenuation constant");
RNA_def_property_range(prop, 1.0f, 100000.0f);
RNA_def_property_ui_range(prop, 1.0f, 100.0f, 1, 3);
prop = RNA_def_property(srna, "matcap_ssao_samples", PROP_INT, PROP_NONE);
RNA_def_property_int_default(prop, 16);
RNA_def_property_ui_text(prop, "Samples", "Number of samples");
RNA_def_property_range(prop, 1, 500);
prop = RNA_def_property(srna, "matcap_hair_brightness_randomness", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_default(prop, 0.0f);
RNA_def_property_ui_text(prop, "Hair Brightness Randomness", "Brightness randomness for hair");
RNA_def_property_range(prop, 0.0f, 1.0f);
#endif
}
static void rna_def_scene_eevee(BlenderRNA *brna)