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-03-09 18:27:24 +0300
committerAntonio Vazquez <blendergit@gmail.com>2020-03-09 18:27:24 +0300
commit29f3af95272590d26f610ae828b2eeee89c82a00 (patch)
treea696a58a2561c48f7ec6166e369e22081e0a64d8 /source/blender/makesdna
parentdcb93126876879d969a30a7865700abd072066f8 (diff)
GPencil: Refactor of Draw Engine, Vertex Paint and all internal functions
This commit is a full refactor of the grease pencil modules including Draw Engine, Modifiers, VFX, depsgraph update, improvements in operators and conversion of Sculpt and Weight paint tools to real brushes. Also, a huge code cleanup has been done at all levels. Thanks to @fclem for his work and yo @pepeland and @mendio for the testing and help in the development. Differential Revision: https://developer.blender.org/D6293
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r--source/blender/makesdna/DNA_brush_types.h171
-rw-r--r--source/blender/makesdna/DNA_gpencil_modifier_types.h106
-rw-r--r--source/blender/makesdna/DNA_gpencil_types.h165
-rw-r--r--source/blender/makesdna/DNA_material_types.h65
-rw-r--r--source/blender/makesdna/DNA_object_enums.h6
-rw-r--r--source/blender/makesdna/DNA_object_types.h22
-rw-r--r--source/blender/makesdna/DNA_scene_types.h146
-rw-r--r--source/blender/makesdna/DNA_shader_fx_types.h37
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h5
-rw-r--r--source/blender/makesdna/DNA_view3d_types.h9
-rw-r--r--source/blender/makesdna/intern/dna_rename_defs.h4
11 files changed, 484 insertions, 252 deletions
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index 0109fba909b..3f703558e54 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -50,8 +50,7 @@ typedef struct BrushClone {
typedef struct BrushGpencilSettings {
/** Amount of smoothing to apply to newly created strokes. */
float draw_smoothfac;
- /** Amount of sensitivity to apply to newly created strokes. */
- float draw_sensitivity;
+ char _pad2[4];
/** Amount of alpha strength to apply to newly created strokes. */
float draw_strength;
/** Amount of jitter to apply to newly created strokes. */
@@ -64,18 +63,11 @@ typedef struct BrushGpencilSettings {
float draw_random_press;
/** Factor of strength for strength. */
float draw_random_strength;
- /** Factor of randomness for subdivision. */
- float draw_random_sub;
/** Number of times to apply smooth factor to new strokes. */
short draw_smoothlvl;
/** Number of times to subdivide new strokes. */
short draw_subdivide;
- short _pad;
-
- /** Number of times to apply thickness smooth factor to new strokes. */
- short thick_smoothlvl;
- /** Amount of thickness smoothing to apply to newly created strokes. */
- float thick_smoothfac;
+ char _pad[4];
/** Factor for transparency. */
float fill_threshold;
@@ -83,7 +75,7 @@ typedef struct BrushGpencilSettings {
short fill_leak;
/** Fill zoom factor */
short fill_factor;
- char _pad_1[4];
+ char _pad1[4];
/** Number of simplify steps. */
int fill_simplylvl;
@@ -110,12 +102,24 @@ typedef struct BrushGpencilSettings {
int flag;
/** gradient control along y for color */
- float gradient_f;
+ float hardeness;
/** factor xy of shape for dots gradients */
- float gradient_s[2];
+ float aspect_ratio[2];
/** Simplify adaptive factor */
float simplify_f;
+ /** Mix colorfactor */
+ float vertex_factor;
+ int vertex_mode;
+
+ /** eGP_Sculpt_Flag. */
+ int sculpt_flag;
+ /** eGP_Sculpt_Mode_Flag. */
+ int sculpt_mode_flag;
+ /** Preset type (used to reset brushes - internal). */
+ short preset_type;
+ char _pad3[6];
+
struct CurveMapping *curve_sensitivity;
struct CurveMapping *curve_strength;
struct CurveMapping *curve_jitter;
@@ -125,6 +129,49 @@ typedef struct BrushGpencilSettings {
struct Material *material;
} BrushGpencilSettings;
+/* BrushGpencilSettings->preset_type.
+ * Use a range for each group and not continuous values.*/
+typedef enum eGPBrush_Presets {
+ GP_BRUSH_PRESET_UNKNOWN = 0,
+
+ /* Draw 1-99. */
+ GP_BRUSH_PRESET_AIRBRUSH = 1,
+ GP_BRUSH_PRESET_INK_PEN = 2,
+ GP_BRUSH_PRESET_INK_PEN_ROUGH = 3,
+ GP_BRUSH_PRESET_MARKER_BOLD = 4,
+ GP_BRUSH_PRESET_MARKER_CHISEL = 5,
+ GP_BRUSH_PRESET_PEN = 6,
+ GP_BRUSH_PRESET_PENCIL_SOFT = 7,
+ GP_BRUSH_PRESET_PENCIL = 8,
+ GP_BRUSH_PRESET_FILL_AREA = 9,
+ GP_BRUSH_PRESET_ERASER_SOFT = 10,
+ GP_BRUSH_PRESET_ERASER_HARD = 11,
+ GP_BRUSH_PRESET_ERASER_POINT = 12,
+ GP_BRUSH_PRESET_ERASER_STROKE = 13,
+ GP_BRUSH_PRESET_TINT = 14,
+
+ /* Vertex Paint 100-199. */
+ GP_BRUSH_PRESET_VERTEX_DRAW = 100,
+ GP_BRUSH_PRESET_VERTEX_BLUR = 101,
+ GP_BRUSH_PRESET_VERTEX_AVERAGE = 102,
+ GP_BRUSH_PRESET_VERTEX_SMEAR = 103,
+ GP_BRUSH_PRESET_VERTEX_REPLACE = 104,
+
+ /* Sculpt 200-299. */
+ GP_BRUSH_PRESET_SMOOTH_STROKE = 200,
+ GP_BRUSH_PRESET_STRENGTH_STROKE = 201,
+ GP_BRUSH_PRESET_THICKNESS_STROKE = 202,
+ GP_BRUSH_PRESET_GRAB_STROKE = 203,
+ GP_BRUSH_PRESET_PUSH_STROKE = 204,
+ GP_BRUSH_PRESET_TWIST_STROKE = 205,
+ GP_BRUSH_PRESET_PINCH_STROKE = 206,
+ GP_BRUSH_PRESET_RANDOMIZE_STROKE = 207,
+ GP_BRUSH_PRESET_CLONE_STROKE = 208,
+
+ /* Weight Paint 300-399. */
+ GP_BRUSH_PRESET_DRAW_WEIGHT = 300,
+} eGPBrush_Presets;
+
/* BrushGpencilSettings->gp_flag */
typedef enum eGPDbrush_Flag {
/* brush use pressure */
@@ -133,8 +180,6 @@ typedef enum eGPDbrush_Flag {
GP_BRUSH_USE_STENGTH_PRESSURE = (1 << 1),
/* brush use pressure for alpha factor */
GP_BRUSH_USE_JITTER_PRESSURE = (1 << 2),
- /* enable screen cursor */
- GP_BRUSH_ENABLE_CURSOR = (1 << 5),
/* fill hide transparent */
GP_BRUSH_FILL_HIDE = (1 << 6),
/* show fill help lines */
@@ -187,6 +232,22 @@ typedef enum eGP_BrushIcons {
GP_BRUSH_ICON_ERASE_STROKE = 10,
GP_BRUSH_ICON_AIRBRUSH = 11,
GP_BRUSH_ICON_CHISEL = 12,
+ GP_BRUSH_ICON_TINT = 13,
+ GP_BRUSH_ICON_VERTEX_DRAW = 14,
+ GP_BRUSH_ICON_VERTEX_BLUR = 15,
+ GP_BRUSH_ICON_VERTEX_AVERAGE = 16,
+ GP_BRUSH_ICON_VERTEX_SMEAR = 17,
+ GP_BRUSH_ICON_VERTEX_REPLACE = 18,
+ GP_BRUSH_ICON_GPBRUSH_SMOOTH = 19,
+ GP_BRUSH_ICON_GPBRUSH_THICKNESS = 20,
+ GP_BRUSH_ICON_GPBRUSH_STRENGTH = 21,
+ GP_BRUSH_ICON_GPBRUSH_RANDOMIZE = 22,
+ GP_BRUSH_ICON_GPBRUSH_GRAB = 23,
+ GP_BRUSH_ICON_GPBRUSH_PUSH = 24,
+ GP_BRUSH_ICON_GPBRUSH_TWIST = 25,
+ GP_BRUSH_ICON_GPBRUSH_PINCH = 26,
+ GP_BRUSH_ICON_GPBRUSH_CLONE = 27,
+ GP_BRUSH_ICON_GPBRUSH_WEIGHT = 28,
} eGP_BrushIcons;
typedef enum eBrushCurvePreset {
@@ -225,6 +286,38 @@ typedef enum eBrushClothForceFalloffType {
BRUSH_CLOTH_FORCE_FALLOFF_PLANE = 1,
} eBrushClothForceFalloffType;
+/* Gpencilsettings.Vertex_mode */
+typedef enum eGp_Vertex_Mode {
+ /* Affect to Stroke only. */
+ GPPAINT_MODE_STROKE = 0,
+ /* Affect to Fill only. */
+ GPPAINT_MODE_FILL = 1,
+ /* Affect to both. */
+ GPPAINT_MODE_BOTH = 2,
+} eGp_Vertex_Mode;
+
+/* sculpt_flag */
+typedef enum eGP_Sculpt_Flag {
+ /* invert the effect of the brush */
+ GP_SCULPT_FLAG_INVERT = (1 << 0),
+ /* smooth brush affects pressure values as well */
+ GP_SCULPT_FLAG_SMOOTH_PRESSURE = (1 << 2),
+ /* temporary invert action */
+ GP_SCULPT_FLAG_TMP_INVERT = (1 << 3),
+} eGP_Sculpt_Flag;
+
+/* sculpt_mode_flag */
+typedef enum eGP_Sculpt_Mode_Flag {
+ /* apply brush to position */
+ GP_SCULPT_FLAGMODE_APPLY_POSITION = (1 << 0),
+ /* apply brush to strength */
+ GP_SCULPT_FLAGMODE_APPLY_STRENGTH = (1 << 1),
+ /* apply brush to thickness */
+ GP_SCULPT_FLAGMODE_APPLY_THICKNESS = (1 << 2),
+ /* apply brush to uv data */
+ GP_SCULPT_FLAGMODE_APPLY_UV = (1 << 3),
+} eGP_Sculpt_Mode_Flag;
+
typedef enum eAutomasking_flag {
BRUSH_AUTOMASKING_TOPOLOGY = (1 << 0),
BRUSH_AUTOMASKING_FACE_SETS = (1 << 1),
@@ -327,7 +420,13 @@ typedef struct Brush {
char mask_tool;
/** Active grease pencil tool. */
char gpencil_tool;
- char _pad1[5];
+ /** Active grease pencil vertex tool. */
+ char gpencil_vertex_tool;
+ /** Active grease pencil sculpt tool. */
+ char gpencil_sculpt_tool;
+ /** Active grease pencil weight tool. */
+ char gpencil_weight_tool;
+ char _pad1_[6];
float autosmooth_factor;
@@ -398,9 +497,20 @@ typedef struct Brush {
float mask_stencil_pos[2];
float mask_stencil_dimension[2];
+ char _pad6[4];
struct BrushGpencilSettings *gpencil_settings;
} Brush;
+
+/* Struct to hold palette colors for sorting. */
+typedef struct tPaletteColorHSV {
+ float rgb[3];
+ float value;
+ float h;
+ float s;
+ float v;
+} tPaletteColorHSV;
+
typedef struct PaletteColor {
struct PaletteColor *next, *prev;
/* two values, one to store rgb, other to store values for sculpt/weight */
@@ -629,8 +739,37 @@ typedef enum eBrushGPaintTool {
GPAINT_TOOL_DRAW = 0,
GPAINT_TOOL_FILL = 1,
GPAINT_TOOL_ERASE = 2,
+ GPAINT_TOOL_TINT = 3,
} eBrushGPaintTool;
+/* BrushGpencilSettings->brush type */
+typedef enum eBrushGPVertexTool {
+ GPVERTEX_TOOL_DRAW = 0,
+ GPVERTEX_TOOL_BLUR = 1,
+ GPVERTEX_TOOL_AVERAGE = 2,
+ GPVERTEX_TOOL_TINT = 3,
+ GPVERTEX_TOOL_SMEAR = 4,
+ GPVERTEX_TOOL_REPLACE = 5,
+} eBrushGPVertexTool;
+
+/* BrushGpencilSettings->brush type */
+typedef enum eBrushGPSculptTool {
+ GPSCULPT_TOOL_SMOOTH = 0,
+ GPSCULPT_TOOL_THICKNESS = 1,
+ GPSCULPT_TOOL_STRENGTH = 2,
+ GPSCULPT_TOOL_GRAB = 3,
+ GPSCULPT_TOOL_PUSH = 4,
+ GPSCULPT_TOOL_TWIST = 5,
+ GPSCULPT_TOOL_PINCH = 6,
+ GPSCULPT_TOOL_RANDOMIZE = 7,
+ GPSCULPT_TOOL_CLONE = 8,
+} eBrushGPSculptTool;
+
+/* BrushGpencilSettings->brush type */
+typedef enum eBrushGPWeightTool {
+ GPWEIGHT_TOOL_DRAW = 0,
+} eBrushGPWeightTool;
+
/* direction that the brush displaces along */
enum {
SCULPT_DISP_DIR_AREA = 0,
diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h
index 5fe12998998..1121bdf4df0 100644
--- a/source/blender/makesdna/DNA_gpencil_modifier_types.h
+++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h
@@ -47,6 +47,7 @@ typedef enum GpencilModifierType {
eGpencilModifierType_Armature = 15,
eGpencilModifierType_Time = 16,
eGpencilModifierType_Multiply = 17,
+ eGpencilModifierType_Vertexcolor = 18,
NUM_GREASEPENCIL_MODIFIER_TYPES,
} GpencilModifierType;
@@ -89,12 +90,18 @@ typedef struct NoiseGpencilModifierData {
int flag;
/** Factor of noise. */
float factor;
+ float factor_strength;
+ float factor_thickness;
+ float factor_uvs;
+ /** Noise Frequency scaling */
+ float noise_scale;
/** How many frames before recalculate randoms. */
int step;
/** Custom index for passes. */
int layer_pass;
/** Random seed */
int seed;
+ struct CurveMapping *curve_intensity;
} NoiseGpencilModifierData;
typedef enum eNoiseGpencil_Flag {
@@ -103,7 +110,7 @@ typedef enum eNoiseGpencil_Flag {
GP_NOISE_MOD_STRENGTH = (1 << 2),
GP_NOISE_MOD_THICKNESS = (1 << 3),
GP_NOISE_FULL_STROKE = (1 << 4),
- GP_NOISE_MOVE_EXTREME = (1 << 5),
+ GP_NOISE_CUSTOM_CURVE = (1 << 5),
GP_NOISE_INVERT_LAYER = (1 << 6),
GP_NOISE_INVERT_PASS = (1 << 7),
GP_NOISE_INVERT_VGROUP = (1 << 8),
@@ -126,16 +133,23 @@ typedef struct SubdivGpencilModifierData {
int level;
/** Custom index for passes. */
int layer_pass;
+ /** Type of subdivision */
+ short type;
+ char _pad[6];
} SubdivGpencilModifierData;
typedef enum eSubdivGpencil_Flag {
- GP_SUBDIV_SIMPLE = (1 << 0),
GP_SUBDIV_INVERT_LAYER = (1 << 1),
GP_SUBDIV_INVERT_PASS = (1 << 2),
GP_SUBDIV_INVERT_LAYERPASS = (1 << 3),
GP_SUBDIV_INVERT_MATERIAL = (1 << 4),
} eSubdivGpencil_Flag;
+typedef enum eSubdivGpencil_Type {
+ GP_SUBDIV_CATMULL = 0,
+ GP_SUBDIV_SIMPLE = 1,
+} eSubdivGpencil_Type;
+
typedef struct ThickGpencilModifierData {
GpencilModifierData modifier;
/** Layer name. */
@@ -148,10 +162,13 @@ typedef struct ThickGpencilModifierData {
int pass_index;
/** Flags. */
int flag;
- /** Thickness change. */
+ /** Relative thickness factor. */
+ float thickness_fac;
+ /** Absolute thickness overide. */
int thickness;
/** Custom index for passes. */
int layer_pass;
+ char _pad[4];
struct CurveMapping *curve_thickness;
} ThickGpencilModifierData;
@@ -225,15 +242,17 @@ typedef struct TintGpencilModifierData {
char _pad[7];
/** Custom index for passes. */
int layer_pass;
+
char _pad1[4];
+ struct CurveMapping *curve_intensity;
} TintGpencilModifierData;
typedef enum eTintGpencil_Flag {
- GP_TINT_CREATE_COLORS = (1 << 0),
GP_TINT_INVERT_LAYER = (1 << 1),
GP_TINT_INVERT_PASS = (1 << 2),
GP_TINT_INVERT_LAYERPASS = (1 << 3),
GP_TINT_INVERT_MATERIAL = (1 << 4),
+ GP_TINT_CUSTOM_CURVE = (1 << 5),
} eTintGpencil_Flag;
typedef struct ColorGpencilModifierData {
@@ -253,15 +272,17 @@ typedef struct ColorGpencilModifierData {
char _pad[3];
/** Custom index for passes. */
int layer_pass;
+
char _pad1[4];
+ struct CurveMapping *curve_intensity;
} ColorGpencilModifierData;
typedef enum eColorGpencil_Flag {
- GP_COLOR_CREATE_COLORS = (1 << 0),
GP_COLOR_INVERT_LAYER = (1 << 1),
GP_COLOR_INVERT_PASS = (1 << 2),
GP_COLOR_INVERT_LAYERPASS = (1 << 3),
GP_COLOR_INVERT_MATERIAL = (1 << 4),
+ GP_COLOR_CUSTOM_CURVE = (1 << 5),
} eColorGpencil_Flag;
typedef struct OpacityGpencilModifierData {
@@ -280,21 +301,22 @@ typedef struct OpacityGpencilModifierData {
float factor;
/** Modify stroke, fill or both. */
char modify_color;
- /** Mode of opacity, colors or strength */
- char opacity_mode;
- char _pad[2];
+ char _pad[3];
/** Custom index for passes. */
int layer_pass;
+
char _pad1[4];
+ struct CurveMapping *curve_intensity;
} OpacityGpencilModifierData;
typedef enum eOpacityGpencil_Flag {
GP_OPACITY_INVERT_LAYER = (1 << 0),
GP_OPACITY_INVERT_PASS = (1 << 1),
GP_OPACITY_INVERT_VGROUP = (1 << 2),
- GP_OPACITY_CREATE_COLORS = (1 << 3),
GP_OPACITY_INVERT_LAYERPASS = (1 << 4),
GP_OPACITY_INVERT_MATERIAL = (1 << 5),
+ GP_OPACITY_CUSTOM_CURVE = (1 << 6),
+ GP_OPACITY_NORMALIZE = (1 << 7),
} eOpacityGpencil_Flag;
typedef struct ArrayGpencilModifierData {
@@ -308,17 +330,15 @@ typedef struct ArrayGpencilModifierData {
float offset[3];
/** Shift increment. */
float shift[3];
- /** Random size factor. */
- float rnd_size;
- /** Random size factor. */
- float rnd_rot;
- /** Rotation changes. */
- float rot[3];
- /** Scale changes. */
- float scale[3];
- /** (first element is the index) random values. */
- float rnd[20];
+ /** Random Offset. */
+ float rnd_offset[3];
+ /** Random Rotation. */
+ float rnd_rot[3];
+ /** Random Scales. */
+ float rnd_scale[3];
char _pad[4];
+ /** (first element is the index) random values. */
+ int seed;
/** Custom index for passes. */
int pass_index;
@@ -333,13 +353,13 @@ typedef struct ArrayGpencilModifierData {
} ArrayGpencilModifierData;
typedef enum eArrayGpencil_Flag {
- GP_ARRAY_RANDOM_SIZE = (1 << 0),
- GP_ARRAY_RANDOM_ROT = (1 << 1),
GP_ARRAY_INVERT_LAYER = (1 << 2),
GP_ARRAY_INVERT_PASS = (1 << 3),
- GP_ARRAY_KEEP_ONTOP = (1 << 4),
GP_ARRAY_INVERT_LAYERPASS = (1 << 5),
GP_ARRAY_INVERT_MATERIAL = (1 << 6),
+ GP_ARRAY_USE_OFFSET = (1 << 7),
+ GP_ARRAY_USE_RELATIVE = (1 << 8),
+ GP_ARRAY_USE_OB_OFFSET = (1 << 9),
} eArrayGpencil_Flag;
typedef struct BuildGpencilModifierData {
@@ -613,7 +633,9 @@ typedef struct SmoothGpencilModifierData {
int step;
/** Custom index for passes. */
int layer_pass;
- char _pad[4];
+
+ char _pad1[4];
+ struct CurveMapping *curve_intensity;
} SmoothGpencilModifierData;
typedef enum eSmoothGpencil_Flag {
@@ -626,6 +648,7 @@ typedef enum eSmoothGpencil_Flag {
GP_SMOOTH_MOD_UV = (1 << 6),
GP_SMOOTH_INVERT_LAYERPASS = (1 << 7),
GP_SMOOTH_INVERT_MATERIAL = (1 << 4),
+ GP_SMOOTH_CUSTOM_CURVE = (1 << 8),
} eSmoothGpencil_Flag;
typedef struct ArmatureGpencilModifierData {
@@ -677,4 +700,41 @@ typedef enum eMultiplyGpencil_Flag {
GP_MULTIPLY_ENABLE_FADING = (1 << 2),
} eMultiplyGpencil_Flag;
+typedef struct VertexcolorGpencilModifierData {
+ GpencilModifierData modifier;
+
+ struct Object *object;
+ /** Layer name. */
+ char layername[64];
+ /** Material name. */
+ char materialname[64];
+ /** Optional vertexgroup name, MAX_VGROUP_NAME. */
+ char vgname[64];
+ /** Custom index for passes. */
+ int pass_index;
+ /** Custom index for passes. */
+ int layer_pass;
+ /** Flags. */
+ int flag;
+ /** Mode. */
+ int mode;
+
+ float factor;
+ float radius;
+
+ struct CurveMapping *curve_intensity;
+
+ struct ColorBand *colorband;
+} VertexcolorGpencilModifierData;
+
+typedef enum eVertexcolorGpencil_Flag {
+ GP_VERTEXCOL_INVERT_LAYER = (1 << 0),
+ GP_VERTEXCOL_INVERT_PASS = (1 << 1),
+ GP_VERTEXCOL_INVERT_VGROUP = (1 << 2),
+ GP_VERTEXCOL_UNIFORM_SPACE = (1 << 3),
+ GP_VERTEXCOL_INVERT_LAYERPASS = (1 << 4),
+ GP_VERTEXCOL_INVERT_MATERIAL = (1 << 5),
+ GP_VERTEXCOL_CUSTOM_CURVE = (1 << 6),
+} eVertexcolorGpencil_Flag;
+
#endif /* __DNA_GPENCIL_MODIFIER_TYPES_H__ */
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 8908b3c42d9..6059df6f886 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -36,6 +36,8 @@ struct MDeformVert;
#define GP_DEFAULT_GRID_LINES 4
#define GP_MAX_INPUT_SAMPLES 10
+#define GP_MATERIAL_BUFFER_LEN 256
+
/* ***************************************** */
/* GP Stroke Points */
@@ -78,9 +80,15 @@ typedef struct bGPDspoint {
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];
/** Runtime data */
char _pad2[4];
+
bGPDspoint_Runtime runtime;
} bGPDspoint;
@@ -105,8 +113,6 @@ typedef enum eGPDspoint_Flag {
typedef struct bGPDtriangle {
/* indices for tessellated triangle used for GP Fill */
unsigned int verts[3];
- /* texture coordinates for verts */
- float uv[3][2];
} bGPDtriangle;
/* ***************************************** */
@@ -166,18 +172,17 @@ typedef enum eGPDpalette_Flag {
/* Runtime temp data for bGPDstroke */
typedef struct bGPDstroke_Runtime {
- /** runtime final colors (result of original colors and modifiers) */
- float tmp_stroke_rgba[4];
-
- /** runtime final fill colors (result of original colors and modifiers) */
- float tmp_fill_rgba[4];
-
/** temporary layer name only used during copy/paste to put the stroke in the original layer */
char tmp_layerinfo[128];
/** Runtime falloff factor (only for transform). */
float multi_frame_falloff;
- char _pad[4];
+
+ /** Vertex offset in the vbo where this stroke starts. */
+ int stroke_start;
+ /** Triangle offset in the ibo where this fill starts. */
+ int fill_start;
+ int _pad[1];
/** Original stroke (used to dereference evaluated data) */
struct bGPDstroke *gps_orig;
@@ -217,15 +222,31 @@ typedef struct bGPDstroke {
short caps[2];
/** gradient control along y for color */
- float gradient_f;
+ float hardeness;
/** factor xy of shape for dots gradients */
- float gradient_s[2];
- char _pad_3[4];
+ float aspect_ratio[2];
+
+ /** Factor of opacity for Fill color (used by opacity modifier). */
+ float fill_opacity_fac;
+
+ /** Min of the bound box used to speedup painting operators. */
+ float boundbox_min[3];
+ /** Max of the bound box used to speedup painting operators. */
+ float boundbox_max[3];
+
+ /** UV rotation */
+ float uv_rotation;
+ /** UV translation (X and Y axis) */
+ float uv_translation[2];
+ float uv_scale;
/** Vertex weight data. */
struct MDeformVert *dvert;
void *_pad3;
+ /** Vertex Color for Fill (one for all stroke, A=mix factor). */
+ float vert_color_fill[4];
+
bGPDstroke_Runtime runtime;
} bGPDstroke;
@@ -239,14 +260,13 @@ typedef enum eGPDstroke_Flag {
GP_STROKE_2DIMAGE = (1 << 2),
/* stroke is selected */
GP_STROKE_SELECT = (1 << 3),
- /* Recalculate geometry data (triangulation, UVs, Bound Box,...
- * (when true, force a new recalc) */
- GP_STROKE_RECALC_GEOMETRY = (1 << 4),
/* Flag used to indicate that stroke is closed and draw edge between last and first point */
GP_STROKE_CYCLIC = (1 << 7),
/* 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),
+ /* Tag for update geometry */
+ GP_STROKE_TAG = (1 << 14),
/* only for use with stroke-buffer (while drawing eraser) */
GP_STROKE_ERASER = (1 << 15),
} eGPDstroke_Flag;
@@ -265,8 +285,13 @@ typedef enum eGPDstroke_Caps {
/* Runtime temp data for bGPDframe */
typedef struct bGPDframe_Runtime {
- /** Parent matrix for drawing. */
- float parent_obmat[4][4];
+ /** Index of this frame in the listbase of frames. */
+ int frameid;
+ /** Onion offset from active frame. 0 if not onion. INT_MAX to bypass frame. */
+ int onion_id;
+
+ /** Original frame (used to dereference evaluated data) */
+ struct bGPDframe *gpf_orig;
} bGPDframe_Runtime;
/* Grease-Pencil Annotations - 'Frame'
@@ -300,11 +325,31 @@ typedef enum eGPDframe_Flag {
/* ***************************************** */
/* GP Layer */
+/* List of masking layers. */
+typedef struct bGPDlayer_Mask {
+ struct bGPDlayer_Mask *next, *prev;
+ char name[128];
+ short flag;
+ /** Index for sorting. Only valid while sorting algorithm is running. */
+ short sort_index;
+ char _pad[4];
+} bGPDlayer_Mask;
+
+/* bGPDlayer_Mask->flag */
+typedef enum ebGPDlayer_Mask_Flag {
+ /* Mask is hidden. */
+ GP_MASK_HIDE = (1 << 0),
+ /* Mask is inverted. */
+ GP_MASK_INVERT = (1 << 1),
+} ebGPDlayer_Mask_Flag;
+
/* Runtime temp data for bGPDlayer */
typedef struct bGPDlayer_Runtime {
/** Id for dynamic icon used to show annotation color preview for layer. */
int icon_id;
char _pad[4];
+ /** Original layer (used to dereference evaluated data) */
+ struct bGPDlayer *gpl_orig;
} bGPDlayer_Runtime;
/* Grease-Pencil Annotations - 'Layer' */
@@ -355,7 +400,8 @@ typedef struct bGPDlayer {
/** Blend modes. */
int blend_mode;
- char _pad[4];
+ /** Vertex Paint opacity by Layer. */
+ float vertex_paint_opacity;
/* annotation onion skin */
/**
@@ -375,6 +421,12 @@ typedef struct bGPDlayer {
float gcolor_next[3];
char _pad1[4];
+ /** Mask list (bGPDlayer_Mask). */
+ ListBase mask_layers;
+ /** Current Mask index (noted base 1). */
+ int act_mask;
+ char _pad2[4];
+
bGPDlayer_Runtime runtime;
} bGPDlayer;
@@ -388,6 +440,8 @@ typedef enum eGPDlayer_Flag {
GP_LAYER_ACTIVE = (1 << 2),
/* draw points of stroke for debugging purposes */
GP_LAYER_DRAWDEBUG = (1 << 3),
+ /* Flag used to display in Paint mode only layers with keyframe */
+ GP_LAYER_SOLO_MODE = (1 << 4),
/* for editing in Action Editor */
GP_LAYER_SELECT = (1 << 5),
/* current frame for layer can't be changed */
@@ -396,12 +450,12 @@ typedef enum eGPDlayer_Flag {
GP_LAYER_NO_XRAY = (1 << 7),
/* "volumetric" strokes */
GP_LAYER_VOLUMETRIC = (1 << 10),
+ /* Use Scene lights */
+ GP_LAYER_USE_LIGHTS = (1 << 11),
/* Unlock color */
GP_LAYER_UNLOCK_COLOR = (1 << 12),
/* Mask Layer */
- GP_LAYER_USE_MASK = (1 << 13),
- /* Flag used to display in Paint mode only layers with keyframe */
- GP_LAYER_SOLO_MODE = (1 << 4),
+ GP_LAYER_USE_MASK = (1 << 13), /*TODO: DEPRECATED */
/* Ruler Layer */
GP_LAYER_IS_RULER = (1 << 14),
} eGPDlayer_Flag;
@@ -431,18 +485,15 @@ typedef struct bGPdata_Runtime {
struct ARegion *ar;
/** Stroke buffer. */
void *sbuffer;
+ /** Temp batches cleared after drawing. */
+ struct GPUBatch *sbuffer_stroke_batch;
+ struct GPUBatch *sbuffer_fill_batch;
+ /** Temp stroke used for drawing. */
+ struct bGPDstroke *sbuffer_gps;
- /* GP Object drawing */
- /** Buffer stroke color. */
- float scolor[4];
- /** Buffer fill color. */
- float sfill[4];
- /** Settings for color. */
- short mode;
- /** Buffer style for drawing strokes (used to select shader type). */
- short bstroke_style;
- /** Buffer style for filling areas (used to select shader type). */
- short bfill_style;
+ char _pad[2];
+ /** Material index of the stroke. */
+ short matid;
/* Stroke Buffer data (only used during paint-session)
* - buffer must be initialized before use, but freed after
@@ -450,16 +501,26 @@ typedef struct bGPdata_Runtime {
*/
/** Flags for stroke that cache represents. */
short sbuffer_sflag;
+ char _pad1[2];
/** Number of elements currently used in cache. */
int sbuffer_used;
/** Number of total elements available in cache. */
int sbuffer_size;
+ /** Vertex Color applied to point (while drawing). */
+ float vert_color[4];
+
+ /** Vertex Color applied to Fill (while drawing). */
+ float vert_color_fill[4];
+
/** Number of control-points for stroke. */
int tot_cp_points;
- char _pad_[4];
+ char _pad2[4];
/** Array of control-points for stroke. */
bGPDcontrolpoint *cp_points;
+ /** Brush pointer */
+ Brush *sbuffer_brush;
+ struct GpencilBatchCache *gpencil_cache;
} bGPdata_Runtime;
/* grid configuration */
@@ -481,7 +542,7 @@ typedef struct bGPdata {
struct AnimData *adt;
/* Grease-Pencil data */
- /** BGPDlayers. */
+ /** bGPDlayer. */
ListBase layers;
/** Settings for this data-block. */
int flag;
@@ -581,8 +642,6 @@ typedef enum eGPdata_Flag {
/* Main flag to switch onion skinning on/off */
GP_DATA_SHOW_ONIONSKINS = (1 << 9),
- /* Draw a green and red point to indicate start and end of the stroke */
- GP_DATA_SHOW_DIRECTION = (1 << 10),
/* Batch drawing cache need to be recalculated */
GP_DATA_CACHE_IS_DIRTY = (1 << 11),
@@ -600,15 +659,9 @@ typedef enum eGPdata_Flag {
/* Allow edit several frames at the same time */
GP_DATA_STROKE_MULTIEDIT = (1 << 16),
- /* Force fill recalc if use deformation modifiers.
- * this is required if the stroke is deformed and the triangulation data is
- * not valid.
- */
- GP_DATA_STROKE_FORCE_RECALC = (1 << 17),
- /* Special mode drawing polygons */
- GP_DATA_STROKE_POLYGON = (1 << 18),
- /* Use adaptive UV scales */
- GP_DATA_UV_ADAPTIVE = (1 << 19),
+ /* Vertex Paint Mode - Toggle paint mode */
+ GP_DATA_STROKE_VERTEXMODE = (1 << 18),
+
/* Autolock not active layers */
GP_DATA_AUTOLOCK_LAYERS = (1 << 20),
/* Internal flag for python update */
@@ -654,28 +707,38 @@ typedef enum eGP_DrawMode {
/* Check if 'multiedit sessions' is enabled */
#define GPENCIL_MULTIEDIT_SESSIONS_ON(gpd) \
((gpd) && \
- (gpd->flag & \
- (GP_DATA_STROKE_EDITMODE | GP_DATA_STROKE_SCULPTMODE | GP_DATA_STROKE_WEIGHTMODE)) && \
+ (gpd->flag & (GP_DATA_STROKE_EDITMODE | GP_DATA_STROKE_SCULPTMODE | \
+ GP_DATA_STROKE_WEIGHTMODE | GP_DATA_STROKE_VERTEXMODE)) && \
(gpd->flag & GP_DATA_STROKE_MULTIEDIT))
/* Macros to check grease pencil modes */
#define GPENCIL_ANY_MODE(gpd) \
- ((gpd) && (gpd->flag & (GP_DATA_STROKE_PAINTMODE | GP_DATA_STROKE_EDITMODE | \
- GP_DATA_STROKE_SCULPTMODE | GP_DATA_STROKE_WEIGHTMODE)))
-#define GPENCIL_EDIT_MODE(gpd) ((gpd) && (gpd->flag & GP_DATA_STROKE_EDITMODE))
+ ((gpd) && \
+ (gpd->flag & (GP_DATA_STROKE_PAINTMODE | GP_DATA_STROKE_EDITMODE | GP_DATA_STROKE_SCULPTMODE | \
+ GP_DATA_STROKE_WEIGHTMODE | GP_DATA_STROKE_VERTEXMODE)))
+#define GPENCIL_EDIT_MODE(gpd) ((gpd) && ((gpd)->flag & GP_DATA_STROKE_EDITMODE))
#define GPENCIL_ANY_EDIT_MODE(gpd) \
((gpd) && (gpd->flag & \
(GP_DATA_STROKE_EDITMODE | GP_DATA_STROKE_SCULPTMODE | GP_DATA_STROKE_WEIGHTMODE)))
#define GPENCIL_PAINT_MODE(gpd) ((gpd) && (gpd->flag & (GP_DATA_STROKE_PAINTMODE)))
#define GPENCIL_SCULPT_MODE(gpd) ((gpd) && (gpd->flag & GP_DATA_STROKE_SCULPTMODE))
#define GPENCIL_WEIGHT_MODE(gpd) ((gpd) && (gpd->flag & GP_DATA_STROKE_WEIGHTMODE))
+#define GPENCIL_VERTEX_MODE(gpd) ((gpd) && (gpd->flag & (GP_DATA_STROKE_VERTEXMODE)))
#define GPENCIL_SCULPT_OR_WEIGHT_MODE(gpd) \
((gpd) && (gpd->flag & (GP_DATA_STROKE_SCULPTMODE | GP_DATA_STROKE_WEIGHTMODE)))
#define GPENCIL_NONE_EDIT_MODE(gpd) \
((gpd) && ((gpd->flag & (GP_DATA_STROKE_EDITMODE | GP_DATA_STROKE_SCULPTMODE | \
- GP_DATA_STROKE_WEIGHTMODE)) == 0))
+ GP_DATA_STROKE_WEIGHTMODE | GP_DATA_STROKE_VERTEXMODE)) == 0))
#define GPENCIL_LAZY_MODE(brush, shift) \
(((brush) && ((brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE) && (shift == 0))) || \
(((brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE) == 0) && (shift == 1)))
+#define GPENCIL_ANY_SCULPT_MASK(flag) \
+ ((flag & (GP_SCULPT_MASK_SELECTMODE_POINT | GP_SCULPT_MASK_SELECTMODE_STROKE | \
+ GP_SCULPT_MASK_SELECTMODE_SEGMENT)))
+
+#define GPENCIL_ANY_VERTEX_MASK(flag) \
+ ((flag & (GP_VERTEX_MASK_SELECTMODE_POINT | GP_VERTEX_MASK_SELECTMODE_STROKE | \
+ GP_VERTEX_MASK_SELECTMODE_SEGMENT)))
+
#endif /* __DNA_GPENCIL_TYPES_H__ */
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h
index 1d1ccef8846..0db7feffa99 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -72,15 +72,14 @@ typedef struct MaterialGPencilStyle {
/** Factor used to define shader behavior (several uses). */
float mix_factor;
/** Angle used for gradients orientation. */
- float gradient_angle;
+ float gradient_angle DNA_DEPRECATED;
/** Radius for radial gradients. */
- float gradient_radius;
- /** Cheesboard size. */
- float pattern_gridsize;
+ float gradient_radius DNA_DEPRECATED;
+ char _pad2[4];
/** Uv coordinates scale. */
- float gradient_scale[2];
+ float gradient_scale[2] DNA_DEPRECATED;
/** Factor to shift filling in 2d space. */
- float gradient_shift[2];
+ float gradient_shift[2] DNA_DEPRECATED;
/** Angle used for texture orientation. */
float texture_angle;
/** Texture scale (separated of uv scale). */
@@ -107,35 +106,35 @@ typedef struct MaterialGPencilStyle {
/* MaterialGPencilStyle->flag */
typedef enum eMaterialGPencilStyle_Flag {
/* Fill Texture is a pattern */
- GP_STYLE_FILL_PATTERN = (1 << 0),
+ GP_MATERIAL_FILL_PATTERN = (1 << 0),
/* don't display color */
- GP_STYLE_COLOR_HIDE = (1 << 1),
+ GP_MATERIAL_HIDE = (1 << 1),
/* protected from further editing */
- GP_STYLE_COLOR_LOCKED = (1 << 2),
+ GP_MATERIAL_LOCKED = (1 << 2),
/* do onion skinning */
- GP_STYLE_COLOR_ONIONSKIN = (1 << 3),
+ GP_MATERIAL_ONIONSKIN = (1 << 3),
/* clamp texture */
- GP_STYLE_COLOR_TEX_CLAMP = (1 << 4),
+ GP_MATERIAL_TEX_CLAMP = (1 << 4),
/* mix fill texture */
- GP_STYLE_FILL_TEX_MIX = (1 << 5),
+ GP_MATERIAL_FILL_TEX_MIX = (1 << 5),
/* Flip fill colors */
- GP_STYLE_COLOR_FLIP_FILL = (1 << 6),
+ GP_MATERIAL_FLIP_FILL = (1 << 6),
/* Stroke Texture is a pattern */
- GP_STYLE_STROKE_PATTERN = (1 << 7),
+ GP_MATERIAL_STROKE_PATTERN = (1 << 7),
/* Stroke show main switch */
- GP_STYLE_STROKE_SHOW = (1 << 8),
- /* Fill show main switch */
- GP_STYLE_FILL_SHOW = (1 << 9),
+ GP_MATERIAL_STROKE_SHOW = (1 << 8),
+ /* Fill show main switch */
+ GP_MATERIAL_FILL_SHOW = (1 << 9),
/* mix stroke texture */
- GP_STYLE_STROKE_TEX_MIX = (1 << 11),
+ GP_MATERIAL_STROKE_TEX_MIX = (1 << 11),
/* disable stencil clipping (overlap) */
- GP_STYLE_DISABLE_STENCIL = (1 << 12),
+ GP_MATERIAL_DISABLE_STENCIL = (1 << 12),
} eMaterialGPencilStyle_Flag;
typedef enum eMaterialGPencilStyle_Mode {
- GP_STYLE_MODE_LINE = 0, /* line */
- GP_STYLE_MODE_DOTS = 1, /* dots */
- GP_STYLE_MODE_BOX = 2, /* rectangles */
+ GP_MATERIAL_MODE_LINE = 0,
+ GP_MATERIAL_MODE_DOT = 1,
+ GP_MATERIAL_MODE_SQUARE = 2,
} eMaterialGPencilStyle_Mode;
typedef struct Material {
@@ -332,28 +331,28 @@ enum {
/* Grease Pencil Stroke styles */
enum {
- GP_STYLE_STROKE_STYLE_SOLID = 0,
- GP_STYLE_STROKE_STYLE_TEXTURE,
+ GP_MATERIAL_STROKE_STYLE_SOLID = 0,
+ GP_MATERIAL_STROKE_STYLE_TEXTURE,
};
/* Grease Pencil Fill styles */
enum {
- GP_STYLE_FILL_STYLE_SOLID = 0,
- GP_STYLE_FILL_STYLE_GRADIENT,
- GP_STYLE_FILL_STYLE_CHECKER,
- GP_STYLE_FILL_STYLE_TEXTURE,
+ GP_MATERIAL_FILL_STYLE_SOLID = 0,
+ GP_MATERIAL_FILL_STYLE_GRADIENT,
+ GP_MATERIAL_FILL_STYLE_CHECKER, /* DEPRECATED (only for convert old files) */
+ GP_MATERIAL_FILL_STYLE_TEXTURE,
};
/* Grease Pencil Gradient Types */
enum {
- GP_STYLE_GRADIENT_LINEAR = 0,
- GP_STYLE_GRADIENT_RADIAL,
+ GP_MATERIAL_GRADIENT_LINEAR = 0,
+ GP_MATERIAL_GRADIENT_RADIAL,
};
/* Grease Pencil Follow Drawing Modes */
enum {
- GP_STYLE_FOLLOW_PATH = 0,
- GP_STYLE_FOLLOW_OBJ,
- GP_STYLE_FOLLOW_FIXED,
+ GP_MATERIAL_FOLLOW_PATH = 0,
+ GP_MATERIAL_FOLLOW_OBJ,
+ GP_MATERIAL_FOLLOW_FIXED,
};
#endif
diff --git a/source/blender/makesdna/DNA_object_enums.h b/source/blender/makesdna/DNA_object_enums.h
index c15f32564c4..f3e69161c85 100644
--- a/source/blender/makesdna/DNA_object_enums.h
+++ b/source/blender/makesdna/DNA_object_enums.h
@@ -37,6 +37,7 @@ typedef enum eObjectMode {
OB_MODE_PAINT_GPENCIL = 1 << 8,
OB_MODE_SCULPT_GPENCIL = 1 << 9,
OB_MODE_WEIGHT_GPENCIL = 1 << 10,
+ OB_MODE_VERTEX_GPENCIL = 1 << 11,
} eObjectMode;
/** #Object.dt, #View3DShading.type */
@@ -54,7 +55,8 @@ typedef enum eDrawType {
(OB_MODE_SCULPT | OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT)
#define OB_MODE_ALL_PAINT_GPENCIL \
- (OB_MODE_PAINT_GPENCIL | OB_MODE_SCULPT_GPENCIL | OB_MODE_WEIGHT_GPENCIL)
+ (OB_MODE_PAINT_GPENCIL | OB_MODE_SCULPT_GPENCIL | OB_MODE_WEIGHT_GPENCIL | \
+ OB_MODE_VERTEX_GPENCIL)
/** Any mode that uses Object.sculpt. */
#define OB_MODE_ALL_SCULPT (OB_MODE_SCULPT | OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT)
@@ -66,6 +68,6 @@ typedef enum eDrawType {
#define OB_MODE_ALL_MODE_DATA \
(OB_MODE_EDIT | OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_SCULPT | OB_MODE_POSE | \
OB_MODE_PAINT_GPENCIL | OB_MODE_EDIT_GPENCIL | OB_MODE_SCULPT_GPENCIL | \
- OB_MODE_WEIGHT_GPENCIL)
+ OB_MODE_WEIGHT_GPENCIL | OB_MODE_VERTEX_GPENCIL)
#endif /* __DNA_OBJECT_ENUMS_H__ */
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 4d15abc3c77..fca74c29909 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -167,6 +167,18 @@ typedef struct Object_Runtime {
struct Mesh *mesh_deform_eval;
/**
+ * Original grease pencil bGPdata pointer, before object->data was changed to point
+ * to gpd_eval.
+ * Is assigned by dependency graph's copy-on-write evaluation.
+ */
+ struct bGPdata *gpd_orig;
+ /**
+ * bGPdata structure created during object evaluation.
+ * It has all modifiers applied.
+ */
+ struct bGPdata *gpd_eval;
+
+ /**
* This is a mesh representation of corresponding object.
* It created when Python calls `object.to_mesh()`.
*/
@@ -175,14 +187,6 @@ typedef struct Object_Runtime {
/** Runtime evaluated curve-specific data, not stored in the file. */
struct CurveCache *curve_cache;
- /** Runtime grease pencil drawing data */
- struct GpencilBatchCache *gpencil_cache;
- /** Runtime grease pencil total layers used for evaluated data created by modifiers */
- int gpencil_tot_layers;
- char _pad4[4];
- /** Runtime grease pencil evaluated data created by modifiers */
- struct bGPDframe *gpencil_evaluated_frames;
-
unsigned short local_collections_bits;
short _pad2[3];
} Object_Runtime;
@@ -542,6 +546,8 @@ enum {
OB_DRAWTRANSP = 1 << 7,
OB_DRAW_ALL_EDGES = 1 << 8, /* only for meshes currently */
OB_DRAW_NO_SHADOW_CAST = 1 << 9,
+ /* Enable lights for grease pencil. */
+ OB_USE_GPENCIL_LIGHTS = 1 << 10,
};
/* empty_drawtype: no flags */
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 8617f122d55..3a88cd0a33b 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -999,8 +999,38 @@ typedef struct UvSculpt {
/* grease pencil drawing brushes */
typedef struct GpPaint {
Paint paint;
+ int flag;
+ /* Mode of paint (Materials or Vertex Color). */
+ int mode;
} GpPaint;
+/* GpPaint.flag */
+enum {
+ GPPAINT_FLAG_USE_MATERIAL = 0,
+ GPPAINT_FLAG_USE_VERTEXCOLOR = 1,
+};
+
+/* Grease pencil vertex paint. */
+typedef struct GpVertexPaint {
+ Paint paint;
+ int flag;
+ char _pad[4];
+} GpVertexPaint;
+
+/* Grease pencil sculpt paint. */
+typedef struct GpSculptPaint {
+ Paint paint;
+ int flag;
+ char _pad[4];
+} GpSculptPaint;
+
+/* Grease pencil weight paint. */
+typedef struct GpWeightPaint {
+ Paint paint;
+ int flag;
+ char _pad[4];
+} GpWeightPaint;
+
/* ------------------------------------------- */
/* Vertex Paint */
@@ -1022,27 +1052,6 @@ enum {
/* ------------------------------------------- */
/* GPencil Stroke Sculpting */
-/* GP_Sculpt_Settings.brushtype */
-typedef enum eGP_Sculpt_Types {
- GP_SCULPT_TYPE_SMOOTH = 0,
- GP_SCULPT_TYPE_THICKNESS = 1,
- GP_SCULPT_TYPE_STRENGTH = 2,
- GP_SCULPT_TYPE_GRAB = 3,
- GP_SCULPT_TYPE_PUSH = 4,
- GP_SCULPT_TYPE_TWIST = 5,
- GP_SCULPT_TYPE_PINCH = 6,
- GP_SCULPT_TYPE_RANDOMIZE = 7,
- GP_SCULPT_TYPE_CLONE = 8,
- GP_SCULPT_TYPE_SUBDIVIDE = 9,
- GP_SCULPT_TYPE_SIMPLIFY = 10,
- /* add any sculpt brush above this value */
- GP_SCULPT_TYPE_WEIGHT = 11,
- /* add any weight paint brush below this value. Do no mix brushes */
-
- /* !!! Update GP_Sculpt_Data brush[###]; below !!! */
- GP_SCULPT_TYPE_MAX,
-} eGP_Sculpt_Types;
-
/* GP_Sculpt_Settings.lock_axis */
typedef enum eGP_Lockaxis_Types {
GP_LOCKAXIS_VIEW = 0,
@@ -1052,23 +1061,6 @@ typedef enum eGP_Lockaxis_Types {
GP_LOCKAXIS_CURSOR = 4,
} eGP_Lockaxis_Types;
-/* Settings for a GPencil Stroke Sculpting Brush */
-typedef struct GP_Sculpt_Data {
- /** Radius of brush. */
- short size;
- /** EGP_Sculpt_Flag. */
- short flag;
- /** Strength of effect. */
- float strength;
- /** Cursor color for add. */
- float curcolor_add[3];
- /** Cursor color for sub. */
- float curcolor_sub[3];
- /** Target weight. */
- float weight;
- char _pad[4];
-} GP_Sculpt_Data;
-
/* Settings for a GPencil Speed Guide */
typedef struct GP_Sculpt_Guide {
char use_guide;
@@ -1083,48 +1075,17 @@ typedef struct GP_Sculpt_Guide {
struct Object *reference_object;
} GP_Sculpt_Guide;
-/* GP_Sculpt_Data.flag */
-typedef enum eGP_Sculpt_Flag {
- /* invert the effect of the brush */
- GP_SCULPT_FLAG_INVERT = (1 << 0),
- /* adjust strength using pen pressure */
- GP_SCULPT_FLAG_USE_PRESSURE = (1 << 1),
-
- /* strength of brush falls off with distance from cursor */
- GP_SCULPT_FLAG_USE_FALLOFF = (1 << 2),
-
- /* smooth brush affects pressure values as well */
- GP_SCULPT_FLAG_SMOOTH_PRESSURE = (1 << 3),
- /* enable screen cursor */
- GP_SCULPT_FLAG_ENABLE_CURSOR = (1 << 4),
- /* temporary invert action */
- GP_SCULPT_FLAG_TMP_INVERT = (1 << 5),
- /* adjust radius using pen pressure */
- GP_SCULPT_FLAG_PRESSURE_RADIUS = (1 << 6),
-} eGP_Sculpt_Flag;
-
/* GPencil Stroke Sculpting Settings */
typedef struct GP_Sculpt_Settings {
- /** GP_SCULPT_TYPE_MAX. */
- GP_Sculpt_Data brush[12];
/** Runtime. */
void *paintcursor;
-
- /** #eGP_Sculpt_Types (sculpt). */
- int brushtype;
/** #eGP_Sculpt_SettingsFlag. */
int flag;
/** #eGP_Lockaxis_Types lock drawing to one axis. */
int lock_axis;
/** Threshold for intersections */
float isect_threshold;
-
- /* weight paint is a submode of sculpt but use its own index. All weight paint
- * brushes must be defined at the end of the brush array.
- */
- /** #eGP_Sculpt_Types (weight paint). */
- int weighttype;
- char _pad[4];
+ char _pad_[4];
/** Multiframe edit falloff effect by frame. */
struct CurveMapping *cur_falloff;
/** Curve used for primitive tools. */
@@ -1135,22 +1096,12 @@ typedef struct GP_Sculpt_Settings {
/* GP_Sculpt_Settings.flag */
typedef enum eGP_Sculpt_SettingsFlag {
- /* only affect selected points */
- GP_SCULPT_SETT_FLAG_DEPRECATED = (1 << 0),
- /* apply brush to position */
- GP_SCULPT_SETT_FLAG_APPLY_POSITION = (1 << 1),
- /* apply brush to strength */
- GP_SCULPT_SETT_FLAG_APPLY_STRENGTH = (1 << 2),
- /* apply brush to thickness */
- GP_SCULPT_SETT_FLAG_APPLY_THICKNESS = (1 << 3),
- /* apply brush to thickness */
- GP_SCULPT_SETT_FLAG_WEIGHT_MODE = (1 << 4),
/* enable falloff for multiframe editing */
- GP_SCULPT_SETT_FLAG_FRAME_FALLOFF = (1 << 5),
- /* apply brush to uv data */
- GP_SCULPT_SETT_FLAG_APPLY_UV = (1 << 6),
+ GP_SCULPT_SETT_FLAG_FRAME_FALLOFF = (1 << 0),
/* apply primitive curve */
- GP_SCULPT_SETT_FLAG_PRIMITIVE_CURVE = (1 << 7),
+ GP_SCULPT_SETT_FLAG_PRIMITIVE_CURVE = (1 << 1),
+ /* Scale thickness. */
+ GP_SCULPT_SETT_FLAG_SCALE_THICKNESS = (1 << 3),
} eGP_Sculpt_SettingsFlag;
/* GP_Sculpt_Settings.gpencil_selectmode_sculpt */
@@ -1163,6 +1114,16 @@ typedef enum eGP_Sculpt_SelectMaskFlag {
GP_SCULPT_MASK_SELECTMODE_SEGMENT = (1 << 2),
} eGP_Sculpt_SelectMaskFlag;
+/* GP_Sculpt_Settings.gpencil_selectmode_vertex */
+typedef enum eGP_vertex_SelectMaskFlag {
+ /* only affect selected points */
+ GP_VERTEX_MASK_SELECTMODE_POINT = (1 << 0),
+ /* only affect selected strokes */
+ GP_VERTEX_MASK_SELECTMODE_STROKE = (1 << 1),
+ /* only affect selected segmenst */
+ GP_VERTEX_MASK_SELECTMODE_SEGMENT = (1 << 2),
+} eGP_Vertex_SelectMaskFlag;
+
/* Settings for GP Interpolation Operators */
typedef struct GP_Interpolate_Settings {
/** #eGP_Interpolate_SettingsFlag. */
@@ -1395,6 +1356,12 @@ typedef struct ToolSettings {
UvSculpt *uvsculpt;
/** Gpencil paint. */
GpPaint *gp_paint;
+ /** Gpencil vertex paint. */
+ GpVertexPaint *gp_vertexpaint;
+ /** Gpencil sculpt paint. */
+ GpSculptPaint *gp_sculptpaint;
+ /** Gpencil weight paint. */
+ GpWeightPaint *gp_weightpaint;
/* Vertex group weight - used only for editmode, not weight
* paint */
@@ -1508,8 +1475,11 @@ typedef struct ToolSettings {
/** Subset selection filter in wpaint. */
char vgroupsubset;
+ /** Stroke selection mode for Vertex Paint. */
+ char gpencil_selectmode_vertex;
+
/* UV painting */
- char _pad2[3];
+ char _pad2[2];
char uv_sculpt_settings;
char uv_relax_method;
/* XXX: these sculpt_paint_* fields are deprecated, use the
@@ -2289,14 +2259,12 @@ typedef enum eGPencil_SimplifyFlags {
SIMPLIFY_GPENCIL_FILL = (1 << 2),
/* Simplify modifier on viewport */
SIMPLIFY_GPENCIL_MODIFIER = (1 << 3),
- /* Remove fill external line */
- SIMPLIFY_GPENCIL_REMOVE_FILL_LINE = (1 << 4),
/* Simplify Shader FX */
SIMPLIFY_GPENCIL_FX = (1 << 5),
- /* Simplify layer blending */
- SIMPLIFY_GPENCIL_BLEND = (1 << 6),
/* Simplify layer tint */
SIMPLIFY_GPENCIL_TINT = (1 << 7),
+ /* Simplify Antialiasing */
+ SIMPLIFY_GPENCIL_AA = (1 << 8),
} eGPencil_SimplifyFlags;
/* ToolSettings.gpencil_*_align - Stroke Placement mode flags */
diff --git a/source/blender/makesdna/DNA_shader_fx_types.h b/source/blender/makesdna/DNA_shader_fx_types.h
index 6cda58a3279..e0931d8cac3 100644
--- a/source/blender/makesdna/DNA_shader_fx_types.h
+++ b/source/blender/makesdna/DNA_shader_fx_types.h
@@ -34,7 +34,7 @@ typedef enum ShaderFxType {
eShaderFxType_None = 0,
eShaderFxType_Blur = 1,
eShaderFxType_Flip = 2,
- eShaderFxType_Light = 3,
+ eShaderFxType_Light_deprecated = 3, /* DEPRECATED (replaced by scene lights) */
eShaderFxType_Pixel = 4,
eShaderFxType_Swirl = 5,
eShaderFxType_Wave = 6,
@@ -81,15 +81,13 @@ typedef struct ShaderFxData_Runtime {
typedef struct BlurShaderFxData {
ShaderFxData shaderfx;
- int radius[2];
+ float radius[2];
/** Flags. */
int flag;
/** Number of samples. */
int samples;
- /** Circle of confusion. */
- float coc;
- /** Not visible in rna. */
- int blur[2];
+ /** Rotation of blur effect. */
+ float rotation;
char _pad[4];
ShaderFxData_Runtime runtime;
@@ -136,14 +134,20 @@ typedef enum eFlipShaderFx_Flag {
typedef struct GlowShaderFxData {
ShaderFxData shaderfx;
- float glow_color[3];
+ float glow_color[4];
float select_color[3];
float threshold;
/** Flags. */
int flag;
int mode;
- int blur[2];
+ float blur[2];
int samples;
+ /** Rotation of effect. */
+ float rotation;
+ /** Blend modes. */
+ int blend_mode;
+ char _pad[4];
+
ShaderFxData_Runtime runtime;
} GlowShaderFxData;
@@ -156,19 +160,6 @@ typedef enum eGlowShaderFx_Flag {
FX_GLOW_USE_ALPHA = (1 << 0),
} eGlowShaderFx_Flag;
-typedef struct LightShaderFxData {
- ShaderFxData shaderfx;
- struct Object *object;
- /** Flags. */
- int flag;
- float energy;
- float ambient;
- /** Internal, not visible in rna. */
- float loc[4];
- char _pad[4];
- ShaderFxData_Runtime runtime;
-} LightShaderFxData;
-
typedef struct PixelShaderFxData {
ShaderFxData shaderfx;
/** Last element used for shader only. */
@@ -179,10 +170,6 @@ typedef struct PixelShaderFxData {
ShaderFxData_Runtime runtime;
} PixelShaderFxData;
-typedef enum ePixelShaderFx_Flag {
- FX_PIXEL_USE_LINES = (1 << 0),
-} ePixelShaderFx_Flag;
-
typedef struct RimShaderFxData {
ShaderFxData shaderfx;
int offset[2];
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index b3f82bc1269..6961a9e9c3e 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -853,8 +853,7 @@ typedef struct UserDef {
short pie_menu_threshold;
short opensubdiv_compute_type;
- /** #eMultiSample_Type, amount of samples for Grease Pencil. */
- short gpencil_multisamples;
+ short _pad6;
char factor_display_type;
@@ -1228,7 +1227,7 @@ typedef enum eNdof_Flag {
#define NDOF_PIXELS_PER_SECOND 600.0f
-/** UserDef.ogl_multisamples and gpencil_multisamples */
+/** UserDef.ogl_multisamples */
typedef enum eMultiSample_Type {
USER_MULTISAMPLE_NONE = 0,
USER_MULTISAMPLE_2 = 2,
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index 67ef1b35f9d..edc86a4b0ea 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -224,6 +224,9 @@ typedef struct View3DOverlay {
float gpencil_grid_opacity;
float gpencil_fade_layer;
+ /** Factor for mixing vertex paint with original color */
+ float gpencil_vertex_paint_opacity;
+ char _pad4[4];
} View3DOverlay;
typedef struct View3D_Runtime {
@@ -415,13 +418,15 @@ enum {
#define V3D_FLAG2_UNUSED_15 (1 << 15) /* cleared */
/** #View3D.gp_flag (short) */
-#define V3D_GP_SHOW_PAPER (1 << 0) /* Activate paper to cover all viewport */
-#define V3D_GP_SHOW_GRID (1 << 1) /* Activate paper grid */
+#define V3D_GP_FADE_OBJECTS (1 << 0) /* Fade all non GP objects */
+#define V3D_GP_SHOW_GRID (1 << 1) /* Activate paper grid */
#define V3D_GP_SHOW_EDIT_LINES (1 << 2)
#define V3D_GP_SHOW_MULTIEDIT_LINES (1 << 3)
#define V3D_GP_SHOW_ONION_SKIN (1 << 4) /* main switch at view level */
#define V3D_GP_FADE_NOACTIVE_LAYERS (1 << 5) /* fade layers not active */
#define V3D_GP_FADE_NOACTIVE_GPENCIL (1 << 6) /* Fade other GPencil objects */
+#define V3D_GP_SHOW_STROKE_DIRECTION (1 << 7) /* Show Strokes Directions */
+#define V3D_GP_SHOW_MATERIAL_NAME (1 << 8) /* Show Material names */
/** #View3DShading.flag */
enum {
diff --git a/source/blender/makesdna/intern/dna_rename_defs.h b/source/blender/makesdna/intern/dna_rename_defs.h
index 1ae7ad6bc70..678baef3cef 100644
--- a/source/blender/makesdna/intern/dna_rename_defs.h
+++ b/source/blender/makesdna/intern/dna_rename_defs.h
@@ -110,3 +110,7 @@ DNA_STRUCT_RENAME_ELEM(bTheme, ttopbar, space_topbar)
DNA_STRUCT_RENAME_ELEM(bTheme, tuserpref, space_preferences)
DNA_STRUCT_RENAME_ELEM(bTheme, tv3d, space_view3d)
DNA_STRUCT_RENAME_ELEM(ThemeSpace, show_back_grad, background_type)
+DNA_STRUCT_RENAME_ELEM(bGPDstroke, gradient_f, hardeness)
+DNA_STRUCT_RENAME_ELEM(bGPDstroke, gradient_s, aspect_ratio)
+DNA_STRUCT_RENAME_ELEM(BrushGpencilSettings, gradient_f, hardeness)
+DNA_STRUCT_RENAME_ELEM(BrushGpencilSettings, gradient_s, aspect_ratio)