From 110373de6a52a20eb759aea9a11e4c45fcdb619b Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Wed, 27 Dec 2017 13:32:30 -0200 Subject: Fix T53638: View layer renaming crashes 2/2 This fixes renaming the view layer via Python. This bug was introduced originally in 3a95bdfc65d. Although I suspect it was around for longer, since this commit didn't touch this part of the code. But basically we need the id of the RNA property to be the one that owns the data (view layer). --- source/blender/makesrna/intern/rna_context.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source/blender/makesrna/intern/rna_context.c') diff --git a/source/blender/makesrna/intern/rna_context.c b/source/blender/makesrna/intern/rna_context.c index 3df114282fd..bcd805b0f3a 100644 --- a/source/blender/makesrna/intern/rna_context.c +++ b/source/blender/makesrna/intern/rna_context.c @@ -132,7 +132,11 @@ static PointerRNA rna_Context_scene_get(PointerRNA *ptr) static PointerRNA rna_Context_view_layer_get(PointerRNA *ptr) { bContext *C = (bContext *)ptr->data; - return rna_pointer_inherit_refine(ptr, &RNA_ViewLayer, CTX_data_view_layer(C)); + Scene *scene = CTX_data_scene(C); + PointerRNA scene_ptr; + + RNA_id_pointer_create(&scene->id, &scene_ptr); + return rna_pointer_inherit_refine(&scene_ptr, &RNA_ViewLayer, CTX_data_view_layer(C)); } static PointerRNA rna_Context_view_render_get(PointerRNA *ptr) -- cgit v1.2.3