Workbench: respect the duplication visibility flag
authorJeroen Bakker <j.bakker@atmind.nl>
Thu, 7 Jun 2018 06:25:22 +0000 (08:25 +0200)
committerJeroen Bakker <j.bakker@atmind.nl>
Thu, 7 Jun 2018 07:26:06 +0000 (09:26 +0200)
source/blender/draw/engines/workbench/workbench_deferred.c
source/blender/draw/engines/workbench/workbench_forward.c

index aad4260241f6a6c6cb1ed1a4f3d7cdfd0a200c24..9e71ba551a1cac54d34f0cd6a107f98080162ae9 100644 (file)
@@ -661,7 +661,6 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob)
        WORKBENCH_StorageList *stl = vedata->stl;
        WORKBENCH_PassList *psl = vedata->psl;
        WORKBENCH_PrivateData *wpd = stl->g_data;
-
        if (!DRW_object_is_renderable(ob))
                return;
 
@@ -669,6 +668,10 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob)
                workbench_cache_populate_particles(vedata, ob);
        }
 
+       if (!DRW_check_object_visible_within_active_context(ob)) {
+               return;
+       }
+
        WORKBENCH_MaterialData *material;
        if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT)) {
                const DRWContextState *draw_ctx = DRW_context_state_get();
index 13821e0e57e6e7cae1194788b390eea80e046b8c..f313aee30ecd65c10ec1a6350d946e2bf12dd5a6 100644 (file)
@@ -517,6 +517,11 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob)
        if (ob->type == OB_MESH) {
                workbench_forward_cache_populate_particles(vedata, ob);
        }
+
+       if (!DRW_check_object_visible_within_active_context(ob)) {
+               return;
+       }
+
        if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT)) {
                const DRWContextState *draw_ctx = DRW_context_state_get();
                const bool is_active = (ob == draw_ctx->obact);