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_layer.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_layer.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_layer.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c index b02a5c8dc1e..278d611cc41 100644 --- a/source/blender/makesrna/intern/rna_layer.c +++ b/source/blender/makesrna/intern/rna_layer.c @@ -112,13 +112,24 @@ static void rna_LayerObjects_active_object_set(PointerRNA *ptr, } } +size_t rna_ViewLayer_path_buffer_get(ViewLayer *view_layer, + char *r_rna_path, + const size_t rna_path_buffer_size) +{ + char name_esc[sizeof(view_layer->name) * 2]; + BLI_str_escape(name_esc, view_layer->name, sizeof(name_esc)); + + return BLI_snprintf_rlen(r_rna_path, rna_path_buffer_size, "view_layers[\"%s\"]", name_esc); +} + static char *rna_ViewLayer_path(PointerRNA *ptr) { - ViewLayer *srl = (ViewLayer *)ptr->data; - char name_esc[sizeof(srl->name) * 2]; + ViewLayer *view_layer = (ViewLayer *)ptr->data; + char rna_path[sizeof(view_layer->name) * 3]; + + rna_ViewLayer_path_buffer_get(view_layer, rna_path, sizeof(rna_path)); - BLI_str_escape(name_esc, srl->name, sizeof(name_esc)); - return BLI_sprintfN("view_layers[\"%s\"]", name_esc); + return BLI_strdup(rna_path); } static IDProperty **rna_ViewLayer_idprops(PointerRNA *ptr) |