Fix T53638: View layer renaming crashes 1/2

This fixes renaming via the interface.

This bug was introduced originally in 9515737b55. We need the id of the RNA
property to be the one that owns the data (view layer).

So it can't be the window's id, but the scene one instead.
This commit is contained in:
Dalai Felinto 2017-12-27 12:55:00 -02:00
parent bd80ace2da
commit b517dc9b2d
Notes: blender-bot 2023-02-14 08:06:38 +01:00
Referenced by issue #53638, View layer renaming crashes
1 changed files with 3 additions and 1 deletions

View File

@ -763,8 +763,10 @@ static PointerRNA rna_Window_view_layer_get(PointerRNA *ptr)
Scene *scene = WM_window_get_active_scene(win);
WorkSpace *workspace = WM_window_get_active_workspace(win);
ViewLayer *view_layer = BKE_workspace_view_layer_get(workspace, scene);
PointerRNA scene_ptr;
return rna_pointer_inherit_refine(ptr, &RNA_ViewLayer, view_layer);
RNA_id_pointer_create(&scene->id, &scene_ptr);
return rna_pointer_inherit_refine(&scene_ptr, &RNA_ViewLayer, view_layer);
}
static void rna_Window_view_layer_set(PointerRNA *ptr, PointerRNA value)