Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-01-28 18:39:33 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-01-28 18:39:37 +0300
commit3fd4c88e3a2e9d99d45a0856fcc339e013c0a79a (patch)
treec9349a1f1fc7e80b113ce4110891e27992c12e98 /source/blender/draw/engines/workbench
parentfd0bc7e002ced8ffd85e9aa3edcae173dbd13392 (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')
-rw-r--r--source/blender/draw/engines/workbench/workbench_deferred.c4
-rw-r--r--source/blender/draw/engines/workbench/workbench_forward.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c b/source/blender/draw/engines/workbench/workbench_deferred.c
index 1af9357e015..15e8e1711dd 100644
--- a/source/blender/draw/engines/workbench/workbench_deferred.c
+++ b/source/blender/draw/engines/workbench/workbench_deferred.c
@@ -962,7 +962,7 @@ static void workbench_cache_populate_texture_paint_mode(WORKBENCH_Data *vedata,
}
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) {
@@ -1034,7 +1034,7 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob)
const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d) &&
!DRW_state_is_image_render();
const bool use_hide = is_active && DRW_object_use_hide_faces(ob);
- 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;
bool has_transp_mat = false;
const WORKBENCH_ColorOverride color_override = workbench_object_color_override_get(ob);
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() &&