From 41f4d210796dbfa5159fa6fe0b67094e62f25974 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 2 Sep 2018 15:28:03 +0200 Subject: Fix part of T56654: Freestyle hiding viewlayer buttons when there is no lineset. Buttons' context 'path' has to bee handled carefully, especially when building more than one step in a single call... --- source/blender/editors/space_buttons/buttons_context.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source/blender/editors/space_buttons') diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 05992bbd22d..e27dace4ba5 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -118,6 +118,13 @@ static int buttons_context_path_scene(ButsContextPath *path) static int buttons_context_path_view_layer(ButsContextPath *path, wmWindow *win) { + PointerRNA *ptr = &path->ptr[path->len - 1]; + + /* View Layer may have already been resolved in a previous call (e.g. in buttons_context_path_linestyle). */ + if (RNA_struct_is_a(ptr->type, &RNA_ViewLayer)) { + return 1; + } + if (buttons_context_path_scene(path)) { Scene *scene = path->ptr[path->len - 1].data; ViewLayer *view_layer = (win->scene == scene) ? -- cgit v1.2.3