[Bf-blender-cvs] [d1d7dc43734] soc-2019-npr: Gpencil: fixed "totweight" count in sample functions.
YimingWu
noreply at git.blender.org
Fri Jun 28 09:03:43 CEST 2019
Commit: d1d7dc43734ec3d2027c6cc29bafc3b337591b56
Author: YimingWu
Date: Fri Jun 28 15:00:20 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rBd1d7dc43734ec3d2027c6cc29bafc3b337591b56
Gpencil: fixed "totweight" count in sample functions.
===================================================================
M source/blender/blenkernel/intern/gpencil.c
===================================================================
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index c00a3f7e4a5..8f9a740cba4 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1589,6 +1589,7 @@ bool BKE_gpencil_sample_stroke(bGPDstroke *gps, float dist)
bGPDspoint *pt1 = NULL;
bGPDspoint *pt2 = NULL;
int i;
+ LinkData *ld;
ListBase def_nr_list = {0};
if (gps->totpoints < 2 || dist < FLT_EPSILON) {
@@ -1614,8 +1615,12 @@ bool BKE_gpencil_sample_stroke(bGPDstroke *gps, float dist)
bGPDspoint *new_pt = MEM_callocN(sizeof(bGPDspoint) * count, "gp_stroke_points_sampled");
MDeformVert *new_dv = NULL;
+
+ int result_totweight;
+
if (gps->dvert != NULL) {
- new_dv = stroke_defvert_new_count(gps->dvert->totweight, count, &def_nr_list);
+ stroke_defvert_create_nr_list(gps->dvert, count, &def_nr_list, &result_totweight);
+ new_dv = stroke_defvert_new_count(count, result_totweight, &def_nr_list);
}
int next_point_index = 1;
@@ -1668,6 +1673,9 @@ bool BKE_gpencil_sample_stroke(bGPDstroke *gps, float dist)
if (new_dv) {
BKE_gpencil_free_stroke_weights(gps);
+ while (ld = BLI_pophead(&def_nr_list)) {
+ MEM_freeN(ld);
+ }
gps->dvert = new_dv;
}
More information about the Bf-blender-cvs
mailing list