diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-01-28 18:39:33 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-01-28 18:39:37 +0300 |
commit | 3fd4c88e3a2e9d99d45a0856fcc339e013c0a79a (patch) | |
tree | c9349a1f1fc7e80b113ce4110891e27992c12e98 /source/blender/draw/engines/workbench/workbench_forward.c | |
parent | fd0bc7e002ced8ffd85e9aa3edcae173dbd13392 (diff) |
Fix T72593 Blender crashes when modifier change the material count
Instead of changing the modifiers behavior, we make sure to always use
the data->totcol instead of the ob->totcol. Also we centralize getting
this number to avoid future issues.
Fix T72593 Blender crashes when separating mesh
Fix T72017 Crash on set visibility change
Diffstat (limited to 'source/blender/draw/engines/workbench/workbench_forward.c')
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_forward.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_forward.c b/source/blender/draw/engines/workbench/workbench_forward.c index ae001f8d10c..3e8c12c0bef 100644 --- a/source/blender/draw/engines/workbench/workbench_forward.c +++ b/source/blender/draw/engines/workbench/workbench_forward.c @@ -594,7 +594,7 @@ static void workbench_forward_cache_populate_texture_paint_mode(WORKBENCH_Data * } else { /* IMAGEPAINT_MODE_MATERIAL */ - const int materials_len = MAX2(1, ob->totcol); + const int materials_len = DRW_cache_object_material_count_get(ob); struct GPUBatch **geom_array = DRW_cache_mesh_surface_texpaint_get(ob); for (int i = 0; i < materials_len; i++) { if (geom_array != NULL && geom_array[i] != NULL) { @@ -668,7 +668,7 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob) if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL)) { const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d) && !DRW_state_is_image_render(); - const int materials_len = MAX2(1, ob->totcol); + const int materials_len = DRW_cache_object_material_count_get(ob); const Mesh *me = (ob->type == OB_MESH) ? ob->data : NULL; const WORKBENCH_ColorOverride color_override = workbench_object_color_override_get(ob); const bool use_texture_paint_drawing = !(DRW_state_is_image_render() && |