Blender V5.0
rna_annotations.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2024 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
10#include "DNA_scene_types.h"
11
12#include "RNA_define.hh"
13#include "RNA_enum_types.hh"
14
15#include "rna_internal.hh"
16
17#include "WM_types.hh"
18
19#ifdef RNA_RUNTIME
20
21# include <fmt/format.h>
22
23# include "BLT_translation.hh"
24
25# include "BLI_math_base.h"
26# include "BLI_string.h"
27# include "BLI_string_utf8.h"
28# include "BLI_string_utils.hh"
29
30# include "BKE_animsys.h"
31# include "BKE_gpencil_legacy.h"
32# include "BKE_icons.h"
33# include "BKE_report.hh"
34
35# include "DEG_depsgraph.hh"
36
37# include "WM_api.hh"
38
39static bGPdata *rna_annotations(const PointerRNA *ptr)
40{
41 return reinterpret_cast<bGPdata *>(ptr->owner_id);
42}
43
44static void rna_annotation_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
45{
48}
49
50/* Poll Callback to filter legacy GP Datablocks to only show those for Annotations */
52{
53 bGPdata *gpd = static_cast<bGPdata *>(value.data);
54 return (gpd->flag & GP_DATA_ANNOTATIONS) != 0;
55}
56
57static bGPDframe *rna_annotation_frame_new(bGPDlayer *layer,
58 ReportList *reports,
59 int frame_number,
60 bool active)
61{
62 bGPDframe *frame;
63
64 if (BKE_gpencil_layer_frame_find(layer, frame_number)) {
65 BKE_reportf(reports, RPT_ERROR, "Frame already exists on this frame number %d", frame_number);
66 return nullptr;
67 }
68
69 frame = BKE_gpencil_frame_addnew(layer, frame_number);
70 if (active) {
71 layer->actframe = BKE_gpencil_layer_frame_get(layer, frame_number, GP_GETFRAME_USE_PREV);
72 }
74
75 return frame;
76}
77
78static void rna_annotation_frame_remove(bGPDlayer *layer,
79 ReportList *reports,
80 PointerRNA *frame_ptr)
81{
82 bGPDframe *frame = static_cast<bGPDframe *>(frame_ptr->data);
83 if (BLI_findindex(&layer->frames, frame) == -1) {
84 BKE_report(reports, RPT_ERROR, "Frame not found in annotation layer");
85 return;
86 }
87
89 frame_ptr->invalidate();
90
92}
93
94static bGPDframe *rna_annotation_frame_copy(bGPDlayer *layer, bGPDframe *src)
95{
96 bGPDframe *frame = BKE_gpencil_frame_duplicate(src, true);
97
98 while (BKE_gpencil_layer_frame_find(layer, frame->framenum)) {
99 frame->framenum++;
100 }
101
102 BLI_addtail(&layer->frames, frame);
103
105
106 return frame;
107}
108
109static bGPDlayer *rna_annotation_layer_new(bGPdata *gpd, const char *name, bool setactive)
110{
111 bGPDlayer *gpl = BKE_gpencil_layer_addnew(gpd, name, setactive != 0, false);
112
114
115 return gpl;
116}
117
118static void rna_annotation_layer_remove(bGPdata *gpd, ReportList *reports, PointerRNA *layer_ptr)
119{
120 bGPDlayer *layer = static_cast<bGPDlayer *>(layer_ptr->data);
121 if (BLI_findindex(&gpd->layers, layer) == -1) {
122 BKE_report(reports, RPT_ERROR, "Layer not found in annotation data");
123 return;
124 }
125
126 BKE_gpencil_layer_delete(gpd, layer);
127 layer_ptr->invalidate();
128
130}
131
132static std::optional<std::string> rna_annotation_layer_path(const PointerRNA *ptr)
133{
134 bGPDlayer *gpl = static_cast<bGPDlayer *>(ptr->data);
135 char name_esc[sizeof(gpl->info) * 2];
136
137 BLI_str_escape(name_esc, gpl->info, sizeof(name_esc));
138
139 return fmt::format("layers[\"{}\"]", name_esc);
140}
141
142static int rna_annotation_layer_active_frame_editable(const PointerRNA *ptr,
143 const char ** /*r_info*/)
144{
145 bGPDlayer *gpl = static_cast<bGPDlayer *>(ptr->data);
146
147 /* surely there must be other criteria too... */
148 if (gpl->flag & GP_LAYER_LOCKED) {
149 return 0;
150 }
151 return PROP_EDITABLE;
152}
153
154static void rna_annotation_layer_info_set(PointerRNA *ptr, const char *value)
155{
156 bGPdata *gpd = rna_annotations(ptr);
157 bGPDlayer *gpl = static_cast<bGPDlayer *>(ptr->data);
158
159 char oldname[sizeof(gpl->info)] = "";
160 STRNCPY_UTF8(oldname, gpl->info);
161
162 /* copy the new name into the name slot */
163 STRNCPY_UTF8(gpl->info, value);
164
166 &gpd->layers, gpl, DATA_("GP_Layer"), '.', offsetof(bGPDlayer, info), sizeof(gpl->info));
167
168 /* now fix animation paths */
169 BKE_animdata_fix_paths_rename_all(&gpd->id, "layers", oldname, gpl->info);
170
171 /* Fix mask layers. */
172 LISTBASE_FOREACH (bGPDlayer *, gpl_, &gpd->layers) {
173 LISTBASE_FOREACH (bGPDlayer_Mask *, mask, &gpl_->mask_layers) {
174 if (STREQ(mask->name, oldname)) {
175 STRNCPY(mask->name, gpl->info);
176 }
177 }
178 }
179}
180
181static int rna_annotation_active_layer_index_get(PointerRNA *ptr)
182{
183 bGPdata *gpd = rna_annotations(ptr);
185
186 return BLI_findindex(&gpd->layers, gpl);
187}
188
189static void rna_annotation_active_layer_index_set(PointerRNA *ptr, int value)
190{
191 bGPdata *gpd = rna_annotations(ptr);
192 bGPDlayer *gpl = static_cast<bGPDlayer *>(BLI_findlink(&gpd->layers, value));
193
195
196 /* Now do standard updates... */
199}
200
201static void rna_annotation_active_layer_index_range(
202 PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
203{
204 bGPdata *gpd = rna_annotations(ptr);
205
206 *min = 0;
207 *max = max_ii(0, BLI_listbase_count(&gpd->layers) - 1);
208
209 *softmin = *min;
210 *softmax = *max;
211}
212
213static const EnumPropertyItem *rna_annotation_active_layer_itemf(bContext *C,
215 PropertyRNA * /*prop*/,
216 bool *r_free)
217{
218 bGPdata *gpd = rna_annotations(ptr);
219 bGPDlayer *gpl;
220 EnumPropertyItem *item = nullptr, item_tmp = {0};
221 int totitem = 0;
222 int i = 0;
223
224 if (ELEM(nullptr, C, gpd)) {
226 }
227
228 /* Existing layers */
229 for (gpl = static_cast<bGPDlayer *>(gpd->layers.first), i = 0; gpl; gpl = gpl->next, i++) {
230 item_tmp.identifier = gpl->info;
231 item_tmp.name = gpl->info;
232 item_tmp.value = i;
233
234 item_tmp.icon = (gpd->flag & GP_DATA_ANNOTATIONS) ? BKE_icon_gplayer_color_ensure(gpl) :
235 ICON_GREASEPENCIL;
236
237 RNA_enum_item_add(&item, &totitem, &item_tmp);
238 }
239
240 RNA_enum_item_end(&item, &totitem);
241 *r_free = true;
242
243 return item;
244}
245
246#else
247
249{
250 StructRNA *srna;
251 PropertyRNA *prop;
252
253 srna = RNA_def_struct(brna, "AnnotationStrokePoint", nullptr);
254 RNA_def_struct_sdna(srna, "bGPDspoint");
255 RNA_def_struct_ui_text(srna, "Annotation Stroke Point", "Data point for freehand stroke curve");
256
257 prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_XYZ);
258 RNA_def_property_float_sdna(prop, nullptr, "x");
259 RNA_def_property_array(prop, 3);
260 RNA_def_property_ui_text(prop, "Coordinates", "");
261 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
262}
263
265{
266 StructRNA *srna;
267 PropertyRNA *prop;
268
269 srna = RNA_def_struct(brna, "AnnotationStroke", nullptr);
270 RNA_def_struct_sdna(srna, "bGPDstroke");
271 RNA_def_struct_ui_text(srna, "Annotation Stroke", "Freehand curve defining part of a sketch");
272
273 /* Points */
274 prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
275 RNA_def_property_collection_sdna(prop, nullptr, "points", "totpoints");
276 RNA_def_property_struct_type(prop, "AnnotationStrokePoint");
277 RNA_def_property_ui_text(prop, "Stroke Points", "Stroke data points");
278}
279
281{
282 StructRNA *srna;
283 PropertyRNA *prop;
284
285 srna = RNA_def_struct(brna, "AnnotationFrame", nullptr);
286 RNA_def_struct_sdna(srna, "bGPDframe");
288 srna, "Annotation Frame", "Collection of related sketches on a particular frame");
289
290 /* Strokes */
291 prop = RNA_def_property(srna, "strokes", PROP_COLLECTION, PROP_NONE);
292 RNA_def_property_collection_sdna(prop, nullptr, "strokes", nullptr);
293 RNA_def_property_struct_type(prop, "AnnotationStroke");
294 RNA_def_property_ui_text(prop, "Strokes", "Freehand curves defining the sketch on this frame");
295
296 /* Frame Number */
297 prop = RNA_def_property(srna, "frame_number", PROP_INT, PROP_NONE);
298 RNA_def_property_int_sdna(prop, nullptr, "framenum");
299 /* XXX NOTE: this cannot occur on the same frame as another sketch. */
301 RNA_def_property_ui_text(prop, "Frame Number", "The frame on which this sketch appears");
302 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
303
304 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
305 RNA_def_property_boolean_sdna(prop, nullptr, "flag", GP_FRAME_SELECT);
306 RNA_def_property_ui_text(prop, "Select", "Frame is selected for editing in the Dope Sheet");
307 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
308}
309
311{
312 StructRNA *srna;
313
314 FunctionRNA *func;
315 PropertyRNA *parm;
316
317 RNA_def_property_srna(cprop, "AnnotationFrames");
318 srna = RNA_def_struct(brna, "AnnotationFrames", nullptr);
319 RNA_def_struct_sdna(srna, "bGPDlayer");
320 RNA_def_struct_ui_text(srna, "Annotation Frames", "Collection of annotation frames");
321
322 func = RNA_def_function(srna, "new", "rna_annotation_frame_new");
323 RNA_def_function_ui_description(func, "Add a new annotation frame");
325 parm = RNA_def_int(func,
326 "frame_number",
327 1,
328 MINAFRAME,
329 MAXFRAME,
330 "Frame Number",
331 "The frame on which this sketch appears",
332 MINAFRAME,
333 MAXFRAME);
335 RNA_def_boolean(func, "active", false, "Active", "");
336 parm = RNA_def_pointer(func, "frame", "AnnotationFrame", "", "The newly created frame");
337 RNA_def_function_return(func, parm);
338
339 func = RNA_def_function(srna, "remove", "rna_annotation_frame_remove");
340 RNA_def_function_ui_description(func, "Remove an annotation frame");
342 parm = RNA_def_pointer(func, "frame", "AnnotationFrame", "Frame", "The frame to remove");
345
346 func = RNA_def_function(srna, "copy", "rna_annotation_frame_copy");
347 RNA_def_function_ui_description(func, "Copy an annotation frame");
348 parm = RNA_def_pointer(func, "source", "AnnotationFrame", "Source", "The source frame");
350 parm = RNA_def_pointer(func, "copy", "AnnotationFrame", "", "The newly copied frame");
351 RNA_def_function_return(func, parm);
352}
353
355{
356 StructRNA *srna;
357 PropertyRNA *prop;
358
359 static const float default_onion_color_b[] = {0.302f, 0.851f, 0.302f};
360 static const float default_onion_color_a[] = {0.250f, 0.1f, 1.0f};
361
362 srna = RNA_def_struct(brna, "AnnotationLayer", nullptr);
363 RNA_def_struct_sdna(srna, "bGPDlayer");
364 RNA_def_struct_ui_text(srna, "Annotation Layer", "Collection of related sketches");
365 RNA_def_struct_path_func(srna, "rna_annotation_layer_path");
366
367 /* Name */
368 prop = RNA_def_property(srna, "info", PROP_STRING, PROP_NONE);
369 RNA_def_property_ui_text(prop, "Info", "Layer name");
370 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_annotation_layer_info_set");
372 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | NA_RENAME, "rna_annotation_update");
373
374 /* Frames */
375 prop = RNA_def_property(srna, "frames", PROP_COLLECTION, PROP_NONE);
376 RNA_def_property_collection_sdna(prop, nullptr, "frames", nullptr);
377 RNA_def_property_struct_type(prop, "AnnotationFrame");
378 RNA_def_property_ui_text(prop, "Frames", "Sketches for this layer on different frames");
380
381 /* Active Frame */
382 prop = RNA_def_property(srna, "active_frame", PROP_POINTER, PROP_NONE);
383 RNA_def_property_pointer_sdna(prop, nullptr, "actframe");
384 RNA_def_property_ui_text(prop, "Active Frame", "Frame currently being displayed for this layer");
385 RNA_def_property_editable_func(prop, "rna_annotation_layer_active_frame_editable");
387
388 /* Layer Opacity (Annotations). */
389 prop = RNA_def_property(srna, "annotation_opacity", PROP_FLOAT, PROP_NONE);
390 RNA_def_property_float_sdna(prop, nullptr, "opacity");
391 RNA_def_property_range(prop, 0.0, 1.0f);
393 RNA_def_property_ui_text(prop, "Opacity", "Annotation Layer Opacity");
394 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
395
396 /* Stroke Drawing Color (Annotations) */
397 prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
398 RNA_def_property_array(prop, 3);
399 RNA_def_property_range(prop, 0.0f, 1.0f);
401 RNA_def_property_ui_text(prop, "Color", "Color for all strokes in this layer");
402 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
403
404 /* Line Thickness (Annotations) */
405 prop = RNA_def_property(srna, "thickness", PROP_INT, PROP_PIXEL);
406 RNA_def_property_int_sdna(prop, nullptr, "thickness");
407 RNA_def_property_range(prop, 1, 10);
409 RNA_def_property_ui_text(prop, "Thickness", "Thickness of annotation strokes");
410 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
411
412 /* Onion-Skinning */
413 prop = RNA_def_property(srna, "use_annotation_onion_skinning", PROP_BOOLEAN, PROP_NONE);
414 RNA_def_property_boolean_sdna(prop, nullptr, "onion_flag", GP_LAYER_ONIONSKIN);
417 prop, "Onion Skinning", "Display annotation onion skins before and after the current frame");
418 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
419
420 prop = RNA_def_property(srna, "annotation_onion_before_range", PROP_INT, PROP_NONE);
421 RNA_def_property_int_sdna(prop, nullptr, "gstep");
422 RNA_def_property_range(prop, -1, 120);
425 prop, "Frames Before", "Maximum number of frames to show before current frame");
426 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
427
428 prop = RNA_def_property(srna, "annotation_onion_after_range", PROP_INT, PROP_NONE);
429 RNA_def_property_int_sdna(prop, nullptr, "gstep_next");
430 RNA_def_property_range(prop, -1, 120);
433 prop, "Frames After", "Maximum number of frames to show after current frame");
434 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
435
436 prop = RNA_def_property(srna, "annotation_onion_before_color", PROP_FLOAT, PROP_COLOR_GAMMA);
437 RNA_def_property_float_sdna(prop, nullptr, "gcolor_prev");
438 RNA_def_property_array(prop, 3);
439 RNA_def_property_range(prop, 0.0f, 1.0f);
440 RNA_def_property_float_array_default(prop, default_onion_color_b);
442 RNA_def_property_ui_text(prop, "Before Color", "Base color for ghosts before the active frame");
443 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
444
445 prop = RNA_def_property(srna, "annotation_onion_after_color", PROP_FLOAT, PROP_COLOR_GAMMA);
446 RNA_def_property_float_sdna(prop, nullptr, "gcolor_next");
447 RNA_def_property_array(prop, 3);
448 RNA_def_property_range(prop, 0.0f, 1.0f);
449 RNA_def_property_float_array_default(prop, default_onion_color_a);
451 RNA_def_property_ui_text(prop, "After Color", "Base color for ghosts after the active frame");
452 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
453
454 prop = RNA_def_property(srna, "annotation_onion_use_custom_color", PROP_BOOLEAN, PROP_NONE);
458 "Custom Onion Skin Colors",
459 "Use custom colors for onion skinning instead of the theme");
460 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
461
462 prop = RNA_def_property(srna, "annotation_hide", PROP_BOOLEAN, PROP_NONE);
463 RNA_def_property_boolean_sdna(prop, nullptr, "flag", GP_LAYER_HIDE);
464 RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
466 RNA_def_property_ui_text(prop, "Hide", "Set annotation Visibility");
467 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
468
469 prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
470 RNA_def_property_boolean_sdna(prop, nullptr, "flag", GP_LAYER_LOCKED);
471 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
473 prop, "Locked", "Protect layer from further editing and/or frame changes");
474 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
475
476 prop = RNA_def_property(srna, "lock_frame", PROP_BOOLEAN, PROP_NONE);
478 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
480 RNA_def_property_ui_text(prop, "Frame Locked", "Lock current frame displayed by layer");
481 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
482
483 prop = RNA_def_property(srna, "is_ruler", PROP_BOOLEAN, PROP_NONE);
484 RNA_def_property_boolean_sdna(prop, nullptr, "flag", GP_LAYER_IS_RULER);
485 RNA_def_property_ui_text(prop, "Ruler", "This is a special ruler layer");
487
488 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
489 RNA_def_property_boolean_sdna(prop, nullptr, "flag", GP_LAYER_SELECT);
490 RNA_def_property_ui_text(prop, "Select", "Layer is selected for editing in the Dope Sheet");
491 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | NA_SELECTED, "rna_annotation_update");
492
493 /* In Front */
494 prop = RNA_def_property(srna, "show_in_front", PROP_BOOLEAN, PROP_NONE);
496 RNA_def_property_ui_text(prop, "In Front", "Make the layer display in front of objects");
497 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
498}
499
501{
502 StructRNA *srna;
503 PropertyRNA *prop;
504 FunctionRNA *func;
505 PropertyRNA *parm;
506
507 RNA_def_property_srna(cprop, "AnnotationLayers");
508 srna = RNA_def_struct(brna, "AnnotationLayers", nullptr);
509 RNA_def_struct_sdna(srna, "bGPdata");
510 RNA_def_struct_ui_text(srna, "Annotation Layers", "Collection of annotation layers");
511
512 func = RNA_def_function(srna, "new", "rna_annotation_layer_new");
513 RNA_def_function_ui_description(func, "Add a new annotation layer");
514 parm = RNA_def_string(func, "name", "Layer", MAX_NAME, "Name", "Name of the layer");
517 func, "set_active", true, "Set Active", "Set the newly created layer to the active layer");
518 parm = RNA_def_pointer(func, "layer", "AnnotationLayer", "", "The newly created layer");
519 RNA_def_function_return(func, parm);
520
521 func = RNA_def_function(srna, "remove", "rna_annotation_layer_remove");
522 RNA_def_function_ui_description(func, "Remove a annotation layer");
524 parm = RNA_def_pointer(func, "layer", "AnnotationLayer", "", "The layer to remove");
527
528 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
530 "rna_annotation_active_layer_index_get",
531 "rna_annotation_active_layer_index_set",
532 "rna_annotation_active_layer_index_range");
533 RNA_def_property_ui_text(prop, "Active Layer Index", "Index of active annotation layer");
535
536 /* Active Layer - As an enum (for selecting active layer for annotations) */
537 prop = RNA_def_property(srna, "active_note", PROP_ENUM, PROP_NONE);
539 "rna_annotation_active_layer_index_get",
540 "rna_annotation_active_layer_index_set",
541 "rna_annotation_active_layer_itemf");
543 prop, rna_enum_dummy_DEFAULT_items); /* purely dynamic, as it maps to user-data */
544 RNA_def_property_ui_text(prop, "Active Note", "Note/Layer to add annotation strokes to");
545 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
546}
547
549{
550 StructRNA *srna;
551 PropertyRNA *prop;
552
553 /* NOTE: This used to be the legacy Grease Pencil ID type. */
554 srna = RNA_def_struct(brna, "Annotation", "ID");
555 RNA_def_struct_sdna(srna, "bGPdata");
556 RNA_def_struct_ui_text(srna, "Annotation", "Freehand annotation sketchbook");
557 RNA_def_struct_ui_icon(srna, ICON_OUTLINER_DATA_GREASEPENCIL);
558
559 /* Layers */
560 prop = RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
561 RNA_def_property_collection_sdna(prop, nullptr, "layers", nullptr);
562 RNA_def_property_struct_type(prop, "AnnotationLayer");
563 RNA_def_property_ui_text(prop, "Layers", "");
564
566
567 /* Animation Data */
569}
570
579
580#endif
void BKE_animdata_fix_paths_rename_all(struct ID *ref_id, const char *prefix, const char *oldName, const char *newName)
void BKE_gpencil_layer_active_set(struct bGPdata *gpd, struct bGPDlayer *active)
struct bGPDlayer * BKE_gpencil_layer_addnew(struct bGPdata *gpd, const char *name, bool setactive, bool add_to_header)
bool BKE_gpencil_layer_frame_delete(struct bGPDlayer *gpl, struct bGPDframe *gpf)
struct bGPDframe * BKE_gpencil_layer_frame_get(struct bGPDlayer *gpl, int cframe, eGP_GetFrame_Mode addnew)
struct bGPDlayer * BKE_gpencil_layer_active_get(struct bGPdata *gpd)
struct bGPDframe * BKE_gpencil_frame_addnew(struct bGPDlayer *gpl, int cframe)
void BKE_gpencil_layer_delete(struct bGPdata *gpd, struct bGPDlayer *gpl)
struct bGPDframe * BKE_gpencil_frame_duplicate(const struct bGPDframe *gpf_src, bool dup_strokes)
@ GP_GETFRAME_USE_PREV
struct bGPDframe * BKE_gpencil_layer_frame_find(struct bGPDlayer *gpl, int cframe)
int BKE_icon_gplayer_color_ensure(struct bGPDlayer *gpl)
Definition icons.cc:312
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
@ RPT_ERROR
Definition BKE_report.hh:39
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:153
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:586
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:534
#define LISTBASE_FOREACH(type, var, list)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:111
int BLI_listbase_count(const ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:524
MINLINE int max_ii(int a, int b)
char * STRNCPY(char(&dst)[N], const char *src)
Definition BLI_string.h:693
size_t BLI_str_escape(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define STRNCPY_UTF8(dst, src)
void BLI_uniquename(const struct ListBase *list, void *vlink, const char *defname, char delim, int name_offset, size_t name_maxncpy) ATTR_NONNULL(1
#define ELEM(...)
#define STREQ(a, b)
#define DATA_(msgid)
void DEG_id_tag_update(ID *id, unsigned int flags)
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1074
#define MAX_NAME
Definition DNA_defs.h:50
@ GP_LAYER_ONIONSKIN_CUSTOM_COLOR
#define MINAFRAME
#define MAXFRAME
ParameterFlag
Definition RNA_types.hh:544
@ PARM_RNAPTR
Definition RNA_types.hh:547
@ PARM_REQUIRED
Definition RNA_types.hh:545
@ FUNC_USE_REPORTS
Definition RNA_types.hh:914
@ PROP_FLOAT
Definition RNA_types.hh:164
@ PROP_BOOLEAN
Definition RNA_types.hh:162
@ PROP_ENUM
Definition RNA_types.hh:166
@ PROP_INT
Definition RNA_types.hh:163
@ PROP_STRING
Definition RNA_types.hh:165
@ PROP_POINTER
Definition RNA_types.hh:167
@ PROP_COLLECTION
Definition RNA_types.hh:168
PropertyFlag
Definition RNA_types.hh:300
@ PROP_THICK_WRAP
Definition RNA_types.hh:423
@ PROP_ANIMATABLE
Definition RNA_types.hh:319
@ PROP_EDITABLE
Definition RNA_types.hh:306
@ PROP_NEVER_NULL
Definition RNA_types.hh:377
@ PROP_XYZ
Definition RNA_types.hh:269
@ PROP_PIXEL
Definition RNA_types.hh:248
@ PROP_NONE
Definition RNA_types.hh:233
@ PROP_COLOR_GAMMA
Definition RNA_types.hh:272
@ PROP_UNSIGNED
Definition RNA_types.hh:249
#define C
Definition RandGen.cpp:29
#define ND_DATA
Definition WM_types.hh:509
#define ND_SPACE_PROPERTIES
Definition WM_types.hh:529
#define NA_EDITED
Definition WM_types.hh:584
#define NC_GPENCIL
Definition WM_types.hh:399
#define NA_RENAME
Definition WM_types.hh:588
#define NA_SELECTED
Definition WM_types.hh:589
#define offsetof(t, d)
#define active
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
const char * name
void rna_def_animdata_common(StructRNA *srna)
void RNA_def_annotations(BlenderRNA *brna)
static void rna_def_annotation_data(BlenderRNA *brna)
static void rna_def_annotation_frames_api(BlenderRNA *brna, PropertyRNA *cprop)
static void rna_def_annotation_layer(BlenderRNA *brna)
static void rna_def_annotation_stroke(BlenderRNA *brna)
static void rna_def_annotation_frame(BlenderRNA *brna)
static void rna_def_annotation_stroke_point(BlenderRNA *brna)
static void rna_def_annotation_layers_api(BlenderRNA *brna, PropertyRNA *cprop)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
void RNA_def_property_array(PropertyRNA *prop, int length)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
void RNA_def_function_flag(FunctionRNA *func, int flag)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_float_array_default(PropertyRNA *prop, const float *array)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
bool rna_GPencil_datablocks_annotations_poll(PointerRNA *ptr, const PointerRNA value)
const EnumPropertyItem rna_enum_dummy_NULL_items[]
Definition rna_rna.cc:26
const EnumPropertyItem rna_enum_dummy_DEFAULT_items[]
Definition rna_rna.cc:32
#define min(a, b)
Definition sort.cc:36
void * first
void invalidate()
Definition RNA_types.hh:110
void * data
Definition RNA_types.hh:53
struct bGPDlayer * next
i
Definition text_draw.cc:230
max
Definition text_draw.cc:251
void WM_main_add_notifier(uint type, void *reference)
PointerRNA * ptr
Definition wm_files.cc:4238