Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2019-08-19 20:25:29 +0300
committerDalai Felinto <dfelinto@gmail.com>2019-09-13 18:37:35 +0300
commit92736a7b75920ffe4b8016a2d097ff8e36687c70 (patch)
tree33594ff97ce96124481ce9d898ea31158f91236c /source/blender/draw/intern/draw_manager.c
parentce34a6b0d727bbde6ae373afa8ec6c42bc8980ce (diff)
Per-Viewport Collection Visibility
Support per-viewport collection visibility options. Note 1: There is no way to show a collection that was not visible before due to depsgraph. Otherwise we would risk having all the collections in the depsgraph and I believe this is not the idea. An alternative would be to have a new depsgraph for viewports that are not local. Something to keep in mind if we do per-viewport current frame in the future. So for now what we do is to only allow collections visibility to be disabled/hidden in this mode. Note 2: hide_viewport (the eye icon) doesn't really matter for depsgraph. So after the merge we can still ignore it to show the collections locally in a viewport with no problems for the depsgraph. Reviewers: brecht, sergey Subscribers: billreynish Related task: T61327 Differential Revision: https://developer.blender.org/D5611
Diffstat (limited to 'source/blender/draw/intern/draw_manager.c')
-rw-r--r--source/blender/draw/intern/draw_manager.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index eea23211c5c..66e3905b212 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1565,6 +1565,20 @@ void DRW_draw_view(const bContext *C)
DRW_draw_render_loop_ex(depsgraph, engine_type, ar, v3d, viewport, C);
}
+static bool is_object_visible_in_viewport(View3D *v3d, Object *ob)
+{
+ if (v3d->localvd && ((v3d->local_view_uuid & ob->base_local_view_bits) == 0)) {
+ return false;
+ }
+
+ if ((v3d->flag & V3D_LOCAL_COLLECTIONS) &&
+ ((v3d->local_collections_uuid & ob->runtime.local_collections_bits) == 0)) {
+ return false;
+ }
+
+ return true;
+}
+
/**
* Used for both regular and off-screen drawing.
* Need to reset DST before calling this function
@@ -1640,7 +1654,7 @@ void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph,
if ((object_type_exclude_viewport & (1 << ob->type)) != 0) {
continue;
}
- if (v3d->localvd && ((v3d->local_view_uuid & ob->base_local_view_bits) == 0)) {
+ if (!is_object_visible_in_viewport(v3d, ob)) {
continue;
}
DST.dupli_parent = data_.dupli_parent;
@@ -2336,10 +2350,9 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph,
v3d->object_type_exclude_select);
bool filter_exclude = false;
DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN (depsgraph, ob) {
- if (v3d->localvd && ((v3d->local_view_uuid & ob->base_local_view_bits) == 0)) {
+ if (!is_object_visible_in_viewport(v3d, ob)) {
continue;
}
-
if ((ob->base_flag & BASE_SELECTABLE) &&
(object_type_exclude_select & (1 << ob->type)) == 0) {
if (object_filter_fn != NULL) {
@@ -2458,11 +2471,9 @@ static void drw_draw_depth_loop_imp(void)
if ((object_type_exclude_viewport & (1 << ob->type)) != 0) {
continue;
}
-
- if (v3d->localvd && ((v3d->local_view_uuid & ob->base_local_view_bits) == 0)) {
+ if (!is_object_visible_in_viewport(v3d, ob)) {
continue;
}
-
DST.dupli_parent = data_.dupli_parent;
DST.dupli_source = data_.dupli_object_current;
drw_duplidata_load(DST.dupli_source);