From 8730984c708bdde6a2cf29fc4f29bd50c05b349c Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 8 Mar 2019 11:49:49 +0100 Subject: Fix (unreported) datatransfer code could still modify source mesh in some cases. Source (i.e. other) mesh should not be modified in any case in modifier evaluation case (this is forbidden by design and can lead to all kind of threaded locks and crashes), and doing so even in operator case was never a good idea either. Now that we can specifically request needed data (poly and/or loop normals) from evaluation code, we can finally get rid of those computations inside data transfer/mesh remapping area. This is hopefully the last remaining bit of this 'bad crashing code' in datatransfer area. --- source/blender/blenkernel/intern/mesh_remap.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'source/blender/blenkernel/intern/mesh_remap.c') diff --git a/source/blender/blenkernel/intern/mesh_remap.c b/source/blender/blenkernel/intern/mesh_remap.c index 55e8a96fa16..7219332774a 100644 --- a/source/blender/blenkernel/intern/mesh_remap.c +++ b/source/blender/blenkernel/intern/mesh_remap.c @@ -1251,18 +1251,13 @@ void BKE_mesh_remap_calc_loops_from_mesh( } } if (need_pnors_src || need_lnors_src) { - /* Simpler for now, calcNormals never stores pnors :( */ - if (!CustomData_has_layer(&me_src->pdata, CD_NORMAL)) { - CustomData_add_layer(&me_src->pdata, CD_NORMAL, CD_CALLOC, NULL, me_src->totpoly); - CustomData_set_layer_flag(&me_src->pdata, CD_NORMAL, CD_FLAG_TEMPORARY); - } - BKE_mesh_calc_normals_split(me_src); - if (need_pnors_src) { poly_nors_src = CustomData_get_layer(&me_src->pdata, CD_NORMAL); + BLI_assert(poly_nors_src != NULL); } if (need_lnors_src) { loop_nors_src = CustomData_get_layer(&me_src->ldata, CD_NORMAL); + BLI_assert(loop_nors_src != NULL); } } } -- cgit v1.2.3