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...
This commit is contained in:
Bastien Montagne 2018-09-02 15:28:03 +02:00
parent 32e8f2e982
commit 41f4d21079
Notes: blender-bot 2023-11-20 12:14:32 +01:00
Referenced by issue #56682, Blender 2.8, grease pencil in Edit mode, deselected vertices not visible
Referenced by issue #56685, (2.8) Compositing nodes not working
Referenced by issue #56675, Crash when snapping Cursor to selected a Bone in Edit Mode
Referenced by issue #56667, Cycles - Render Layer Node connection to File Output Node not possible
1 changed files with 7 additions and 0 deletions

View File

@ -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) ?