From 13ffef9c4a518c1c17b791cd00abe36f4bbf93e1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 14 Jan 2012 18:52:34 +0000 Subject: [PATCH] fix for weight paint when the mirror vertex was allocated (would free the original verts weight). was an error in own recent commit. --- .../blender/editors/sculpt_paint/paint_vertex.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 167af434853..21b27b2d3d3 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1655,7 +1655,20 @@ static void do_weight_paint_vertex( /* vars which remain the same for every vert } } else { - dw_mirr = defvert_verify_index(dv_mirr, vgroup_mirr); + if (index != index_mirr) { + dw_mirr = defvert_verify_index(dv_mirr, vgroup_mirr); + } + else { + /* dv and dv_mirr are the same */ + int totweight_prev = dv_mirr->totweight; + int dw_offset = (int)(dw - dv_mirr->dw); + dw_mirr = defvert_verify_index(dv_mirr, vgroup_mirr); + + /* if we added another, get our old one back */ + if (totweight_prev != dv_mirr->totweight) { + dw = &dv_mirr->dw[dw_offset]; + } + } } } else {