diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-09-21 13:55:14 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-09-21 15:45:08 +0300 |
commit | 9ad2c0b6154b8e11521e9ee0422a79d5e0b9a2e1 (patch) | |
tree | 424a2422613eb855726d8b9e1a1b679d5e58f0c1 /source/blender/draw | |
parent | 77377f0ea8152d0ed5009a4940298b081b186787 (diff) |
Depsgraph and collection enable/visibility
Iterate over invisible objects too, so lamps can still lit the scene.
Also, now you can use a collection to set an object to invisible, not
only to visible.
For example:
Scene > Master collection > bedroom > furniture
Scene > View Layer > bedroom (visible)
> furniture (invisible)
The View Layer has two linked collections, bedroom and furniture.
This setup will make the furniture collection invisible.
Note: Unlike what was suggested on D2849, this does not make collection
visibility influence camera visibility. I will keep this as a separate
patch.
Reviewers: sergey
Subscribers: sergey, brecht, fclem
Differential Revision: https://developer.blender.org/D2849
Diffstat (limited to 'source/blender/draw')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_engine.c | 6 | ||||
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_lightprobes.c | 18 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 4 | ||||
-rw-r--r-- | source/blender/draw/modes/object_mode.c | 7 |
4 files changed, 30 insertions, 5 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c index e8821f23633..f27b5236d71 100644 --- a/source/blender/draw/engines/eevee/eevee_engine.c +++ b/source/blender/draw/engines/eevee/eevee_engine.c @@ -29,6 +29,8 @@ #include "BLI_dynstr.h" #include "BLI_rand.h" +#include "BKE_object.h" + #include "GPU_material.h" #include "GPU_glew.h" @@ -93,6 +95,10 @@ static void EEVEE_cache_populate(void *vedata, Object *ob) } if (ELEM(ob->type, OB_MESH)) { + if (!BKE_object_is_visible(ob)) { + return; + } + EEVEE_materials_cache_populate(vedata, sldata, ob); const bool cast_shadow = true; diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c index 96db3164fe1..a37dc091aa8 100644 --- a/source/blender/draw/engines/eevee/eevee_lightprobes.c +++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c @@ -590,7 +590,10 @@ static void EEVEE_planar_reflections_updates(EEVEE_SceneLayerData *sldata, EEVEE eplanar->attenuation_bias = max_dist * -eplanar->attenuation_scale; /* Debug Display */ - if (DRW_state_draw_support() && (probe->flag & LIGHTPROBE_FLAG_SHOW_DATA)) { + if (BKE_object_is_visible(ob) && + DRW_state_draw_support() && + (probe->flag & LIGHTPROBE_FLAG_SHOW_DATA)) + { DRWShadingGroup *grp = DRW_shgroup_create(e_data.probe_planar_display_sh, psl->probe_display); DRW_shgroup_uniform_int(grp, "probeIdx", &ped->probe_id, 1); @@ -643,8 +646,12 @@ static void EEVEE_lightprobes_updates(EEVEE_SceneLayerData *sldata, EEVEE_PassLi invert_m4(eprobe->parallaxmat); /* Debug Display */ - if (DRW_state_draw_support() && (probe->flag & LIGHTPROBE_FLAG_SHOW_DATA)) { - DRW_shgroup_call_dynamic_add(stl->g_data->cube_display_shgrp, &ped->probe_id, ob->obmat[3], &probe->data_draw_size); + if (BKE_object_is_visible(ob) && + DRW_state_draw_support() && + (probe->flag & LIGHTPROBE_FLAG_SHOW_DATA)) + { + DRW_shgroup_call_dynamic_add( + stl->g_data->cube_display_shgrp, &ped->probe_id, ob->obmat[3], &probe->data_draw_size); } } @@ -701,7 +708,10 @@ static void EEVEE_lightprobes_updates(EEVEE_SceneLayerData *sldata, EEVEE_PassLi copy_v3_v3_int(egrid->resolution, &probe->grid_resolution_x); /* Debug Display */ - if (DRW_state_draw_support() && (probe->flag & LIGHTPROBE_FLAG_SHOW_DATA)) { + if (BKE_object_is_visible(ob) && + DRW_state_draw_support() && + (probe->flag & LIGHTPROBE_FLAG_SHOW_DATA)) + { struct Gwn_Batch *geom = DRW_cache_sphere_get(); DRWShadingGroup *grp = DRW_shgroup_instance_create(e_data.probe_grid_display_sh, psl->probe_display, geom); DRW_shgroup_set_instance_count(grp, ped->num_cell); diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index bd143e33d09..b20c9fe013b 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -2164,6 +2164,10 @@ bool DRW_object_is_renderable(Object *ob) Scene *scene = DST.draw_ctx.scene; Object *obedit = scene->obedit; + if (!BKE_object_is_visible(ob)) { + return false; + } + if (ob->type == OB_MESH) { if (ob == obedit) { IDProperty *props = BKE_layer_collection_engine_evaluated_get(ob, COLLECTION_MODE_EDIT, ""); diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index 933f8a60b9f..22571808cbc 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -43,6 +43,7 @@ #include "BKE_camera.h" #include "BKE_curve.h" #include "BKE_global.h" +#include "BKE_object.h" #include "BKE_particle.h" #include "BKE_image.h" #include "BKE_texture.h" @@ -1562,7 +1563,7 @@ static void DRW_shgroup_lightprobe(OBJECT_StorageList *stl, Object *ob, SceneLay static void DRW_shgroup_relationship_lines(OBJECT_StorageList *stl, Object *ob) { - if (ob->parent && ((ob->parent->base_flag & BASE_VISIBLED) != 0)) { + if (ob->parent && BKE_object_is_visible(ob->parent)) { DRW_shgroup_call_dynamic_add(stl->g_data->relationship_lines, ob->obmat[3]); DRW_shgroup_call_dynamic_add(stl->g_data->relationship_lines, ob->parent->obmat[3]); } @@ -1677,6 +1678,10 @@ static void OBJECT_cache_populate(void *vedata, Object *ob) View3D *v3d = draw_ctx->v3d; int theme_id = TH_UNDEFINED; + if (!BKE_object_is_visible(ob)) { + return; + } + //CollectionEngineSettings *ces_mode_ob = BKE_layer_collection_engine_evaluated_get(ob, COLLECTION_MODE_OBJECT, ""); //bool do_wire = BKE_collection_engine_property_value_get_bool(ces_mode_ob, "show_wire"); |