Blender V5.0
DNA_gpencil_legacy_types.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2008 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include "DNA_ID.h"
12#include "DNA_curve_types.h"
13#include "DNA_listBase.h"
14
15struct AnimData;
16struct MDeformVert;
17
18#define GP_DEFAULT_PIX_FACTOR 1.0f
19#define GP_DEFAULT_GRID_LINES 4
20#define GP_MAX_INPUT_SAMPLES 10
21
22#define GP_DEFAULT_CURVE_RESOLUTION 32
23#define GP_DEFAULT_CURVE_ERROR 0.1f
24#define GP_DEFAULT_CURVE_EDIT_CORNER_ANGLE M_PI_2
25
26#define GPENCIL_MIN_FILL_FAC 0.05f
27#define GPENCIL_MAX_FILL_FAC 8.0f
28
35typedef struct bGPDspoint {
37
38
41 float pressure;
43 float strength;
45 float time;
47 int flag;
48
50 float uv_fac;
52 float uv_rot;
54 float uv_fill[2];
55
57 float vert_color[4];
58
60 char _pad2[4];
62
65 /* stroke point is selected (for editing) */
66 GP_SPOINT_SELECT = (1 << 0),
67
68 /* stroke point is tagged (for some editing operation) */
69 GP_SPOINT_TAG = (1 << 1),
71
72/* ***************************************** */
73/* GP Fill - Triangle Tessellation Data */
74
75/* Grease-Pencil Annotations - 'Triangle'
76 * -> A triangle contains the index of three vertices for filling the stroke
77 * This is only used if high quality fill is enabled
78 */
79typedef struct bGPDtriangle {
80 /* indices for tessellated triangle used for GP Fill */
81 unsigned int verts[3];
83
84/* ***************************************** */
85
86/* ***************************************** */
87/* GP Palettes (Deprecated - 2.78 - 2.79 only) */
88
89/* color of palettes */
90typedef struct bGPDpalettecolor {
92
95 char info[64];
96 float color[4];
98 float fill[4];
100 short flag;
102 char _pad[6];
104
107 /* color is active */
108 /* PC_COLOR_ACTIVE = (1 << 0), */ /* UNUSED */
109 /* don't display color */
110 PC_COLOR_HIDE = (1 << 1),
111 /* protected from further editing */
112 PC_COLOR_LOCKED = (1 << 2),
113 /* do onion skinning */
115 /* "volumetric" strokes */
118
119/* palette of colors */
120typedef struct bGPDpalette {
122
124
128 char info[64];
129
130 short flag;
131 char _pad[6];
133
136 /* palette is active */
139
140/* ***************************************** */
141/* GP Curve Point */
142
143typedef struct bGPDcurve_point {
147 float pressure;
149 float strength;
152
154 int flag;
155
157 float uv_fac;
159 float uv_rot;
161 float uv_fill[2];
162
164 float vert_color[4];
165 char _pad[4];
167
168/* bGPDcurve_point->flag */
172
173/* ***************************************** */
174/* GP Curve */
175
176/* Curve for Bezier Editing. */
188
189/* bGPDcurve_Flag->flag */
191 /* Flag to indicated that the stroke data has been changed and the curve needs to be refitted */
193 /* Curve is selected */
194 GP_CURVE_SELECT = (1 << 1),
196
197/* ***************************************** */
198/* GP Strokes */
199
200/* Runtime temp data for bGPDstroke */
224
291
294 /* stroke is in 3d-space */
296 /* stroke is in 2d-space */
298 /* stroke is in 2d-space (but with special 'image' scaling) */
300 /* stroke is selected */
302 /* Flag used to indicate that stroke is closed and draw edge between last and first point */
304 /* Flag used to indicate that stroke is used for fill close and must use
305 * fill color for stroke and no fill area */
307 /* Flag to indicated that the editcurve has been changed and the stroke needs to be updated with
308 * the curve data */
310 /* Flag to indicate that a stroke is used only for help, and will not affect rendering or fill */
311 GP_STROKE_HELP = (1 << 10),
312 /* Flag to indicate that a extend stroke collide (fill tool). */
313 GP_STROKE_COLLIDE = (1 << 11),
314 /* only for use with stroke-buffer (while drawing arrows) */
316 /* only for use with stroke-buffer (while drawing arrows) */
318 /* Tag for update geometry */
319 GP_STROKE_TAG = (1 << 14),
320 /* only for use with stroke-buffer (while drawing eraser) */
321 GP_STROKE_ERASER = (1 << 15),
323
325typedef enum eGPDstroke_Caps {
326 /* type of extreme */
329
330 /* Keep last. */
333
334/* Arrows ----------------------- */
335
344
345/* ***************************************** */
346/* GP Frame */
347
348/* Runtime temp data for bGPDframe */
357
380
381/* bGPDframe->flag */
383 /* frame is being painted on */
384 GP_FRAME_PAINT = (1 << 0),
385 /* for editing in Action Editor */
386 GP_FRAME_SELECT = (1 << 1),
387 /* Line Art generation */
390
391/* ***************************************** */
392/* GP Layer */
393
394/* List of masking layers. */
405
406/* bGPDlayer_Mask->flag */
408 /* Mask is hidden. */
409 GP_MASK_HIDE = (1 << 0),
410 /* Mask is inverted. */
411 GP_MASK_INVERT = (1 << 1),
413
422
426
427 struct bGPDlayer *next, *prev;
428
433
435 short flag;
438
441 float color[4];
443 float fill[4];
444
447 char info[128];
448
453
455 struct Object *parent;
457 float inverse[4][4];
459 char parsubstr[/*MAX_NAME*/ 64];
460 short partype;
461
465 float tintcolor[4];
467 float opacity;
470
475
476 /* annotation onion skin */
481 short gstep;
487
489 float gcolor_prev[3];
491 float gcolor_next[3];
492 char _pad1[4];
493
498 char _pad2[4];
499
501 float location[3], rotation[3], scale[3];
502 float layer_mat[4][4], layer_invmat[4][4];
503 char _pad3[4];
504
507
508/* bGPDlayer->flag */
510 /* don't display layer */
511 GP_LAYER_HIDE = (1 << 0),
512 /* protected from further editing */
513 GP_LAYER_LOCKED = (1 << 1),
514 /* layer is 'active' layer being edited */
515 GP_LAYER_ACTIVE = (1 << 2),
516 /* draw points of stroke for debugging purposes */
518 /* Flag used to display in Paint mode only layers with keyframe */
520 /* for editing in Action Editor */
521 GP_LAYER_SELECT = (1 << 5),
522 /* current frame for layer can't be changed */
524 /* Don't render X-ray (which is default). */
526 /* "volumetric" strokes */
528 /* Use Scene lights */
530 /* Unlock color */
532 /* Mask Layer */
533 GP_LAYER_USE_MASK = (1 << 13), /* TODO: DEPRECATED */
534 /* Ruler Layer */
535 GP_LAYER_IS_RULER = (1 << 14),
536 /* Disable masks in view-layer render */
539
542 /* do onion skinning */
546
556
557/* ***************************************** */
558/* GP Datablock */
559
560/* Runtime temp data for bGPdata */
561typedef struct bGPdata_Runtime {
563
564
565 void *sbuffer;
566
568 short playing;
569
571 short matid;
572
573 /* Stroke Buffer data (only used during paint-session)
574 * - buffer must be initialized before use, but freed after
575 * whole paint operation is over
576 */
579 char _pad1[2];
584
587
590
592 float arrow_start[8];
593 float arrow_end[8];
594 /* Arrow style for each corner */
597
598 char _pad[4];
600
601/* grid configuration */
603 float color[3];
604 float scale[2];
605 float offset[2];
606 char _pad1[4];
607
608 int lines;
609 char _pad[4];
611
613typedef struct bGPdata {
614#ifdef __cplusplus
617 static constexpr ID_Type id_type = ID_GD_LEGACY;
618#endif
619
623 struct AnimData *adt;
624
625 /* Grease-Pencil data */
629 int flag;
636
637 /* Palettes */
640
643
644 /* 3D Viewport/Appearance Settings */
648 float line_color[4];
649
650 /* Onion skinning */
661 short gstep;
667
669 float gcolor_prev[3];
671 float gcolor_next[3];
672
676 struct Material **mat;
678 short totcol;
679
680 /* stats */
681 short totlayer;
682 short totframe;
683 char _pad2[6];
686
691
694
696
698
701
709typedef enum eGPdata_Flag {
710 /* data-block is used for "annotations"
711 * NOTE: This flag used to be used in 2.4x, but should hardly ever have been set.
712 * We can use this freely now, as all GP data-blocks from pre-2.8 will get
713 * set on file load (as many old use cases are for "annotations" only)
714 */
716
717 /* show debugging info in viewport (i.e. status print) */
719 /* in Action Editor, show as expanded channel */
720 GP_DATA_EXPAND = (1 << 2),
721
722 /* is the block overriding all clicks? */
723 /* GP_DATA_EDITPAINT = (1 << 3), */
724
725 /* ------------------------------------------------ DEPRECATED */
726 /* new strokes are added in viewport space */
728
729 /* Project into the screen's Z values */
732
734 /* ------------------------------------------------ DEPRECATED */
735
736 /* Stroke Editing Mode - Toggle to enable alternative keymap
737 * for easier editing of stroke points */
739
740 /* Main flag to switch onion skinning on/off */
742
743 /* Batch drawing cache need to be recalculated */
745
746 /* Stroke Paint Mode - Toggle paint mode */
748 /* Stroke Editing Mode - Toggle sculpt mode */
750 /* Stroke Editing Mode - Toggle weight paint mode */
752
753 /* keep stroke thickness unchanged when zoom change */
755
756 /* Allow edit several frames at the same time */
758
759 /* Vertex Paint Mode - Toggle paint mode */
761
762 /* Auto-lock not active layers. */
764
765 /* Enable Bezier Editing Curve (a sub-mode of Edit mode). */
767 /* Use adaptive curve resolution */
770
771/* gpd->onion_flag */
772typedef enum eGPD_OnionFlag {
773 /* use custom color for ghosts before current frame */
775 /* use custom color for ghosts after current frame */
777 /* always show onion skins (i.e. even during renders/animation playback) */
779 /* use fade color in onion skin */
780 GP_ONION_FADE = (1 << 3),
781 /* Loop showing first frame after last frame */
782 GP_ONION_LOOP = (1 << 4),
784
785/* gpd->onion_mode */
791
792/* X-ray modes (Depth Ordering). */
797
798/* draw modes (Use 2D or 3D position) */
ID and Library types, which are fundamental for SDNA.
ID_Type
@ ID_GD_LEGACY
#define DNA_DEFINE_CXX_METHODS(class_name)
Definition DNA_defs.h:66
@ GP_ONION_MODE_RELATIVE
@ GP_ONION_MODE_SELECTED
@ GP_ONION_MODE_ABSOLUTE
enum eGPDstroke_Caps GPDstroke_Caps
@ GP_CURVE_NEEDS_STROKE_UPDATE
@ GP_STROKE_ARROWSTYLE_NONE
@ GP_STROKE_ARROWSTYLE_SEGMENT
@ GP_STROKE_ARROWSTYLE_CLOSED
@ GP_STROKE_ARROWSTYLE_OPEN
@ GP_STROKE_ARROWSTYLE_SQUARE
struct bGPDtriangle bGPDtriangle
@ GP_STROKE_USE_ARROW_END
@ GP_STROKE_NEEDS_CURVE_UPDATE
@ GP_STROKE_USE_ARROW_START
enum eGPDspoint_Flag eGPSPoint_Flag
struct bGPdata bGPdata
@ GP_LAYER_DISABLE_MASKS_IN_VIEWLAYER
@ GP_LAYER_UNLOCK_COLOR
@ GP_LAYER_ONIONSKIN_CUSTOM_COLOR
@ GP_ONION_GHOST_NEXTCOL
@ GP_ONION_GHOST_ALWAYS
@ GP_ONION_GHOST_PREVCOL
struct bGPDcurve_point bGPDcurve_point
@ GP_DATA_SHOW_ONIONSKINS
@ GP_DATA_CURVE_ADAPTIVE_RESOLUTION
@ GP_DATA_STROKE_WEIGHTMODE
@ GP_DATA_DEPTH_STROKE_ENDPOINTS
@ GP_DATA_STROKE_VERTEXMODE
@ GP_DATA_CURVE_EDIT_MODE
@ GP_DATA_STROKE_MULTIEDIT
@ GP_DATA_CACHE_IS_DIRTY
@ GP_DATA_STROKE_PAINTMODE
@ GP_DATA_STROKE_SCULPTMODE
@ GP_DATA_AUTOLOCK_LAYERS
@ GP_DATA_STROKE_KEEPTHICKNESS
@ GP_DATA_STROKE_EDITMODE
@ GP_CURVE_POINT_SELECT
struct bGPgrid bGPgrid
@ eGplBlendMode_Regular
@ eGplBlendMode_Multiply
@ eGplBlendMode_Subtract
@ eGplBlendMode_HardLight
These structs are the foundation for all linked lists in the library system.
nullptr float
#define typedef
Definition DNA_ID.h:414
bGPDcurve_point * curve_points
struct bGPDframe * next
bGPDframe_Runtime runtime
struct bGPDframe * prev
struct bGPDlayer_Mask * prev
struct bGPDlayer_Mask * next
struct Object * parent
struct bGPDlayer * next
bGPDlayer_Runtime runtime
struct bGPDlayer * prev
struct bGPDpalette * next
struct bGPDpalette * prev
struct bGPDpalettecolor * prev
struct bGPDpalettecolor * next
struct bGPDstroke * gps_orig
struct bGPDstroke * prev
char colorname[128] DNA_DEPRECATED
bGPDtriangle * triangles
bGPDstroke_Runtime runtime
struct bGPDcurve * editcurve
struct MDeformVert * dvert
struct bGPDstroke * next
unsigned int verts[3]
ListBase palettes DNA_DEPRECATED
ListBase vertex_group_names
struct Material ** mat
bGPdata_Runtime runtime
struct AnimData * adt