From 4c3ed98ca27667c3403361199096e31eaa93cce2 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Sun, 25 Nov 2018 09:50:34 -0200 Subject: Local View Bring back per-viewport localview. This is based on Blender 2.79. We have a limit of 16 different local view viewports. We are using both the numpad /, as well as the regular /. Missing features: * Hack to make sure lights are always visible. * Make rendered mode with external engines to support this as well (probably just need to support this in the RNA iterators). * Support over 16 viewports by taking existing viewports out of local view. The code can use a cleanup pass in the future to unify the test to see if an object is visible (or we can use TESTBASE in more places). --- source/blender/draw/intern/draw_manager.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'source/blender/draw/intern') diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 8846b6f1dc3..bc3e8c9f716 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -1426,9 +1426,13 @@ void DRW_draw_render_loop_ex( const int object_type_exclude_viewport = v3d->object_type_exclude_viewport; DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN(depsgraph, ob) { - if ((object_type_exclude_viewport & (1 << ob->type)) == 0) { - drw_engines_cache_populate(ob); + if ((object_type_exclude_viewport & (1 << ob->type)) != 0) { + continue; } + if (v3d->localvd && ((v3d->local_view_uuid & ob->base_local_view_bits) == 0)) { + continue; + } + drw_engines_cache_populate(ob); } DEG_OBJECT_ITER_FOR_RENDER_ENGINE_END; @@ -2043,7 +2047,7 @@ void DRW_draw_select_loop( #if 0 drw_engines_cache_populate(obact); #else - FOREACH_OBJECT_IN_MODE_BEGIN (view_layer, obact->mode, ob_iter) { + FOREACH_OBJECT_IN_MODE_BEGIN (view_layer, v3d, obact->mode, ob_iter) { drw_engines_cache_populate(ob_iter); } FOREACH_OBJECT_IN_MODE_END; @@ -2060,6 +2064,10 @@ void DRW_draw_select_loop( DEG_ITER_OBJECT_FLAG_VISIBLE | DEG_ITER_OBJECT_FLAG_DUPLI) { + if (v3d->localvd && ((v3d->local_view_uuid & ob->base_local_view_bits) == 0)) { + continue; + } + if ((ob->base_flag & BASE_SELECTABLE) && (object_type_exclude_select & (1 << ob->type)) == 0) { @@ -2237,9 +2245,15 @@ void DRW_draw_depth_loop( const int object_type_exclude_viewport = v3d->object_type_exclude_viewport; DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN(depsgraph, ob) { - if ((object_type_exclude_viewport & (1 << ob->type)) == 0) { - drw_engines_cache_populate(ob); + if ((object_type_exclude_viewport & (1 << ob->type)) != 0) { + continue; } + + if (v3d->localvd && ((v3d->local_view_uuid & ob->base_local_view_bits) == 0)) { + continue; + } + + drw_engines_cache_populate(ob); } DEG_OBJECT_ITER_FOR_RENDER_ENGINE_END; -- cgit v1.2.3