diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2020-11-18 23:30:43 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2020-11-18 23:35:06 +0300 |
commit | e9607f45d85df6df834a80f147b8c42ff12f56f2 (patch) | |
tree | eeea0e6c742f557798d3e8011bf84c8d806c0b12 /source/blender/editors/gpencil/gpencil_intern.h | |
parent | c126e27cdc8b28365a9d5f9fafc4d521d1eb83df (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/gpencil/gpencil_intern.h')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_intern.h | 60 |
1 files changed, 28 insertions, 32 deletions
diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h index e4e9a3ae0ab..0bdd2033491 100644 --- a/source/blender/editors/gpencil/gpencil_intern.h +++ b/source/blender/editors/gpencil/gpencil_intern.h @@ -152,6 +152,31 @@ typedef struct tGPDinterpolate { NumInput num; /* numeric input */ } tGPDinterpolate; +/* Modal Operator Drawing Callbacks ------------------------ */ +void ED_gpencil_draw_fill(struct tGPDdraw *tgpw); + +/* ***************************************************** */ +/* Internal API */ + +/* Stroke Coordinates API ------------------------------ */ +/* gpencil_utils.c */ + +typedef struct GP_SpaceConversion { + struct Scene *scene; + struct Object *ob; + struct bGPdata *gpd; + struct bGPDlayer *gpl; + + struct ScrArea *area; + struct ARegion *region; + struct View2D *v2d; + + rctf *subrect; /* for using the camera rect within the 3d view */ + rctf subrect_data; + + float mat[4][4]; /* transform matrix on the strokes (introduced in [b770964]) */ +} GP_SpaceConversion; + /* Temporary primitive operation data */ typedef struct tGPDprimitive { /** main database pointer */ @@ -180,6 +205,9 @@ typedef struct tGPDprimitive { /** current brush */ struct Brush *brush; + /** Settings to pass to gp_points_to_xy(). */ + GP_SpaceConversion gsc; + /** current frame number */ int cframe; /** layer */ @@ -248,31 +276,6 @@ typedef struct tGPDprimitive { } tGPDprimitive; -/* Modal Operator Drawing Callbacks ------------------------ */ -void ED_gpencil_draw_fill(struct tGPDdraw *tgpw); - -/* ***************************************************** */ -/* Internal API */ - -/* Stroke Coordinates API ------------------------------ */ -/* gpencil_utils.c */ - -typedef struct GP_SpaceConversion { - struct Scene *scene; - struct Object *ob; - struct bGPdata *gpd; - struct bGPDlayer *gpl; - - struct ScrArea *area; - struct ARegion *region; - struct View2D *v2d; - - rctf *subrect; /* for using the camera rect within the 3d view */ - rctf subrect_data; - - float mat[4][4]; /* transform matrix on the strokes (introduced in [b770964]) */ -} GP_SpaceConversion; - bool gpencil_stroke_inside_circle(const float mval[2], int rad, int x0, int y0, int x1, int y1); void gpencil_point_conversion_init(struct bContext *C, GP_SpaceConversion *r_gsc); @@ -343,13 +346,6 @@ struct GHash *gpencil_copybuf_validate_colormap(struct bContext *C); /* Stroke Editing ------------------------------------ */ -void gpencil_stroke_delete_tagged_points(bGPdata *gpd, - bGPDframe *gpf, - bGPDstroke *gps, - bGPDstroke *next_stroke, - int tag_flags, - bool select, - int limit); int gpencil_delete_selected_point_wrap(bContext *C); void gpencil_subdivide_stroke(bGPdata *gpd, bGPDstroke *gps, const int subdivide); |