From af291eeccec1c50e397fbafb8a167173e4f0c331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Fri, 13 Jun 2025 16:00:40 +0200 Subject: [PATCH] Cleanup: ViewLayer: Move defaults to DNA defaults --- source/blender/blenkernel/intern/layer.cc | 9 --------- source/blender/makesdna/DNA_layer_defaults.h | 9 +++++++++ source/blender/makesrna/intern/rna_scene.cc | 2 -- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/source/blender/blenkernel/intern/layer.cc b/source/blender/blenkernel/intern/layer.cc index c13125f729c..87ca2553421 100644 --- a/source/blender/blenkernel/intern/layer.cc +++ b/source/blender/blenkernel/intern/layer.cc @@ -166,17 +166,8 @@ static ViewLayer *view_layer_add(const char *name) ViewLayer *view_layer = MEM_callocN("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; diff --git a/source/blender/makesdna/DNA_layer_defaults.h b/source/blender/makesdna/DNA_layer_defaults.h index d4aced5176c..2ce011352f5 100644 --- a/source/blender/makesdna/DNA_layer_defaults.h +++ b/source/blender/makesdna/DNA_layer_defaults.h @@ -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, \ } /** \} */ diff --git a/source/blender/makesrna/intern/rna_scene.cc b/source/blender/makesrna/intern/rna_scene.cc index c3677894028..637036cd33e 100644 --- a/source/blender/makesrna/intern/rna_scene.cc +++ b/source/blender/makesrna/intern/rna_scene.cc @@ -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");