diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-06-16 19:04:57 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-06-16 19:04:57 +0300 |
commit | 5767dcbe60c07cd9ef113e2f54eaad6981a47bce (patch) | |
tree | 893f3b11ebebd97b4e50b8ecce1ee5c5d006ec3c /source/blender/editors/mesh/editmesh_tools.c | |
parent | b1b0781c1ed7148efc59287368f4b812a2a18c6e (diff) |
Fix T65809: Blender crash while using the Normal's "merge" option in edit mode.
Merge code will generate temp normal editing data for affected loops,
but since it will later (by setting some edges/faces to smooth) alter
and extend affected clnor spaces, it will also need temp normal editing
data for some other loops around those vertices...
Using those clnor editing data in that code is a bit of an abuse, but on
the other hand that struct stores exactly what we need.
So simply added an option to generate that editing data for all clnors
of affected vertices.
Diffstat (limited to 'source/blender/editors/mesh/editmesh_tools.c')
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index c4216d81317..c196a66332d 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -7689,7 +7689,7 @@ static int point_normals_init(bContext *C, wmOperator *op, const wmEvent *UNUSED BKE_editmesh_ensure_autosmooth(em); BKE_editmesh_lnorspace_update(em); - BMLoopNorEditDataArray *lnors_ed_arr = BM_loop_normal_editdata_array_init(bm); + BMLoopNorEditDataArray *lnors_ed_arr = BM_loop_normal_editdata_array_init(bm, false); op->customdata = lnors_ed_arr; @@ -8246,7 +8246,10 @@ static int normals_split_merge(bContext *C, const bool do_merge) BKE_editmesh_ensure_autosmooth(em); BKE_editmesh_lnorspace_update(em); - BMLoopNorEditDataArray *lnors_ed_arr = do_merge ? BM_loop_normal_editdata_array_init(bm) : NULL; + /* Note that we need temp lnor editing data for all loops of all affected vertices, since by + * setting some faces/edges as smooth we are going to change clnors spaces... See also T65809. */ + BMLoopNorEditDataArray *lnors_ed_arr = do_merge ? BM_loop_normal_editdata_array_init(bm, true) : + NULL; mesh_set_smooth_faces(em, do_merge); @@ -8573,7 +8576,7 @@ static int edbm_normals_tools_exec(bContext *C, wmOperator *op) BKE_editmesh_ensure_autosmooth(em); BKE_editmesh_lnorspace_update(em); - BMLoopNorEditDataArray *lnors_ed_arr = BM_loop_normal_editdata_array_init(bm); + BMLoopNorEditDataArray *lnors_ed_arr = BM_loop_normal_editdata_array_init(bm, false); BMLoopNorEditData *lnor_ed = lnors_ed_arr->lnor_editdata; float *normal_vector = scene->toolsettings->normal_vector; @@ -8867,7 +8870,7 @@ static int edbm_smoothen_normals_exec(bContext *C, wmOperator *op) BKE_editmesh_ensure_autosmooth(em); BKE_editmesh_lnorspace_update(em); - BMLoopNorEditDataArray *lnors_ed_arr = BM_loop_normal_editdata_array_init(bm); + BMLoopNorEditDataArray *lnors_ed_arr = BM_loop_normal_editdata_array_init(bm, false); float(*smooth_normal)[3] = MEM_callocN(sizeof(*smooth_normal) * lnors_ed_arr->totloop, __func__); |