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/intern/draw_cache_impl_curve.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/intern/draw_cache_impl_curve.c')
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_curve.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_curve.c b/source/blender/draw/intern/draw_cache_impl_curve.c index ab800e42cc0..05ec9bda642 100644 --- a/source/blender/draw/intern/draw_cache_impl_curve.c +++ b/source/blender/draw/intern/draw_cache_impl_curve.c @@ -414,7 +414,7 @@ static bool curve_batch_cache_valid(Curve *cu) return false; } - if (cache->mat_len != max_ii(1, cu->totcol)) { + if (cache->mat_len != DRW_curve_material_count_get(cu)) { return false; } @@ -914,6 +914,11 @@ GPUBatch *DRW_curve_batch_cache_get_edge_detection(Curve *cu, bool *r_is_manifol return DRW_batch_request(&cache->batch.edge_detection); } +int DRW_curve_material_count_get(Curve *cu) +{ + return max_ii(1, cu->totcol); +} + /** \} */ /* -------------------------------------------------------------------- */ |