diff options
author | Bastien Montagne <bastien@blender.org> | 2022-01-31 17:16:36 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-01-31 17:16:36 +0300 |
commit | 180a68c1dcc7f18d746b43803e34119f31fc323d (patch) | |
tree | 15a60f84ba3ee4775d623ba936e1027f6e2754a2 /source/blender/makesrna/intern/rna_scene.c | |
parent | b9718899fa6448e96868de4e56a5a12835381ae1 (diff) |
Fix (studio-reported) missing RNA path for EEVEE render passes.
For those EEVEE passes a bit of trickery with pointer offsets allows to
get the owning viewlayer, so path generation is not too bad.
Also moved ViewLayer path generation itself into a public utils, to
avoid duplicating code.
NOTE: Doing the same for AOV would be needed, but since pointer offsets
won't help us here to find the owning viewlayer, not sure how to do it
nicely yet (only solution I think is to loop over all AOVs of all
ViewLayer of the scene to find it :( ).
Reported by Beau Gerbrands (@Beaug), thanks.
Diffstat (limited to 'source/blender/makesrna/intern/rna_scene.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 7f9890e492d..064dc255811 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1769,6 +1769,20 @@ void rna_ViewLayer_pass_update(Main *bmain, Scene *activescene, PointerRNA *ptr) rna_Scene_glsl_update(bmain, activescene, ptr); } +static char *rna_ViewLayerEEVEE_path(PointerRNA *ptr) +{ + ViewLayerEEVEE *view_layer_eevee = (ViewLayerEEVEE *)ptr->data; + ViewLayer *view_layer = (ViewLayer *)((uint8_t *)view_layer_eevee - offsetof(ViewLayer, eevee)); + char rna_path[sizeof(view_layer->name) * 3]; + + const size_t view_layer_path_len = rna_ViewLayer_path_buffer_get( + view_layer, rna_path, sizeof(rna_path)); + + BLI_strncpy(rna_path + view_layer_path_len, ".eevee", sizeof(rna_path) - view_layer_path_len); + + return BLI_strdup(rna_path); +} + static char *rna_SceneRenderView_path(PointerRNA *ptr) { SceneRenderView *srv = (SceneRenderView *)ptr->data; @@ -4019,6 +4033,7 @@ static void rna_def_view_layer_eevee(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; srna = RNA_def_struct(brna, "ViewLayerEEVEE", NULL); + RNA_def_struct_path_func(srna, "rna_ViewLayerEEVEE_path"); RNA_def_struct_ui_text(srna, "Eevee Settings", "View layer settings for Eevee"); prop = RNA_def_property(srna, "use_pass_volume_direct", PROP_BOOLEAN, PROP_NONE); |