diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-09-27 17:40:18 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-09-27 18:19:00 +0300 |
commit | 7bbdc6996a71612b719053e62a9f753a3852e215 (patch) | |
tree | 2780d62dc48b69c122217d2c63ac0719f38b1af8 /source/blender/editors/uvedit/uvedit_draw.c | |
parent | b22afef72c5cab001b7458defc3d042742803b9d (diff) |
Fix T69941 Assert selecting UVs
Was caused by DRW_mesh_batch_cache_get_edituv_faces_stretch_area called
after DRW_mesh_batch_cache_create_requested. So it was created on the wrong
object/mesh.
Diffstat (limited to 'source/blender/editors/uvedit/uvedit_draw.c')
-rw-r--r-- | source/blender/editors/uvedit/uvedit_draw.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index bd941968418..fafd54804c0 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -177,6 +177,7 @@ static void uvedit_get_batches(Object *ob, float *tot_area, float *tot_area_uv) { + float *tmp_tot_area, *tmp_tot_area_uv; int drawfaces = draw_uvs_face_check(scene->toolsettings); const bool draw_stretch = (sima->flag & SI_DRAW_STRETCH) != 0; const bool draw_faces = (sima->flag & SI_NO_DRAWFACES) == 0; @@ -193,7 +194,8 @@ static void uvedit_get_batches(Object *ob, } if (draw_stretch && (sima->dt_uvstretch == SI_UVDT_STRETCH_AREA)) { - batches->faces = DRW_mesh_batch_cache_get_edituv_faces_stretch_area(ob->data, NULL, NULL); + batches->faces = DRW_mesh_batch_cache_get_edituv_faces_stretch_area( + ob->data, &tmp_tot_area, &tmp_tot_area_uv); } else if (draw_stretch) { batches->faces = DRW_mesh_batch_cache_get_edituv_faces_stretch_angle(ob->data); @@ -207,11 +209,11 @@ static void uvedit_get_batches(Object *ob, DRW_mesh_batch_cache_create_requested(ob, ob->data, scene, false, false); - /* after create_requested we can load the actual areas */ - float tmp_tot_area, tmp_tot_area_uv; - DRW_mesh_batch_cache_get_edituv_faces_stretch_area(ob->data, &tmp_tot_area, &tmp_tot_area_uv); - *tot_area += tmp_tot_area; - *tot_area_uv += tmp_tot_area_uv; + if (draw_stretch && (sima->dt_uvstretch == SI_UVDT_STRETCH_AREA)) { + /* after create_requested we can load the actual areas */ + *tot_area += *tmp_tot_area; + *tot_area_uv += *tmp_tot_area_uv; + } } static void draw_uvs_shadow(SpaceImage *UNUSED(sima), |