diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2021-11-15 14:17:11 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2021-11-22 18:35:51 +0300 |
commit | 6cad8690c306bc4d55af15ae2b53cf686346d263 (patch) | |
tree | 0f1fbb165c6394fe5d4c0272a5dfb8a8e059fbb0 /source/blender/blenkernel | |
parent | 89adf516cd17c6345ef74efc0c52e53edae3d519 (diff) |
Fix T93074: Gpencil cutter not using flat caps in middle cuts
When cut an stroke using the option Flat Caps, the falt was not done if the cut was done in the middle of the stroke.
Now the flat is applied to the segments created and also some cleanup of the code done.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_gpencil_geom.h | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/gpencil_geom.c | 8 |
2 files changed, 9 insertions, 4 deletions
diff --git a/source/blender/blenkernel/BKE_gpencil_geom.h b/source/blender/blenkernel/BKE_gpencil_geom.h index a9bd0a524c4..8b3bfbd85f7 100644 --- a/source/blender/blenkernel/BKE_gpencil_geom.h +++ b/source/blender/blenkernel/BKE_gpencil_geom.h @@ -120,8 +120,9 @@ struct bGPDstroke *BKE_gpencil_stroke_delete_tagged_points(struct bGPdata *gpd, struct bGPDstroke *gps, struct bGPDstroke *next_stroke, int tag_flags, - bool select, - int limit); + const bool select, + const bool flat_cap, + const int limit); void BKE_gpencil_curve_delete_tagged_points(struct bGPdata *gpd, struct bGPDframe *gpf, struct bGPDstroke *gps, diff --git a/source/blender/blenkernel/intern/gpencil_geom.c b/source/blender/blenkernel/intern/gpencil_geom.c index fb6500cfe1b..6e5895430ff 100644 --- a/source/blender/blenkernel/intern/gpencil_geom.c +++ b/source/blender/blenkernel/intern/gpencil_geom.c @@ -2855,8 +2855,9 @@ bGPDstroke *BKE_gpencil_stroke_delete_tagged_points(bGPdata *gpd, bGPDstroke *gps, bGPDstroke *next_stroke, int tag_flags, - bool select, - int limit) + const bool select, + const bool flat_cap, + const int limit) { tGPDeleteIsland *islands = MEM_callocN(sizeof(tGPDeleteIsland) * (gps->totpoints + 1) / 2, "gp_point_islands"); @@ -2904,6 +2905,9 @@ bGPDstroke *BKE_gpencil_stroke_delete_tagged_points(bGPdata *gpd, for (idx = 0; idx < num_islands; idx++) { tGPDeleteIsland *island = &islands[idx]; new_stroke = BKE_gpencil_stroke_duplicate(gps, false, true); + if (flat_cap) { + new_stroke->caps[1 - (idx % 2)] = GP_STROKE_CAP_FLAT; + } /* if cyclic and first stroke, save to join later */ if ((is_cyclic) && (gps_first == NULL)) { |