diff options
author | Joshua Leung <aligorith@gmail.com> | 2016-08-28 18:03:09 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2016-08-29 05:51:30 +0300 |
commit | 299bb019b5e5bf48098a85f510d3daaaa99f53d5 (patch) | |
tree | a5edd1b992bc3043580f6b6bda079fdfd7586e31 /source/blender/editors/gpencil/gpencil_intern.h | |
parent | dec7145032678a6d667e02a10cfeb6225120443e (diff) |
GPencil: "Reproject Strokes" operator
A common problem encountered by artists was that they would accidentally move
the 3D cursor while drawing, causing their strokes to end up in weird places in
3D space when viewing the drawing again from other perspectives.
This operator helps fix up this mess by taking the selected strokes, projecting them
to screenspace, and then back to 3D space again. As a result, it should be as if
you had directly drawn the whole thing again, but from the current viewpoint instead.
Unfortunately, if there was originally some depth information present (i.e. you already
started reshaping the sketch in 3D), then that will get lost during this process.
But so far, my tests indicate that this seems to work well enough.
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_intern.h')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_intern.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h index e8d007c6c19..4178d49d652 100644 --- a/source/blender/editors/gpencil/gpencil_intern.h +++ b/source/blender/editors/gpencil/gpencil_intern.h @@ -101,6 +101,18 @@ void gp_point_to_xy(GP_SpaceConversion *settings, struct bGPDstroke *gps, struct int *r_x, int *r_y); /** + * Convert a Grease Pencil coordinate (i.e. can be 2D or 3D) to screenspace (2D) + * + * Just like gp_point_to_xy(), except the resulting coordinates are floats not ints. + * Use this version to solve "stair-step" artifacts which may arise when roundtripping the calculations. + * + * \param[out] r_x The screen-space x-coordinate of the point + * \param[out] r_y The screen-space y-coordinate of the point + */ +void gp_point_to_xy_fl(GP_SpaceConversion *gsc, bGPDstroke *gps, bGPDspoint *pt, + float *r_x, float *r_y); + +/** * Convert point to parent space * * \param pt Original point @@ -250,6 +262,7 @@ void GPENCIL_OT_snap_to_cursor(struct wmOperatorType *ot); void GPENCIL_OT_snap_cursor_to_selected(struct wmOperatorType *ot); void GPENCIL_OT_snap_cursor_to_center(struct wmOperatorType *ot); +void GPENCIL_OT_reproject(struct wmOperatorType *ot); /* stroke sculpting -- */ |