From 67e32b31951b8b570148bd8b456afac27bb9645a Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Thu, 20 Aug 2015 10:35:14 +0300 Subject: Fix T45514 crash entering texpaint mode. In the file of the report, stencil and clone indices have fallen out of synch with the uv/mtexpoly layers. Looks like the file has a long history, coming from 2.49 even. Unfortunately reporter cannot recall exact steps to reproduce, so "fix" is to patch mesh.validate to fix those indices. --- source/blender/blenkernel/intern/mesh_validate.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'source/blender/blenkernel/intern/mesh_validate.c') diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c index 418c2911b5b..e21dde9c726 100644 --- a/source/blender/blenkernel/intern/mesh_validate.c +++ b/source/blender/blenkernel/intern/mesh_validate.c @@ -980,6 +980,24 @@ bool BKE_mesh_validate_all_customdata(CustomData *vdata, CustomData *edata, MAX_MCOL, tot_vcolloop - MAX_MCOL); } + /* check indices of clone/stencil */ + if (do_fixes && CustomData_get_clone_layer(pdata, CD_MTEXPOLY) >= tot_texpoly) { + CustomData_set_layer_clone(pdata, CD_MTEXPOLY, 0); + is_change_p = true; + } + if (do_fixes && CustomData_get_clone_layer(ldata, CD_MLOOPUV) >= tot_uvloop) { + CustomData_set_layer_clone(ldata, CD_MLOOPUV, 0); + is_change_l = true; + } + if (do_fixes && CustomData_get_stencil_layer(pdata, CD_MTEXPOLY) >= tot_texpoly) { + CustomData_set_layer_stencil(pdata, CD_MTEXPOLY, 0); + is_change_p = true; + } + if (do_fixes && CustomData_get_stencil_layer(ldata, CD_MLOOPUV) >= tot_uvloop) { + CustomData_set_layer_stencil(ldata, CD_MLOOPUV, 0); + is_change_l = true; + } + *r_change = (is_change_v || is_change_e || is_change_l || is_change_p); return is_valid; -- cgit v1.2.3