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:
authorFalk David <falkdavid@gmx.de>2020-11-13 23:43:00 +0300
committerFalk David <falkdavid@gmx.de>2020-11-13 23:43:00 +0300
commit0be88c7d15d2ad1af284c6283370173647ae74eb (patch)
tree5fff573c512e284547ebe0c921ecffdae2c377c4 /source/blender/makesdna/DNA_gpencil_types.h
parent9d28353b525ecfbcca1501be72e4276dfb2bbc2a (diff)
GPencil: Merge GSoC curve edit mode
Differential Revision: https://developer.blender.org/D8660 This patch is the result of the GSoC 2020 "Editing Grease Pencil Strokes Using Curves" project. It adds a submode to greasepencil edit mode that allows for the transformation of greasepencil strokes using bezier curves. More information about the project can be found here: https://wiki.blender.org/wiki/User:Filedescriptor/GSoC_2020.
Diffstat (limited to 'source/blender/makesdna/DNA_gpencil_types.h')
-rw-r--r--source/blender/makesdna/DNA_gpencil_types.h84
1 files changed, 82 insertions, 2 deletions
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 222b716a502..94b75642fd6 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -29,6 +29,7 @@
struct AnimData;
struct MDeformVert;
+struct Curve;
#define GP_DEFAULT_PIX_FACTOR 1.0f
#define GP_DEFAULT_GRID_LINES 4
@@ -36,6 +37,10 @@ struct MDeformVert;
#define GP_MATERIAL_BUFFER_LEN 256
+#define GP_DEFAULT_CURVE_RESOLUTION 32
+#define GP_DEFAULT_CURVE_ERROR 0.1f
+#define GP_DEFAULT_CURVE_EDIT_CORNER_ANGLE M_PI_2
+
/* ***************************************** */
/* GP Stroke Points */
@@ -166,6 +171,61 @@ typedef enum eGPDpalette_Flag {
} eGPDpalette_Flag;
/* ***************************************** */
+/* GP Curve Point */
+
+typedef struct bGPDcurve_point {
+ /** Bezier Triple for the handles and control points. */
+ BezTriple bezt;
+ /** Pressure of input device (from 0 to 1) at this point. */
+ float pressure;
+ /** Color strength (used for alpha factor). */
+ float strength;
+ /** Index of corresponding point in gps->points. */
+ int point_index;
+
+ /** Additional options. */
+ int flag;
+
+ /** Factor of uv along the stroke. */
+ float uv_fac;
+ /** Uv rotation for dot mode. */
+ float uv_rot;
+ /** Uv for fill mode. */
+ float uv_fill[2];
+
+ /** Vertex Color RGBA (A=mix factor). */
+ float vert_color[4];
+ char _pad[4];
+} bGPDcurve_point;
+
+/* bGPDcurve_point->flag */
+typedef enum eGPDcurve_point_Flag {
+ GP_CURVE_POINT_SELECT = (1 << 0),
+} eGPDcurve_point_Flag;
+
+/* ***************************************** */
+/* GP Curve */
+
+/* Curve for Bezier Editing. */
+typedef struct bGPDcurve {
+ /** Array of BezTriple. */
+ bGPDcurve_point *curve_points;
+ /** Total number of curve points. */
+ int tot_curve_points;
+ /** General flag. */
+ short flag;
+ char _pad[2];
+} bGPDcurve;
+
+/* bGPDcurve_Flag->flag */
+typedef enum bGPDcurve_Flag {
+ /* Flag to indicated that the stroke data has been changed and the curve needs to be refitted */
+ GP_CURVE_NEEDS_STROKE_UPDATE = (1 << 0),
+ /* Curve is selected */
+ GP_CURVE_SELECT = (1 << 1),
+} bGPDcurve_Flag;
+
+/* ***************************************** */
/* GP Strokes */
/* Runtime temp data for bGPDstroke */
@@ -180,7 +240,8 @@ typedef struct bGPDstroke_Runtime {
int stroke_start;
/** Triangle offset in the ibo where this fill starts. */
int fill_start;
- int _pad[1];
+ /** Curve Handles offset in the ibo where this handle starts. */
+ int curve_start;
/** Original stroke (used to dereference evaluated data) */
struct bGPDstroke *gps_orig;
@@ -245,6 +306,9 @@ typedef struct bGPDstroke {
/** Vertex Color for Fill (one for all stroke, A=mix factor). */
float vert_color_fill[4];
+ /** Curve used to edit the stroke using Bezier handlers. */
+ struct bGPDcurve *editcurve;
+
bGPDstroke_Runtime runtime;
} bGPDstroke;
@@ -263,6 +327,9 @@ typedef enum eGPDstroke_Flag {
/* Flag used to indicate that stroke is used for fill close and must use
* fill color for stroke and no fill area */
GP_STROKE_NOFILL = (1 << 8),
+ /* Flag to indicated that the editcurve has been changed and the stroke needs to be updated with
+ * the curve data */
+ GP_STROKE_NEEDS_CURVE_UPDATE = (1 << 9),
/* only for use with stroke-buffer (while drawing arrows) */
GP_STROKE_USE_ARROW_START = (1 << 12),
/* only for use with stroke-buffer (while drawing arrows) */
@@ -562,7 +629,12 @@ typedef struct bGPdata {
ListBase layers;
/** Settings for this data-block. */
int flag;
- char _pad1[4];
+ /** Default resolution for generated curves using curve editing method. */
+ int curve_edit_resolution;
+ /** Curve Editing error threshold. */
+ float curve_edit_threshold;
+ /** Curve Editing corner angle (less or equal is treated as corner). */
+ float curve_edit_corner_angle;
/* Palettes */
/** List of bGPDpalette's - Deprecated (2.78 - 2.79 only). */
@@ -680,6 +752,11 @@ typedef enum eGPdata_Flag {
/* Autolock not active layers */
GP_DATA_AUTOLOCK_LAYERS = (1 << 20),
+
+ /* Enable Bezier Editing Curve (a submode of Edit mode). */
+ GP_DATA_CURVE_EDIT_MODE = (1 << 21),
+ /* Use adaptive curve resolution */
+ GP_DATA_CURVE_ADAPTIVE_RESOLUTION = (1 << 22),
} eGPdata_Flag;
/* gpd->onion_flag */
@@ -725,6 +802,9 @@ typedef enum eGP_DrawMode {
GP_DATA_STROKE_WEIGHTMODE | GP_DATA_STROKE_VERTEXMODE)) && \
((gpd)->flag & GP_DATA_STROKE_MULTIEDIT))
+#define GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd) \
+ ((gpd) && ((gpd)->flag & (GP_DATA_STROKE_EDITMODE)) && ((gpd)->flag & GP_DATA_CURVE_EDIT_MODE))
+
/* Macros to check grease pencil modes */
#define GPENCIL_ANY_MODE(gpd) \
((gpd) && ((gpd)->flag & \