Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Vazquez <blendergit@gmail.com>2020-11-18 23:30:43 +0300
committerAntonio Vazquez <blendergit@gmail.com>2020-11-18 23:35:06 +0300
commite9607f45d85df6df834a80f147b8c42ff12f56f2 (patch)
treeeeea0e6c742f557798d3e8011bf84c8d806c0b12 /source/blender/editors/include
parentc126e27cdc8b28365a9d5f9fafc4d521d1eb83df (diff)
GPencil: Automerge last drawn stroke with previous strokes
This option joins any stroke with an end near the actual stroke. Now it is not limited to the last stroke, any stroke in the same layer for the actual frame can be joined. The join can join two strokes drawing a third stroke. If the end and the start of the result stroke are very small, the stroke is changed to be cyclic automatically. There is a limit distance to join the stroke, if the distance is greater than this value, the strokes are not joined. Actually, a constant, threshold distance is used, but we could expose as a parameter in the UI in the future. The tool can be used with freehand drawing or with primitives. Note: Great part of the patch is just a refactor of the old code to make it accessible and to keep code organized. Reviewed By: mendio Maniphest Tasks: T82377 Differential Revision: https://developer.blender.org/D9440
Diffstat (limited to 'source/blender/editors/include')
-rw-r--r--source/blender/editors/include/ED_gpencil.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h
index 17aa407bd76..be2f714dfe1 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -63,6 +63,8 @@ struct bAnimContext;
struct wmKeyConfig;
struct wmOperator;
+#define GPENCIL_MINIMUM_JOIN_DIST 20.0f
+
/* Reproject stroke modes. */
typedef enum eGP_ReprojectModes {
/* Axis */
@@ -366,6 +368,22 @@ bool ED_gpencil_stroke_point_is_inside(struct bGPDstroke *gps,
int mouse[2],
const float diff_mat[4][4]);
+struct bGPDstroke *ED_gpencil_stroke_nearest_to_ends(struct bContext *C,
+ struct GP_SpaceConversion *gsc,
+ struct bGPDlayer *gpl,
+ struct bGPDframe *gpf,
+ struct bGPDstroke *gps,
+ const float radius,
+ int *r_index);
+
+struct bGPDstroke *ED_gpencil_stroke_join_and_trim(struct bGPdata *gpd,
+ struct bGPDframe *gpf,
+ struct bGPDstroke *gps,
+ struct bGPDstroke *gps_dst,
+ const int pt_index);
+
+void ED_gpencil_stroke_close_by_distance(struct bGPDstroke *gps, const float threshold);
+
#ifdef __cplusplus
}
#endif