Cleanup: ViewLayer: Move defaults to DNA defaults

This commit is contained in:
Clément Foucault
2025-06-13 16:00:40 +02:00
parent 77b2bbd78e
commit af291eecce
3 changed files with 9 additions and 11 deletions

View File

@@ -166,17 +166,8 @@ static ViewLayer *view_layer_add(const char *name)
ViewLayer *view_layer = MEM_callocN<ViewLayer>("View Layer");
*view_layer = *DNA_struct_default_get(ViewLayer);
view_layer->flag = VIEW_LAYER_RENDER | VIEW_LAYER_FREESTYLE;
STRNCPY_UTF8(view_layer->name, name);
/* Pure rendering pipeline settings. */
view_layer->layflag = SCE_LAY_FLAG_DEFAULT;
view_layer->passflag = SCE_PASS_COMBINED;
view_layer->pass_alpha_threshold = 0.5f;
view_layer->cryptomatte_levels = 6;
view_layer->cryptomatte_flag = VIEW_LAYER_CRYPTOMATTE_ACCURATE;
BKE_freestyle_config_init(&view_layer->freestyle_config);
return view_layer;

View File

@@ -22,6 +22,15 @@
#define _DNA_DEFAULT_ViewLayer \
{ \
.eevee = _DNA_DEFAULT_ViewLayerEEVEE, \
\
.flag = VIEW_LAYER_RENDER | VIEW_LAYER_FREESTYLE, \
\
/* Pure rendering pipeline settings. */ \
.layflag = SCE_LAY_FLAG_DEFAULT, \
.passflag = SCE_PASS_COMBINED, \
.pass_alpha_threshold = 0.5f, \
.cryptomatte_levels = 6, \
.cryptomatte_flag = VIEW_LAYER_CRYPTOMATTE_ACCURATE, \
}
/** \} */

View File

@@ -5149,7 +5149,6 @@ void rna_def_view_layer_common(BlenderRNA *brna, StructRNA *srna, const bool sce
prop = RNA_def_property(srna, "pass_cryptomatte_depth", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, nullptr, "cryptomatte_levels");
RNA_def_property_int_default(prop, 6);
RNA_def_property_range(prop, 2.0, 16.0);
RNA_def_property_ui_text(
prop, "Cryptomatte Levels", "Sets how many unique objects can be distinguished per pixel");
@@ -5159,7 +5158,6 @@ void rna_def_view_layer_common(BlenderRNA *brna, StructRNA *srna, const bool sce
prop = RNA_def_property(srna, "use_pass_cryptomatte_accurate", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(
prop, nullptr, "cryptomatte_flag", VIEW_LAYER_CRYPTOMATTE_ACCURATE);
RNA_def_property_boolean_default(prop, true);
RNA_def_property_ui_text(
prop, "Cryptomatte Accurate", "Generate a more accurate cryptomatte pass");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");