[Bf-blender-cvs] [46b84938faa] soc-2019-npr: GPencil: Sample modifier accepts 3 points at least.

YimingWu noreply at git.blender.org
Thu Jul 18 08:34:02 CEST 2019


Commit: 46b84938faabc280c8ea96c8880b0492eccec553
Author: YimingWu
Date:   Thu Jul 18 14:33:34 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB46b84938faabc280c8ea96c8880b0492eccec553

GPencil: Sample modifier accepts 3 points at least.

===================================================================

M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c

===================================================================

diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 79166bec55f..46a0f51594d 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1682,17 +1682,6 @@ bool BKE_gpencil_sample_stroke(bGPDstroke *gps, float dist)
     pt[i].flag &= ~GP_SPOINT_TAG_FEATURE; /*  feature point preservation not implemented yet */
   }
 
-  float length = 0.0f;
-  float last_coord[3], this_coord[3];
-  pt1 = &gps->points[0];
-  copy_v3_v3(last_coord, &pt1->x);
-  for (i = 1; i < gps->totpoints; i++) {
-    pt1 = &gps->points[i];
-    copy_v3_v3(this_coord, &pt1->x);
-    length += len_v3v3(last_coord, this_coord);
-    copy_v3_v3(last_coord, &pt1->x);
-  }
-
   int count = stroke_march_count(gps, dist);
 
   bGPDspoint *new_pt = MEM_callocN(sizeof(bGPDspoint) * count, "gp_stroke_points_sampled");
@@ -1709,7 +1698,8 @@ bool BKE_gpencil_sample_stroke(bGPDstroke *gps, float dist)
   i = 0;
   float pressure, strength, ratio_result;
   int index_from, index_to;
-
+  float last_coord[3];
+  
   /*  1st point is always at the start */
   pt1 = &gps->points[0];
   copy_v3_v3(last_coord, &pt1->x);
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c
index 88fc1fb2e00..6cf83068a6f 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c
@@ -65,7 +65,7 @@ static void deformStroke(GpencilModifierData *md,
                                       mmd->layername,
                                       mmd->pass_index,
                                       mmd->layer_pass,
-                                      4,
+                                      mmd->mode == GP_SIMPLIFY_SAMPLE ? 3 : 4,
                                       gpl,
                                       gps,
                                       mmd->flag & GP_SIMPLIFY_INVERT_LAYER,



More information about the Bf-blender-cvs mailing list