diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-01-11 19:21:22 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-01-11 20:56:05 +0300 |
commit | 3a9909f38e702059085973ae2cb30aa1750bbfd4 (patch) | |
tree | a3abfa7ec42545d7dabf1b93239b3461a28c95ce /source/blender/draw/intern | |
parent | 1c7695b8483dc9bbcfd9dac26a652922062ea2b7 (diff) |
Fix T59990: Crash when entering edit mode with skin modifier enabled
The skin modifier does not keep the UV layers.
This just add a safety check when there is no UV layers.
Diffstat (limited to 'source/blender/draw/intern')
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_mesh.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index 92131a2e74c..5ed1bcb2f43 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -868,9 +868,9 @@ static MeshRenderData *mesh_render_data_create_ex( .vcol_len = CustomData_number_of_layers(cd_ldata, CD_MLOOPCOL), }; - rdata->cd.layers.uv_len = count_bits_i(cd_lused[CD_MLOOPUV]); + rdata->cd.layers.uv_len = min_ii(cd_layers_src.uv_len, count_bits_i(cd_lused[CD_MLOOPUV])); rdata->cd.layers.tangent_len = count_bits_i(cd_lused[CD_TANGENT]); - rdata->cd.layers.vcol_len = count_bits_i(cd_lused[CD_MLOOPCOL]); + rdata->cd.layers.vcol_len = min_ii(cd_layers_src.vcol_len, count_bits_i(cd_lused[CD_MLOOPCOL])); rdata->cd.layers.uv = MEM_mallocN(sizeof(*rdata->cd.layers.uv) * rdata->cd.layers.uv_len, __func__); rdata->cd.layers.vcol = MEM_mallocN(sizeof(*rdata->cd.layers.vcol) * rdata->cd.layers.vcol_len, __func__); @@ -3139,6 +3139,11 @@ static void mesh_create_loop_uv_and_tan(MeshRenderData *rdata, GPUVertBuf *vbo) } } + /* HACK: Create a dummy attrib in case there is no valid UV/tangent layer. */ + if (layers_combined_len == 0) { + GPU_vertformat_attr_add(&format, "dummy", GPU_COMP_U8, 1, GPU_FETCH_INT_TO_FLOAT_UNIT); + } + GPU_vertbuf_init_with_format(vbo, &format); GPU_vertbuf_data_alloc(vbo, loops_len); |