diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2018-06-28 11:38:00 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2018-06-28 11:40:19 +0300 |
commit | 071ec6b397d55caa957f3decc4b99bf58de23926 (patch) | |
tree | cf984ae25ec18f324ee99b3cd1c68a6e419013b7 /source/blender/draw/intern/draw_cache_impl_mesh.c | |
parent | f09480b2125c6125212fb3f057ebb4a9061bc134 (diff) |
Workbench: Fix crash editing in texture modes without uv layer
When meshes has no uv layer, but has a texture assigned there was a uv
layer allocated which was corrupt. When no uv layer is available now
there won't be a vbo created. This might impact performance as the draw
cache does not cache this result.
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl_mesh.c')
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_mesh.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index c5d5eac51b7..94ebf7e0a14 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -2149,7 +2149,13 @@ static Gwn_VertBuf *mesh_batch_cache_get_tri_uv_active( { BLI_assert(rdata->types & (MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI | MR_DATATYPE_LOOP | MR_DATATYPE_LOOPUV)); + if (cache->tri_aligned_uv == NULL) { + const MLoopUV *mloopuv = rdata->mloopuv; + if (mloopuv == NULL) { + return NULL; + } + uint vidx = 0; static Gwn_VertFormat format = { 0 }; @@ -2166,7 +2172,6 @@ static Gwn_VertBuf *mesh_batch_cache_get_tri_uv_active( int vbo_len_used = 0; GWN_vertbuf_data_alloc(vbo, vbo_len_capacity); - const MLoopUV *mloopuv = rdata->mloopuv; BMEditMesh *embm = rdata->edit_bmesh; /* get uv's from active UVMap */ |