Blender V5.3
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 "BLI_enum_flags.hh"
12
13#include "DNA_ID.h"
14#include "DNA_curve_types.h"
15#include "DNA_listBase.h"
16
17namespace blender {
18
19struct AnimData;
20struct MDeformVert;
21struct tGPspoint;
22
24enum eGPDspoint_Flag : int {
25 /* stroke point is selected (for editing) */
26 GP_SPOINT_SELECT = (1 << 0),
27
28 /* stroke point is tagged (for some editing operation) */
29 GP_SPOINT_TAG = (1 << 1),
30};
32
33
35 /* color is active */
36 /* PC_COLOR_ACTIVE = (1 << 0), */ /* UNUSED */
37 /* don't display color */
38 PC_COLOR_HIDE = (1 << 1),
39 /* protected from further editing */
40 PC_COLOR_LOCKED = (1 << 2),
41 /* do onion skinning */
43 /* "volumetric" strokes */
45};
47
48
49enum eGPDpalette_Flag : short {
50 /* palette is active */
52};
54
55/* bGPDcurve_point->flag */
58};
60
61/* bGPDcurve_Flag->flag */
62enum bGPDcurve_Flag : short {
63 /* Flag to indicated that the stroke data has been changed and the curve needs to be refitted */
65 /* Curve is selected */
66 GP_CURVE_SELECT = (1 << 1),
67};
69
70
71enum eGPDstroke_Flag : short {
72 /* stroke is in 3d-space */
74 /* stroke is in 2d-space */
76 /* stroke is in 2d-space (but with special 'image' scaling) */
78 /* stroke is selected */
79 GP_STROKE_SELECT = (1 << 3),
80 /* Flag used to indicate that stroke is closed and draw edge between last and first point */
81 GP_STROKE_CYCLIC = (1 << 7),
82 /* Flag used to indicate that stroke is used for fill close and must use
83 * fill color for stroke and no fill area */
84 GP_STROKE_NOFILL = (1 << 8),
85 /* Flag to indicated that the editcurve has been changed and the stroke needs to be updated with
86 * the curve data */
88 /* Flag to indicate that a stroke is used only for help, and will not affect rendering or fill */
89 GP_STROKE_HELP = (1 << 10),
90 /* Flag to indicate that a extend stroke collide (fill tool). */
91 GP_STROKE_COLLIDE = (1 << 11),
92 /* only for use with stroke-buffer (while drawing arrows) */
94 /* only for use with stroke-buffer (while drawing arrows) */
96 /* Tag for update geometry */
97 GP_STROKE_TAG = (1 << 14),
98 /* only for use with stroke-buffer (while drawing eraser) */
99 GP_STROKE_ERASER = static_cast<short>(1 << 15),
100};
102
103
104enum eGPDstroke_Caps : short {
105 /* type of extreme */
108
109 /* Keep last. */
111};
112
121
122/* bGPDframe->flag */
123enum eGPDframe_Flag : short {
124 /* frame is being painted on */
125 GP_FRAME_PAINT = (1 << 0),
126 /* for editing in Action Editor */
127 GP_FRAME_SELECT = (1 << 1),
128 /* Line Art generation */
130};
132
133/* bGPDlayer_Mask->flag */
135 /* Mask is hidden. */
136 GP_MASK_HIDE = (1 << 0),
137 /* Mask is inverted. */
138 GP_MASK_INVERT = (1 << 1),
139};
141
142/* bGPDlayer->flag */
143enum eGPDlayer_Flag : short {
144 /* don't display layer */
145 GP_LAYER_HIDE = (1 << 0),
146 /* protected from further editing */
147 GP_LAYER_LOCKED = (1 << 1),
148 /* layer is 'active' layer being edited */
149 GP_LAYER_ACTIVE = (1 << 2),
150 /* draw points of stroke for debugging purposes */
152 /* Flag used to display in Paint mode only layers with keyframe */
154 /* for editing in Action Editor */
155 GP_LAYER_SELECT = (1 << 5),
156 /* current frame for layer can't be changed */
158 /* Don't render X-ray (which is default). */
160 /* "volumetric" strokes */
162 /* Use Scene lights */
164 /* Unlock color */
166 /* Mask Layer */
167 GP_LAYER_USE_MASK = (1 << 13), /* TODO: DEPRECATED */
168 /* Ruler Layer */
169 GP_LAYER_IS_RULER = (1 << 14),
170 /* Disable masks in view-layer render */
171 GP_LAYER_DISABLE_MASKS_IN_VIEWLAYER = static_cast<short>(1 << 15),
172};
174
175
177 /* do onion skinning */
180};
182
183
192
200enum eGPdata_Flag : int {
201 /* data-block is used for "annotations"
202 * NOTE: This flag used to be used in 2.4x, but should hardly ever have been set.
203 * We can use this freely now, as all GP data-blocks from pre-2.8 will get
204 * set on file load (as many old use cases are for "annotations" only)
205 */
207
208 /* show debugging info in viewport (i.e. status print) */
210 /* in Action Editor, show as expanded channel */
211 GP_DATA_EXPAND = (1 << 2),
212
213 /* is the block overriding all clicks? */
214 /* GP_DATA_EDITPAINT = (1 << 3), */
215
216 /* ------------------------------------------------ DEPRECATED */
217 /* new strokes are added in viewport space */
219
220 /* Project into the screen's Z values */
223
225 /* ------------------------------------------------ DEPRECATED */
226
227 /* Stroke Editing Mode - Toggle to enable alternative keymap
228 * for easier editing of stroke points */
230
231 /* Main flag to switch onion skinning on/off */
233
234 /* Batch drawing cache need to be recalculated */
236
237 /* Stroke Paint Mode - Toggle paint mode */
239 /* Stroke Editing Mode - Toggle sculpt mode */
241 /* Stroke Editing Mode - Toggle weight paint mode */
243
244 /* keep stroke thickness unchanged when zoom change */
246
247 /* Allow edit several frames at the same time */
249
250 /* Vertex Paint Mode - Toggle paint mode */
252
253 /* Auto-lock not active layers. */
255
256 /* Enable Bezier Editing Curve (a sub-mode of Edit mode). */
258 /* Use adaptive curve resolution */
260};
262
263/* gpd->onion_flag */
264enum eGPD_OnionFlag : int {
265 /* use custom color for ghosts before current frame */
267 /* use custom color for ghosts after current frame */
269 /* always show onion skins (i.e. even during renders/animation playback) */
271 /* use fade color in onion skin */
272 GP_ONION_FADE = (1 << 3),
273 /* Loop showing first frame after last frame */
274 GP_ONION_LOOP = (1 << 4),
275};
277
278/* gpd->onion_mode */
284
285/* draw modes (Use 2D or 3D position) */
290
291#define GP_DEFAULT_PIX_FACTOR 1.0f
292#define GP_DEFAULT_GRID_LINES 4
293#define GP_MAX_INPUT_SAMPLES 10
294
295#define GP_DEFAULT_CURVE_RESOLUTION 32
296#define GP_DEFAULT_CURVE_ERROR 0.1f
297#define GP_DEFAULT_CURVE_EDIT_CORNER_ANGLE M_PI_2
298
299#define GPENCIL_MIN_FILL_FAC 0.05f
300#define GPENCIL_MAX_FILL_FAC 8.0f
301
310 float x = 0, y = 0, z = 0;
312 float pressure = 0;
314 float strength = 0;
316 float time = 0;
319
321 float uv_fac = 0;
323 float uv_rot = 0;
325 float uv_fill[2] = {};
326
328 float vert_color[4] = {};
329
330 char _pad2[4] = {};
331};
332
333/* ***************************************** */
334/* GP Fill - Triangle Tessellation Data */
335
336/* Grease-Pencil Annotations - 'Triangle'
337 * -> A triangle contains the index of three vertices for filling the stroke
338 * This is only used if high quality fill is enabled
339 */
341 /* indices for tessellated triangle used for GP Fill */
342 unsigned int verts[3] = {};
343};
344
345/* ***************************************** */
346
347/* ***************************************** */
348/* GP Palettes (Deprecated - 2.78 - 2.79 only) */
349
350/* color of palettes */
353
354 struct bGPDpalettecolor *next = nullptr, *prev = nullptr;
356 char info[64] = "";
357 float color[4] = {};
359 float fill[4] = {};
363 char _pad[6] = {};
364};
365
366/* palette of colors */
369
370 struct bGPDpalette *next = nullptr, *prev = nullptr;
371
373 ListBaseT<bGPDpalettecolor> colors = {nullptr, nullptr};
375 char info[64] = "";
376
378 char _pad[6] = {};
379};
380
381/* ***************************************** */
382/* GP Curve Point */
383
388 float pressure = 0;
390 float strength = 0;
392 int point_index = 0;
393
396
398 float uv_fac = 0;
400 float uv_rot = 0;
402 float uv_fill[2] = {};
403
405 float vert_color[4] = {};
406 char _pad[4] = {};
407};
408
409/* ***************************************** */
410/* GP Curve */
411
412/* Curve for Bezier Editing. */
424
425/* ***************************************** */
426/* GP Strokes */
427
428/* Runtime temp data for bGPDstroke */
431
432
433 char tmp_layerinfo[128] = "";
434
437
441 int fill_start = 0;
445 int curve_start = 0;
446 int _pad0 = {};
447
449 struct bGPDstroke *gps_orig = nullptr;
450 void *_pad2 = nullptr;
451};
452
460
461 struct bGPDstroke *next = nullptr, *prev = nullptr;
462
464 bGPDspoint *points = nullptr;
468 int totpoints = 0;
471
473 short thickness = 0;
476 short _pad[2] = {};
477
479 double inittime = 0;
480
482 DNA_DEPRECATED char colorname[128] = "";
483
485 int mat_nr = 0;
488
490 float hardness = 0;
492 float aspect_ratio[2] = {};
493
496
498 float uv_rotation = 0;
500 float uv_translation[2] = {};
501 float uv_scale = 0;
502
505 char _pad4[4] = {};
506
508 struct MDeformVert *dvert = nullptr;
509 void *_pad3 = nullptr;
510
512 float vert_color_fill[4] = {};
513
515 struct bGPDcurve *editcurve = nullptr;
516
518 void *_pad5 = nullptr;
519};
520
521/* Arrows ----------------------- */
522
523/* ***************************************** */
524/* GP Frame */
525
526/* Runtime temp data for bGPDframe */
529 int frameid = 0;
531 int onion_id = 0;
532};
533
538struct bGPDframe {
540
541 struct bGPDframe *next = nullptr, *prev = nullptr;
542
544 ListBaseT<bGPDstroke> strokes = {nullptr, nullptr};
545
547 int framenum = 0;
548
552 short key_type = 0;
553
555};
556
557/* ***************************************** */
558/* GP Layer */
559
560/* List of masking layers. */
563
564 struct bGPDlayer_Mask *next = nullptr, *prev = nullptr;
565 char name[128] = "";
568 short sort_index = 0;
569 char _pad[4] = {};
570};
571
575
576
577 int icon_id = 0;
578 char _pad[4] = {};
579};
580
582struct bGPDlayer {
584
585 struct bGPDlayer *next = nullptr, *prev = nullptr;
586
588 ListBaseT<bGPDframe> frames = {nullptr, nullptr};
590 bGPDframe *actframe = nullptr;
591
596
599 float color[4] = {};
601 float fill[4] = {};
602
605 char info[128] = "";
606
608 short thickness = 0;
610 short pass_index = 0;
611
613 struct Object *parent = nullptr;
615 float inverse[4][4] = {};
617 char parsubstr[/*MAX_NAME*/ 64] = "";
618 short partype = 0;
619
621 short line_change = 0;
623 float tintcolor[4] = {};
625 float opacity = 0;
627 char viewlayername[64] = "";
628
633
634 /* annotation onion skin */
639 short gstep = 0;
644 short gstep_next = 0;
645
647 float gcolor_prev[3] = {0.302f, 0.851f, 0.302f};
649 float gcolor_next[3] = {0.250f, 0.1f, 1.0f};
650 char _pad1[4] = {};
651
653 ListBaseT<bGPDlayer_Mask> mask_layers = {nullptr, nullptr};
655 int act_mask = 0;
656 char _pad2[4] = {};
657
659 float location[3] = {}, rotation[3] = {}, scale[3] = {};
660 float layer_mat[4][4] = {}, layer_invmat[4][4] = {};
661 char _pad3[4] = {};
662
664};
665
666/* ***************************************** */
667/* GP Datablock */
668
669/* Runtime temp data for bGPdata */
672
673
674 tGPspoint *sbuffer = nullptr;
675
677 short playing = 0;
678
680 short matid = 0;
681
682 /* Stroke Buffer data (only used during paint-session)
683 * - buffer must be initialized before use, but freed after
684 * whole paint operation is over
685 */
688 char _pad1[2] = {};
693
695 float vert_color_fill[4] = {};
696
699
701 float arrow_start[8] = {};
702 float arrow_end[8] = {};
703 /* Arrow style for each corner */
706
707 char _pad[4] = {};
708};
709
710/* grid configuration */
711struct bGPgrid {
712 float color[3] = {};
713 float scale[2] = {};
714 float offset[2] = {};
715 char _pad1[4] = {};
716
717 int lines = 0;
718 char _pad[4] = {};
719};
720
722struct bGPdata {
723#ifdef __cplusplus
726 static constexpr ID_Type id_type = ID_GD_LEGACY;
727#endif
728
732 struct AnimData *adt = nullptr;
733
734 /* Grease-Pencil data */
736 ListBaseT<bGPDlayer> layers = {nullptr, nullptr};
745
746 /* Palettes */
748 ListBaseT<bGPDpalette> palettes = {nullptr, nullptr};
749
751 ListBaseT<bDeformGroup> vertex_group_names = {nullptr, nullptr};
752
753 /* 3D Viewport/Appearance Settings */
755 float pixfactor = 0;
757 float line_color[4] = {};
758
759 /* Onion skinning */
761 float onion_factor = 0;
770 short gstep = 0;
775 short gstep_next = 0;
776
778 float gcolor_prev[3] = {};
780 float gcolor_next[3] = {};
781
783 float zdepth_offset = 0;
785 struct Material **mat = nullptr;
787 short totcol = 0;
788
789 /* stats */
790 short totlayer = 0;
791 short totframe = 0;
792 char _pad2[6] = {};
793 int totstroke = 0;
794 int totpoint = 0;
795
799 short onion_keytype = 0;
800
803
805
807
809};
810
811} // namespace blender
#define ENUM_OPERATORS(_enum_type)
ID and Library types, which are fundamental for SDNA.
#define DNA_DEFINE_CXX_METHODS(class_name)
Definition DNA_defs.h:104
#define DNA_DEPRECATED
Definition DNA_defs.h:21
These structs are the foundation for all linked lists in the library system.
float3x3 scale(float3x3 mat, float2 scale)
BMesh Iterators.
ListBaseT< bGPDstroke > strokes
ListBaseT< bGPDframe > frames
eGPDlayer_OnionFlag onion_flag
ListBaseT< bGPDlayer_Mask > mask_layers
eGPLayerBlendModes blend_mode
ListBaseT< bGPDpalettecolor > colors
struct bGPDpalettecolor * next
struct bGPDpalettecolor * prev
DNA_DEPRECATED char colorname[128]
eGPDstroke_Arrowstyle arrow_end_style
eGPDstroke_Arrowstyle arrow_start_style
ListBaseT< bGPDpalette > palettes
ListBaseT< bGPDlayer > layers
ListBaseT< bDeformGroup > vertex_group_names