Blender V4.3
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
10#include "DNA_scene_types.h"
11
12#include "RNA_access.hh"
13#include "RNA_define.hh"
14#include "RNA_enum_types.hh"
15
16#include "rna_internal.hh"
17
18#include "WM_types.hh"
19
20#ifdef RNA_RUNTIME
21
22# include <fmt/format.h>
23
24# include "BLT_translation.hh"
25
26# include "BLI_string_utils.hh"
27
28# include "BKE_animsys.h"
29# include "BKE_gpencil_legacy.h"
30# include "BKE_icons.h"
31
32# include "DEG_depsgraph.hh"
33
34# include "WM_api.hh"
35
36static bGPdata *rna_annotations(const PointerRNA *ptr)
37{
38 return reinterpret_cast<bGPdata *>(ptr->owner_id);
39}
40
41static void rna_annotation_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
42{
45}
46
47/* Poll Callback to filter legacy GP Datablocks to only show those for Annotations */
49{
50 bGPdata *gpd = static_cast<bGPdata *>(value.data);
51 return (gpd->flag & GP_DATA_ANNOTATIONS) != 0;
52}
53
54static bGPDframe *rna_annotation_frame_new(bGPDlayer *layer,
55 ReportList *reports,
56 int frame_number,
57 bool active)
58{
59 bGPDframe *frame;
60
61 if (BKE_gpencil_layer_frame_find(layer, frame_number)) {
62 BKE_reportf(reports, RPT_ERROR, "Frame already exists on this frame number %d", frame_number);
63 return nullptr;
64 }
65
66 frame = BKE_gpencil_frame_addnew(layer, frame_number);
67 if (active) {
68 layer->actframe = BKE_gpencil_layer_frame_get(layer, frame_number, GP_GETFRAME_USE_PREV);
69 }
71
72 return frame;
73}
74
75static void rna_annotation_frame_remove(bGPDlayer *layer,
76 ReportList *reports,
77 PointerRNA *frame_ptr)
78{
79 bGPDframe *frame = static_cast<bGPDframe *>(frame_ptr->data);
80 if (BLI_findindex(&layer->frames, frame) == -1) {
81 BKE_report(reports, RPT_ERROR, "Frame not found in annotation layer");
82 return;
83 }
84
86 RNA_POINTER_INVALIDATE(frame_ptr);
87
89}
90
91static bGPDframe *rna_annotation_frame_copy(bGPDlayer *layer, bGPDframe *src)
92{
93 bGPDframe *frame = BKE_gpencil_frame_duplicate(src, true);
94
95 while (BKE_gpencil_layer_frame_find(layer, frame->framenum)) {
96 frame->framenum++;
97 }
98
99 BLI_addtail(&layer->frames, frame);
100
102
103 return frame;
104}
105
106static bGPDlayer *rna_annotation_layer_new(bGPdata *gpd, const char *name, bool setactive)
107{
108 bGPDlayer *gpl = BKE_gpencil_layer_addnew(gpd, name, setactive != 0, false);
109
111
112 return gpl;
113}
114
115static void rna_annotation_layer_remove(bGPdata *gpd, ReportList *reports, PointerRNA *layer_ptr)
116{
117 bGPDlayer *layer = static_cast<bGPDlayer *>(layer_ptr->data);
118 if (BLI_findindex(&gpd->layers, layer) == -1) {
119 BKE_report(reports, RPT_ERROR, "Layer not found in annotation data");
120 return;
121 }
122
123 BKE_gpencil_layer_delete(gpd, layer);
124 RNA_POINTER_INVALIDATE(layer_ptr);
125
127}
128
129static std::optional<std::string> rna_annotation_layer_path(const PointerRNA *ptr)
130{
131 bGPDlayer *gpl = static_cast<bGPDlayer *>(ptr->data);
132 char name_esc[sizeof(gpl->info) * 2];
133
134 BLI_str_escape(name_esc, gpl->info, sizeof(name_esc));
135
136 return fmt::format("layers[\"{}\"]", name_esc);
137}
138
139static int rna_annotation_layer_active_frame_editable(const PointerRNA *ptr,
140 const char ** /*r_info*/)
141{
142 bGPDlayer *gpl = static_cast<bGPDlayer *>(ptr->data);
143
144 /* surely there must be other criteria too... */
145 if (gpl->flag & GP_LAYER_LOCKED) {
146 return 0;
147 }
148 else {
149 return PROP_EDITABLE;
150 }
151}
152
153static void rna_annotation_layer_info_set(PointerRNA *ptr, const char *value)
154{
155 bGPdata *gpd = rna_annotations(ptr);
156 bGPDlayer *gpl = static_cast<bGPDlayer *>(ptr->data);
157
158 char oldname[128] = "";
159 STRNCPY(oldname, gpl->info);
160
161 /* copy the new name into the name slot */
162 STRNCPY_UTF8(gpl->info, value);
163
165 &gpd->layers, gpl, DATA_("GP_Layer"), '.', offsetof(bGPDlayer, info), sizeof(gpl->info));
166
167 /* now fix animation paths */
168 BKE_animdata_fix_paths_rename_all(&gpd->id, "layers", oldname, gpl->info);
169
170 /* Fix mask layers. */
171 LISTBASE_FOREACH (bGPDlayer *, gpl_, &gpd->layers) {
172 LISTBASE_FOREACH (bGPDlayer_Mask *, mask, &gpl_->mask_layers) {
173 if (STREQ(mask->name, oldname)) {
174 STRNCPY(mask->name, gpl->info);
175 }
176 }
177 }
178}
179
180static int rna_annotation_active_layer_index_get(PointerRNA *ptr)
181{
182 bGPdata *gpd = rna_annotations(ptr);
184
185 return BLI_findindex(&gpd->layers, gpl);
186}
187
188static void rna_annotation_active_layer_index_set(PointerRNA *ptr, int value)
189{
190 bGPdata *gpd = rna_annotations(ptr);
191 bGPDlayer *gpl = static_cast<bGPDlayer *>(BLI_findlink(&gpd->layers, value));
192
194
195 /* Now do standard updates... */
198}
199
200static void rna_annotation_active_layer_index_range(
201 PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
202{
203 bGPdata *gpd = rna_annotations(ptr);
204
205 *min = 0;
206 *max = max_ii(0, BLI_listbase_count(&gpd->layers) - 1);
207
208 *softmin = *min;
209 *softmax = *max;
210}
211
212static const EnumPropertyItem *rna_annotation_active_layer_itemf(bContext *C,
214 PropertyRNA * /*prop*/,
215 bool *r_free)
216{
217 bGPdata *gpd = rna_annotations(ptr);
218 bGPDlayer *gpl;
219 EnumPropertyItem *item = nullptr, item_tmp = {0};
220 int totitem = 0;
221 int i = 0;
222
223 if (ELEM(nullptr, C, gpd)) {
225 }
226
227 /* Existing layers */
228 for (gpl = static_cast<bGPDlayer *>(gpd->layers.first), i = 0; gpl; gpl = gpl->next, i++) {
229 item_tmp.identifier = gpl->info;
230 item_tmp.name = gpl->info;
231 item_tmp.value = i;
232
233 item_tmp.icon = (gpd->flag & GP_DATA_ANNOTATIONS) ? BKE_icon_gplayer_color_ensure(gpl) :
234 ICON_GREASEPENCIL;
235
236 RNA_enum_item_add(&item, &totitem, &item_tmp);
237 }
238
239 RNA_enum_item_end(&item, &totitem);
240 *r_free = true;
241
242 return item;
243}
244
245#else
246
248{
249 StructRNA *srna;
250 PropertyRNA *prop;
251
252 srna = RNA_def_struct(brna, "GPencilStrokePoint", nullptr);
253 RNA_def_struct_sdna(srna, "bGPDspoint");
254 RNA_def_struct_ui_text(srna, "Annotation Stroke Point", "Data point for freehand stroke curve");
255
256 prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_XYZ);
257 RNA_def_property_float_sdna(prop, nullptr, "x");
258 RNA_def_property_array(prop, 3);
259 RNA_def_property_ui_text(prop, "Coordinates", "");
260 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
261}
262
264{
265 StructRNA *srna;
266 PropertyRNA *prop;
267
268 srna = RNA_def_struct(brna, "GPencilStroke", nullptr);
269 RNA_def_struct_sdna(srna, "bGPDstroke");
270 RNA_def_struct_ui_text(srna, "Annotation Stroke", "Freehand curve defining part of a sketch");
271
272 /* Points */
273 prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
274 RNA_def_property_collection_sdna(prop, nullptr, "points", "totpoints");
275 RNA_def_property_struct_type(prop, "GPencilStrokePoint");
276 RNA_def_property_ui_text(prop, "Stroke Points", "Stroke data points");
277}
278
280{
281 StructRNA *srna;
282 PropertyRNA *prop;
283
284 srna = RNA_def_struct(brna, "GPencilFrame", nullptr);
285 RNA_def_struct_sdna(srna, "bGPDframe");
287 srna, "Annotation Frame", "Collection of related sketches on a particular frame");
288
289 /* Strokes */
290 prop = RNA_def_property(srna, "strokes", PROP_COLLECTION, PROP_NONE);
291 RNA_def_property_collection_sdna(prop, nullptr, "strokes", nullptr);
292 RNA_def_property_struct_type(prop, "GPencilStroke");
293 RNA_def_property_ui_text(prop, "Strokes", "Freehand curves defining the sketch on this frame");
294
295 /* Frame Number */
296 prop = RNA_def_property(srna, "frame_number", PROP_INT, PROP_NONE);
297 RNA_def_property_int_sdna(prop, nullptr, "framenum");
298 /* XXX NOTE: this cannot occur on the same frame as another sketch. */
300 RNA_def_property_ui_text(prop, "Frame Number", "The frame on which this sketch appears");
301 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
302
303 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
304 RNA_def_property_boolean_sdna(prop, nullptr, "flag", GP_FRAME_SELECT);
305 RNA_def_property_ui_text(prop, "Select", "Frame is selected for editing in the Dope Sheet");
306 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
307}
308
310{
311 StructRNA *srna;
312
313 FunctionRNA *func;
314 PropertyRNA *parm;
315
316 RNA_def_property_srna(cprop, "GPencilFrames");
317 srna = RNA_def_struct(brna, "GPencilFrames", nullptr);
318 RNA_def_struct_sdna(srna, "bGPDlayer");
319 RNA_def_struct_ui_text(srna, "Annotation Frames", "Collection of annotation frames");
320
321 func = RNA_def_function(srna, "new", "rna_annotation_frame_new");
322 RNA_def_function_ui_description(func, "Add a new annotation frame");
324 parm = RNA_def_int(func,
325 "frame_number",
326 1,
327 MINAFRAME,
328 MAXFRAME,
329 "Frame Number",
330 "The frame on which this sketch appears",
331 MINAFRAME,
332 MAXFRAME);
334 RNA_def_boolean(func, "active", false, "Active", "");
335 parm = RNA_def_pointer(func, "frame", "GPencilFrame", "", "The newly created frame");
336 RNA_def_function_return(func, parm);
337
338 func = RNA_def_function(srna, "remove", "rna_annotation_frame_remove");
339 RNA_def_function_ui_description(func, "Remove an annotation frame");
341 parm = RNA_def_pointer(func, "frame", "GPencilFrame", "Frame", "The frame to remove");
344
345 func = RNA_def_function(srna, "copy", "rna_annotation_frame_copy");
346 RNA_def_function_ui_description(func, "Copy an annotation frame");
347 parm = RNA_def_pointer(func, "source", "GPencilFrame", "Source", "The source frame");
349 parm = RNA_def_pointer(func, "copy", "GPencilFrame", "", "The newly copied frame");
350 RNA_def_function_return(func, parm);
351}
352
354{
355 StructRNA *srna;
356 PropertyRNA *prop;
357
358 static const float default_onion_color_b[] = {0.302f, 0.851f, 0.302f};
359 static const float default_onion_color_a[] = {0.250f, 0.1f, 1.0f};
360
361 srna = RNA_def_struct(brna, "GPencilLayer", nullptr);
362 RNA_def_struct_sdna(srna, "bGPDlayer");
363 RNA_def_struct_ui_text(srna, "Annotation Layer", "Collection of related sketches");
364 RNA_def_struct_path_func(srna, "rna_annotation_layer_path");
365
366 /* Name */
367 prop = RNA_def_property(srna, "info", PROP_STRING, PROP_NONE);
368 RNA_def_property_ui_text(prop, "Info", "Layer name");
369 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_annotation_layer_info_set");
371 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | NA_RENAME, "rna_annotation_update");
372
373 /* Frames */
374 prop = RNA_def_property(srna, "frames", PROP_COLLECTION, PROP_NONE);
375 RNA_def_property_collection_sdna(prop, nullptr, "frames", nullptr);
376 RNA_def_property_struct_type(prop, "GPencilFrame");
377 RNA_def_property_ui_text(prop, "Frames", "Sketches for this layer on different frames");
379
380 /* Active Frame */
381 prop = RNA_def_property(srna, "active_frame", PROP_POINTER, PROP_NONE);
382 RNA_def_property_pointer_sdna(prop, nullptr, "actframe");
383 RNA_def_property_ui_text(prop, "Active Frame", "Frame currently being displayed for this layer");
384 RNA_def_property_editable_func(prop, "rna_annotation_layer_active_frame_editable");
386
387 /* Layer Opacity (Annotations). */
388 prop = RNA_def_property(srna, "annotation_opacity", PROP_FLOAT, PROP_NONE);
389 RNA_def_property_float_sdna(prop, nullptr, "opacity");
390 RNA_def_property_range(prop, 0.0, 1.0f);
392 RNA_def_property_ui_text(prop, "Opacity", "Annotation Layer Opacity");
393 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
394
395 /* Stroke Drawing Color (Annotations) */
396 prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
397 RNA_def_property_array(prop, 3);
398 RNA_def_property_range(prop, 0.0f, 1.0f);
400 RNA_def_property_ui_text(prop, "Color", "Color for all strokes in this layer");
401 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
402
403 /* Line Thickness (Annotations) */
404 prop = RNA_def_property(srna, "thickness", PROP_INT, PROP_PIXEL);
405 RNA_def_property_int_sdna(prop, nullptr, "thickness");
406 RNA_def_property_range(prop, 1, 10);
408 RNA_def_property_ui_text(prop, "Thickness", "Thickness of annotation strokes");
409 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
410
411 /* Onion-Skinning */
412 prop = RNA_def_property(srna, "use_annotation_onion_skinning", PROP_BOOLEAN, PROP_NONE);
413 RNA_def_property_boolean_sdna(prop, nullptr, "onion_flag", GP_LAYER_ONIONSKIN);
416 prop, "Onion Skinning", "Display annotation onion skins before and after the current frame");
417 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
418
419 prop = RNA_def_property(srna, "annotation_onion_before_range", PROP_INT, PROP_NONE);
420 RNA_def_property_int_sdna(prop, nullptr, "gstep");
421 RNA_def_property_range(prop, -1, 120);
424 prop, "Frames Before", "Maximum number of frames to show before current frame");
425 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
426
427 prop = RNA_def_property(srna, "annotation_onion_after_range", PROP_INT, PROP_NONE);
428 RNA_def_property_int_sdna(prop, nullptr, "gstep_next");
429 RNA_def_property_range(prop, -1, 120);
432 prop, "Frames After", "Maximum number of frames to show after current frame");
433 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
434
435 prop = RNA_def_property(srna, "annotation_onion_before_color", PROP_FLOAT, PROP_COLOR_GAMMA);
436 RNA_def_property_float_sdna(prop, nullptr, "gcolor_prev");
437 RNA_def_property_array(prop, 3);
438 RNA_def_property_range(prop, 0.0f, 1.0f);
439 RNA_def_property_float_array_default(prop, default_onion_color_b);
441 RNA_def_property_ui_text(prop, "Before Color", "Base color for ghosts before the active frame");
442 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
443
444 prop = RNA_def_property(srna, "annotation_onion_after_color", PROP_FLOAT, PROP_COLOR_GAMMA);
445 RNA_def_property_float_sdna(prop, nullptr, "gcolor_next");
446 RNA_def_property_array(prop, 3);
447 RNA_def_property_range(prop, 0.0f, 1.0f);
448 RNA_def_property_float_array_default(prop, default_onion_color_a);
450 RNA_def_property_ui_text(prop, "After Color", "Base color for ghosts after the active frame");
451 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
452
453 prop = RNA_def_property(srna, "annotation_onion_use_custom_color", PROP_BOOLEAN, PROP_NONE);
457 "Custom Onion Skin Colors",
458 "Use custom colors for onion skinning instead of the theme");
459 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
460
461 prop = RNA_def_property(srna, "annotation_hide", PROP_BOOLEAN, PROP_NONE);
462 RNA_def_property_boolean_sdna(prop, nullptr, "flag", GP_LAYER_HIDE);
463 RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
465 RNA_def_property_ui_text(prop, "Hide", "Set annotation Visibility");
466 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
467
468 prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
469 RNA_def_property_boolean_sdna(prop, nullptr, "flag", GP_LAYER_LOCKED);
470 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
472 prop, "Locked", "Protect layer from further editing and/or frame changes");
473 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
474
475 prop = RNA_def_property(srna, "lock_frame", PROP_BOOLEAN, PROP_NONE);
477 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
479 RNA_def_property_ui_text(prop, "Frame Locked", "Lock current frame displayed by layer");
480 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
481
482 prop = RNA_def_property(srna, "is_ruler", PROP_BOOLEAN, PROP_NONE);
483 RNA_def_property_boolean_sdna(prop, nullptr, "flag", GP_LAYER_IS_RULER);
484 RNA_def_property_ui_text(prop, "Ruler", "This is a special ruler layer");
486
487 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
488 RNA_def_property_boolean_sdna(prop, nullptr, "flag", GP_LAYER_SELECT);
489 RNA_def_property_ui_text(prop, "Select", "Layer is selected for editing in the Dope Sheet");
490 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | NA_SELECTED, "rna_annotation_update");
491
492 /* In Front */
493 prop = RNA_def_property(srna, "show_in_front", PROP_BOOLEAN, PROP_NONE);
495 RNA_def_property_ui_text(prop, "In Front", "Make the layer display in front of objects");
496 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
497}
498
500{
501 StructRNA *srna;
502 PropertyRNA *prop;
503 FunctionRNA *func;
504 PropertyRNA *parm;
505
506 RNA_def_property_srna(cprop, "GreasePencilLayers");
507 srna = RNA_def_struct(brna, "GreasePencilLayers", nullptr);
508 RNA_def_struct_sdna(srna, "bGPdata");
509 RNA_def_struct_ui_text(srna, "Annotation Layers", "Collection of annotation layers");
510
511 func = RNA_def_function(srna, "new", "rna_annotation_layer_new");
512 RNA_def_function_ui_description(func, "Add a new annotation layer");
513 parm = RNA_def_string(func, "name", "Layer", MAX_NAME, "Name", "Name of the layer");
516 func, "set_active", true, "Set Active", "Set the newly created layer to the active layer");
517 parm = RNA_def_pointer(func, "layer", "GPencilLayer", "", "The newly created layer");
518 RNA_def_function_return(func, parm);
519
520 func = RNA_def_function(srna, "remove", "rna_annotation_layer_remove");
521 RNA_def_function_ui_description(func, "Remove a annotation layer");
523 parm = RNA_def_pointer(func, "layer", "GPencilLayer", "", "The layer to remove");
526
527 prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
529 "rna_annotation_active_layer_index_get",
530 "rna_annotation_active_layer_index_set",
531 "rna_annotation_active_layer_index_range");
532 RNA_def_property_ui_text(prop, "Active Layer Index", "Index of active annotation layer");
534
535 /* Active Layer - As an enum (for selecting active layer for annotations) */
536 prop = RNA_def_property(srna, "active_note", PROP_ENUM, PROP_NONE);
538 "rna_annotation_active_layer_index_get",
539 "rna_annotation_active_layer_index_set",
540 "rna_annotation_active_layer_itemf");
542 prop, rna_enum_dummy_DEFAULT_items); /* purely dynamic, as it maps to user-data */
543 RNA_def_property_ui_text(prop, "Active Note", "Note/Layer to add annotation strokes to");
544 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_annotation_update");
545}
546
548{
549 StructRNA *srna;
550 PropertyRNA *prop;
551
552 /* NOTE: This used to be the legacy Grease Pencil ID type, hence the name. */
553 srna = RNA_def_struct(brna, "GreasePencil", "ID");
554 RNA_def_struct_sdna(srna, "bGPdata");
555 RNA_def_struct_ui_text(srna, "Annotation", "Freehand annotation sketchbook");
556 RNA_def_struct_ui_icon(srna, ICON_OUTLINER_DATA_GREASEPENCIL);
557
558 /* Layers */
559 prop = RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
560 RNA_def_property_collection_sdna(prop, nullptr, "layers", nullptr);
561 RNA_def_property_struct_type(prop, "GPencilLayer");
562 RNA_def_property_ui_text(prop, "Layers", "");
563
565
566 /* Animation Data */
568}
569
578
579#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:313
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:125
#define LISTBASE_FOREACH(type, var, list)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:110
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE int max_ii(int a, int b)
#define STRNCPY(dst, src)
Definition BLI_string.h:593
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:1041
#define MAX_NAME
Definition DNA_defs.h:50
@ GP_LAYER_ONIONSKIN_CUSTOM_COLOR
#define MINAFRAME
#define MAXFRAME
#define RNA_POINTER_INVALIDATE(ptr)
ParameterFlag
Definition RNA_types.hh:396
@ PARM_RNAPTR
Definition RNA_types.hh:399
@ PARM_REQUIRED
Definition RNA_types.hh:397
@ FUNC_USE_REPORTS
Definition RNA_types.hh:680
@ PROP_FLOAT
Definition RNA_types.hh:67
@ PROP_BOOLEAN
Definition RNA_types.hh:65
@ PROP_ENUM
Definition RNA_types.hh:69
@ PROP_INT
Definition RNA_types.hh:66
@ PROP_STRING
Definition RNA_types.hh:68
@ PROP_POINTER
Definition RNA_types.hh:70
@ PROP_COLLECTION
Definition RNA_types.hh:71
PropertyFlag
Definition RNA_types.hh:201
@ PROP_THICK_WRAP
Definition RNA_types.hh:312
@ PROP_ANIMATABLE
Definition RNA_types.hh:220
@ PROP_EDITABLE
Definition RNA_types.hh:207
@ PROP_NEVER_NULL
Definition RNA_types.hh:266
@ PROP_XYZ
Definition RNA_types.hh:172
@ PROP_PIXEL
Definition RNA_types.hh:151
@ PROP_NONE
Definition RNA_types.hh:136
@ PROP_COLOR_GAMMA
Definition RNA_types.hh:175
@ PROP_UNSIGNED
Definition RNA_types.hh:152
#define ND_DATA
Definition WM_types.hh:475
#define ND_SPACE_PROPERTIES
Definition WM_types.hh:495
#define NA_EDITED
Definition WM_types.hh:550
#define NC_GPENCIL
Definition WM_types.hh:366
#define NA_RENAME
Definition WM_types.hh:554
#define NA_SELECTED
Definition WM_types.hh:555
#define offsetof(t, d)
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_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_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
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:29
const EnumPropertyItem rna_enum_dummy_DEFAULT_items[]
Definition rna_rna.cc:35
#define min(a, b)
Definition sort.c:32
const char * identifier
Definition RNA_types.hh:506
void * first
ID * owner_id
Definition RNA_types.hh:40
void * data
Definition RNA_types.hh:42
struct bGPDlayer * next
float max
void WM_main_add_notifier(uint type, void *reference)
PointerRNA * ptr
Definition wm_files.cc:4126