diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-05-01 18:59:33 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-05-01 18:59:40 +0300 |
commit | 01a720fc9f191772cfae48567075d13becac5900 (patch) | |
tree | 7dd26f45c61e6c9d730be7c165b43d71cacbfe74 /source | |
parent | 1bef7f9318c83523c5f9449eae2c1ad0823ac8dd (diff) |
Eevee: Fix crash when using visibility groups with dupli objects.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_materials.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c index 61c577d4d9c..fa5deb27b29 100644 --- a/source/blender/draw/engines/eevee/eevee_materials.c +++ b/source/blender/draw/engines/eevee/eevee_materials.c @@ -995,7 +995,12 @@ void EEVEE_materials_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) DRW_shgroup_call_sculpt_add(shgrp, ob, ob->obmat); \ } \ else { \ - DRW_shgroup_call_object_add_with_callback(shgrp, geom, ob, EEVEE_lightprobes_obj_visibility_cb, oedata); \ + if (oedata) { \ + DRW_shgroup_call_object_add_with_callback(shgrp, geom, ob, EEVEE_lightprobes_obj_visibility_cb, oedata); \ + } \ + else { \ + DRW_shgroup_call_object_add(shgrp, geom, ob); \ + } \ } \ } while (0) @@ -1378,6 +1383,7 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, EEVEE_ViewLayerData *sld struct Gwn_Batch **mat_geom = DRW_cache_object_surface_material_get(ob, gpumat_array, materials_len); if (mat_geom) { for (int i = 0; i < materials_len; ++i) { + EEVEE_ObjectEngineData *oedata = NULL; Material *ma = give_current_material(ob, i + 1); if (ma == NULL) @@ -1391,9 +1397,13 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, EEVEE_ViewLayerData *sld continue; } - EEVEE_ObjectEngineData *oedata = EEVEE_object_data_ensure(ob); - oedata->ob = ob; - oedata->test_data = &sldata->probes->vis_data; + /* XXX TODO rewrite this to include the dupli objects. + * This means we cannot exclude dupli objects from reflections!!! */ + if ((ob->base_flag & BASE_FROMDUPLI) == 0) { + oedata = EEVEE_object_data_ensure(ob); + oedata->ob = ob; + oedata->test_data = &sldata->probes->vis_data; + } /* Shading pass */ ADD_SHGROUP_CALL(shgrp_array[i], ob, mat_geom[i], oedata); |