Blender V5.3
rna_grease_pencil.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
9#include "BKE_attribute.h"
10
11#include "BLT_translation.hh"
12
14#include "DNA_scene_types.h"
15
16#include "RNA_access.hh"
17#include "RNA_define.hh"
18#include "RNA_enum_types.hh"
19
20#include "RNA_types.hh"
21#include "rna_internal.hh"
22
23#include "WM_api.hh"
24
25namespace blender {
26
28 {0,
29 "2D",
30 0,
31 "2D Layers",
32 "Display strokes using Grease Pencil layer order and stroke order to define depth"},
34 "3D",
35 0,
36 "3D Location",
37 "Display strokes using real 3D position in 3D space"},
38 {0, nullptr, 0, nullptr, nullptr},
39};
40
41}
42
43#ifdef RNA_RUNTIME
44
45# include <fmt/format.h>
46
47# include "BKE_attribute.hh"
48# include "BKE_curves.hh"
49# include "BKE_global.hh"
50# include "BKE_grease_pencil.hh"
51
52# include "BLI_listbase.hh"
53# include "BLI_math_matrix.hh"
54# include "BLI_span.hh"
55# include "BLI_string.hh"
56
57# include "DEG_depsgraph.hh"
58# include "DEG_depsgraph_build.hh"
59
60# include "ED_grease_pencil.hh"
61
62namespace blender {
63
64static GreasePencil *rna_grease_pencil(const PointerRNA *ptr)
65{
66 return reinterpret_cast<GreasePencil *>(ptr->owner_id);
67}
68
69static void rna_grease_pencil_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
70{
71 DEG_id_tag_update(&rna_grease_pencil(ptr)->id, ID_RECALC_GEOMETRY);
72 WM_main_add_notifier(NC_GPENCIL | NA_EDITED, rna_grease_pencil(ptr));
73}
74
75static void rna_grease_pencil_autolock(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
76{
77 using namespace bke::greasepencil;
78 GreasePencil *grease_pencil = rna_grease_pencil(ptr);
79 if (grease_pencil->flag & GREASE_PENCIL_AUTOLOCK_LAYERS) {
80 grease_pencil->autolock_inactive_layers();
81 }
82 else {
83 for (Layer *layer : grease_pencil->layers_for_write()) {
84 layer->set_locked(false);
85 }
86 }
87
88 rna_grease_pencil_update(nullptr, nullptr, ptr);
89}
90
91static void rna_grease_pencil_dependency_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
92{
93 DEG_id_tag_update(&rna_grease_pencil(ptr)->id, ID_RECALC_GEOMETRY);
95 WM_main_add_notifier(NC_GPENCIL | NA_EDITED, rna_grease_pencil(ptr));
96}
97
98static int rna_Drawing_user_count_get(PointerRNA *ptr)
99{
100 using namespace bke::greasepencil;
101 const GreasePencilDrawing *drawing = static_cast<const GreasePencilDrawing *>(ptr->data);
102 return drawing->wrap().user_count();
103}
104
105static int rna_GreasePencilDrawing_curve_offset_data_length(PointerRNA *ptr)
106{
107 const GreasePencilDrawing *drawing = static_cast<GreasePencilDrawing *>(ptr->data);
108 return drawing->geometry.curve_num + 1;
109}
110
111static void rna_GreasePencilDrawing_curve_offset_data_begin(CollectionPropertyIterator *iter,
112 PointerRNA *ptr)
113{
114 GreasePencilDrawing *drawing = static_cast<GreasePencilDrawing *>(ptr->data);
116 ptr,
117 drawing->geometry.wrap().offsets_for_write().data(),
118 sizeof(int),
119 drawing->geometry.curve_num + 1,
120 false,
121 nullptr);
122}
123
124static bool rna_GreasePencilDrawing_curve_offset_data_lookup_int(PointerRNA *ptr,
125 int index,
126 PointerRNA *r_ptr)
127{
128 GreasePencilDrawing *drawing = static_cast<GreasePencilDrawing *>(ptr->data);
129 if (index < 0 || index >= drawing->geometry.curve_num + 1) {
130 return false;
131 }
133 *ptr, RNA_IntAttributeValue, &drawing->geometry.wrap().offsets_for_write()[index], *r_ptr);
134 return true;
135}
136
137static void rna_GreasePencilLayer_frames_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
138{
139 using namespace bke::greasepencil;
140 Layer &layer = static_cast<GreasePencilLayer *>(ptr->data)->wrap();
141 Span<FramesMapKeyT> sorted_keys = layer.sorted_keys();
142
144 ptr,
145 (void *)sorted_keys.data(),
146 sizeof(FramesMapKeyT),
147 sorted_keys.size(),
148 false,
149 nullptr);
150}
151
152static PointerRNA rna_GreasePencilLayer_frames_get(CollectionPropertyIterator *iter)
153{
154 using namespace bke::greasepencil;
155 const FramesMapKeyT frame_key = *static_cast<FramesMapKeyT *>(rna_iterator_array_get(iter));
156 const Layer &layer = static_cast<GreasePencilLayer *>(iter->parent.data)->wrap();
157 const GreasePencilFrame *frame = layer.frames().lookup_ptr(frame_key);
159 iter->parent,
160 RNA_GreasePencilFrame,
161 static_cast<void *>(const_cast<GreasePencilFrame *>(frame)));
162}
163
164static int rna_GreasePencilLayer_frames_length(PointerRNA *ptr)
165{
166 using namespace bke::greasepencil;
167 Layer &layer = static_cast<GreasePencilLayer *>(ptr->data)->wrap();
168 return layer.frames().size();
169}
170
171static bool rna_GreasePencilLayer_frames_lookup_int(PointerRNA *ptr, int index, PointerRNA *r_ptr)
172{
173 using namespace bke::greasepencil;
174 Layer &layer = static_cast<GreasePencilLayer *>(ptr->data)->wrap();
175 if (index < 0 || index >= layer.sorted_keys().size()) {
176 return false;
177 }
178 const FramesMapKeyT frame_key = layer.sorted_keys()[index];
179 const GreasePencilFrame *frame = layer.frames().lookup_ptr(frame_key);
181 RNA_GreasePencilFrame,
182 static_cast<void *>(const_cast<GreasePencilFrame *>(frame)),
183 *r_ptr);
184 return true;
185}
186
187static std::pair<int, const bke::greasepencil::Layer *> find_layer_of_frame(
188 const GreasePencil &grease_pencil, const GreasePencilFrame &find_frame)
189{
190 using namespace bke::greasepencil;
191 for (const Layer *layer : grease_pencil.layers()) {
192 for (const auto &[key, frame] : layer->frames().items()) {
193 if (&frame == &find_frame) {
194 return {int(key), layer};
195 }
196 }
197 }
198 return {0, nullptr};
199}
200
201static std::pair<int, bke::greasepencil::Layer *> find_layer_of_frame(
202 GreasePencil &grease_pencil, const GreasePencilFrame &find_frame)
203{
204 using namespace bke::greasepencil;
205 for (Layer *layer : grease_pencil.layers_for_write()) {
206 for (const auto &[key, frame] : layer->frames().items()) {
207 if (&frame == &find_frame) {
208 return {int(key), layer};
209 }
210 }
211 }
212 return {0, nullptr};
213}
214
215static PointerRNA rna_Frame_drawing_get(PointerRNA *ptr)
216{
217 using namespace bke::greasepencil;
218 const GreasePencil &grease_pencil = *rna_grease_pencil(ptr);
219 GreasePencilFrame &frame_to_find = *static_cast<GreasePencilFrame *>(ptr->data);
220 if (frame_to_find.is_end()) {
221 return {};
222 }
223
224 /* RNA doesn't give access to the parented layer object, so we have to iterate over all layers
225 * and search for the matching GreasePencilFrame pointer in the frames collection. */
226 auto [frame_number, this_layer] = find_layer_of_frame(grease_pencil, frame_to_find);
227 if (this_layer == nullptr) {
228 return {};
229 }
230
231 const Drawing *drawing = grease_pencil.get_drawing_at(*this_layer, frame_number);
233 *ptr, RNA_GreasePencilDrawing, static_cast<void *>(const_cast<Drawing *>(drawing)));
234}
235
236static void rna_Frame_drawing_set(PointerRNA *frame_ptr,
237 const PointerRNA drawing_ptr,
238 ReportList * /*reports*/)
239{
240 using namespace bke::greasepencil;
241 GreasePencil &grease_pencil = *rna_grease_pencil(frame_ptr);
242 GreasePencilFrame &frame_to_find = *static_cast<GreasePencilFrame *>(frame_ptr->data);
243 /* It shouldn't be possible for the user to get an PointerRNA to a frame that just marks the end
244 * of another frame. */
245 BLI_assert(!frame_to_find.is_end());
246
247 /* RNA doesn't give access to the parented layer object, so we have to iterate over all layers
248 * and search for the matching GreasePencilFrame pointer in the frames collection. */
249 auto [frame_number, this_layer] = find_layer_of_frame(grease_pencil, frame_to_find);
250 /* Layer should exist. */
251 BLI_assert(this_layer != nullptr);
252
253 Drawing *dst_drawing = grease_pencil.get_drawing_at(*this_layer, frame_number);
254 if (dst_drawing == nullptr) {
255 return;
256 }
257 const Drawing *src_drawing = static_cast<const Drawing *>(drawing_ptr.data);
258 if (src_drawing == nullptr) {
259 /* Clear the drawing. */
260 *dst_drawing = {};
261 }
262 else {
263 *dst_drawing = *src_drawing;
264 }
265}
266
267static int rna_Frame_frame_number_get(PointerRNA *ptr)
268{
269 using namespace bke::greasepencil;
270 const GreasePencil &grease_pencil = *rna_grease_pencil(ptr);
271 GreasePencilFrame &frame_to_find = *static_cast<GreasePencilFrame *>(ptr->data);
272
273 /* RNA doesn't give access to the parented layer object, so we have to iterate over all layers
274 * and search for the matching GreasePencilFrame pointer in the frames collection. */
275 auto [frame_number, this_layer] = find_layer_of_frame(grease_pencil, frame_to_find);
276 /* Layer should exist. */
277 BLI_assert(this_layer != nullptr);
278 return frame_number;
279}
280
281static void rna_grease_pencil_layer_mask_name_get(PointerRNA *ptr, char *dst)
282{
283 GreasePencilLayerMask *mask = static_cast<GreasePencilLayerMask *>(ptr->data);
284 if (mask->layer_name != nullptr) {
285 strcpy(dst, mask->layer_name);
286 }
287 else {
288 dst[0] = '\0';
289 }
290}
291
292static int rna_grease_pencil_layer_mask_name_length(PointerRNA *ptr)
293{
294 GreasePencilLayerMask *mask = static_cast<GreasePencilLayerMask *>(ptr->data);
295 if (mask->layer_name != nullptr) {
296 return strlen(mask->layer_name);
297 }
298 return 0;
299}
300
301static void rna_grease_pencil_layer_mask_name_set(PointerRNA *ptr, const char *value)
302{
303 GreasePencil *grease_pencil = rna_grease_pencil(ptr);
304 GreasePencilLayerMask *mask = static_cast<GreasePencilLayerMask *>(ptr->data);
305
306 const std::string oldname(mask->layer_name);
307 if (bke::greasepencil::TreeNode *node = grease_pencil->find_node_by_name(oldname)) {
308 grease_pencil->rename_node(*G_MAIN, *node, value);
309 }
310}
311
312static int rna_grease_pencil_active_mask_index_get(PointerRNA *ptr)
313{
314 GreasePencilLayer *layer = static_cast<GreasePencilLayer *>(ptr->data);
315 return layer->active_mask_index;
316}
317
318static void rna_grease_pencil_active_mask_index_set(PointerRNA *ptr, int value)
319{
320 GreasePencilLayer *layer = static_cast<GreasePencilLayer *>(ptr->data);
321 layer->active_mask_index = value;
322}
323
324static void rna_grease_pencil_active_mask_index_range(
325 PointerRNA *ptr, int *min, int *max, int * /*softmin*/, int * /*softmax*/)
326{
327 GreasePencilLayer *layer = static_cast<GreasePencilLayer *>(ptr->data);
328 *min = 0;
329 *max = max_ii(0, layer->masks.count() - 1);
330}
331
332static void tree_node_name_get(bke::greasepencil::TreeNode &node, char *dst)
333{
334 if (!node.name().is_empty()) {
335 strcpy(dst, node.name().c_str());
336 }
337 else {
338 dst[0] = '\0';
339 }
340}
341
342static int tree_node_name_length(bke::greasepencil::TreeNode &node)
343{
344 if (!node.name().is_empty()) {
345 return node.name().size();
346 }
347 return 0;
348}
349
350static std::optional<std::string> tree_node_name_path(bke::greasepencil::TreeNode &node,
351 const char *prefix)
352{
353 using namespace bke::greasepencil;
354 BLI_assert(!node.name().is_empty());
355 std::string name_esc = BLI_str_escape(node.name());
356 return fmt::format("{}[\"{}\"]", prefix, name_esc);
357}
358
359static StructRNA *rna_GreasePencilTreeNode_refine(PointerRNA *ptr)
360{
361 GreasePencilLayerTreeNode *node = static_cast<GreasePencilLayerTreeNode *>(ptr->data);
362 switch (node->type) {
364 return RNA_GreasePencilLayer;
366 return RNA_GreasePencilLayerGroup;
367 default:
369 }
370 return nullptr;
371}
372
373static void rna_GreasePencilTreeNode_name_get(PointerRNA *ptr, char *value)
374{
375 GreasePencilLayerTreeNode *node = static_cast<GreasePencilLayerTreeNode *>(ptr->data);
376 tree_node_name_get(node->wrap(), value);
377}
378
379static int rna_GreasePencilTreeNode_name_length(PointerRNA *ptr)
380{
381 GreasePencilLayerTreeNode *node = static_cast<GreasePencilLayerTreeNode *>(ptr->data);
382 return tree_node_name_length(node->wrap());
383}
384
385static void rna_GreasePencilTreeNode_name_set(PointerRNA *ptr, const char *value)
386{
387 GreasePencil *grease_pencil = rna_grease_pencil(ptr);
388 GreasePencilLayerTreeNode *node = static_cast<GreasePencilLayerTreeNode *>(ptr->data);
389
390 grease_pencil->rename_node(*G_MAIN, node->wrap(), value);
391}
392
393static PointerRNA rna_GreasePencilTreeNode_parent_layer_group_get(PointerRNA *ptr)
394{
395 GreasePencil *grease_pencil = rna_grease_pencil(ptr);
396 GreasePencilLayerTreeNode *node = static_cast<GreasePencilLayerTreeNode *>(ptr->data);
397 /* Return 'None' when node is in the root group. This group is not meant to be seen. */
398 if (node->parent == nullptr || node->parent == grease_pencil->root_group_ptr) {
399 return {};
400 }
402 *ptr, RNA_GreasePencilLayerGroup, static_cast<void *>(node->parent));
403}
404
405static int rna_GreasePencilTreeNode_channel_color_editable(const PointerRNA * /*ptr*/,
406 const char **r_info)
407{
408 if (U.animation_flag & USER_ANIM_SHOW_CHANNEL_GROUP_COLORS) {
409 return PROP_EDITABLE;
410 }
411
412 *r_info = TIP_("Channel colors are disabled in Animation Preferences");
413 return 0;
414}
415
416static void rna_iterator_grease_pencil_layers_begin(CollectionPropertyIterator *iter,
417 PointerRNA *ptr)
418{
419 using namespace bke::greasepencil;
420 GreasePencil *grease_pencil = rna_grease_pencil(ptr);
421 const Span<const Layer *> layers = grease_pencil->layers();
422
423 iter->internal.count.item = 0;
424 iter->valid = !layers.is_empty();
425}
426
427static void rna_iterator_grease_pencil_layers_next(CollectionPropertyIterator *iter)
428{
429 using namespace bke::greasepencil;
430 GreasePencil *grease_pencil = static_cast<GreasePencil *>(iter->parent.data);
431 const Span<const Layer *> layers = grease_pencil->layers();
432
433 iter->internal.count.item++;
434 iter->valid = layers.index_range().contains(iter->internal.count.item);
435}
436
437static PointerRNA rna_iterator_grease_pencil_layers_get(CollectionPropertyIterator *iter)
438{
439 using namespace bke::greasepencil;
440 GreasePencil *grease_pencil = static_cast<GreasePencil *>(iter->parent.data);
441 Span<Layer *> layers = grease_pencil->layers_for_write();
442
443 return RNA_pointer_create_discrete(iter->parent.owner_id,
444 RNA_GreasePencilLayer,
445 static_cast<void *>(layers[iter->internal.count.item]));
446}
447
448static int rna_iterator_grease_pencil_layers_length(PointerRNA *ptr)
449{
450 GreasePencil *grease_pencil = rna_grease_pencil(ptr);
451 return grease_pencil->layers().size();
452}
453
454static std::optional<std::string> rna_GreasePencilLayer_path(const PointerRNA *ptr)
455{
456 GreasePencilLayer *layer = static_cast<GreasePencilLayer *>(ptr->data);
457 return tree_node_name_path(layer->wrap().as_node(), "layers");
458}
459
460static int rna_GreasePencilLayer_pass_index_get(PointerRNA *ptr)
461{
462 const GreasePencil &grease_pencil = *rna_grease_pencil(ptr);
464 static_cast<const GreasePencilLayer *>(ptr->data)->wrap();
465 const int layer_idx = *grease_pencil.get_layer_index(layer);
466
467 const VArray layer_passes = *grease_pencil.attributes().lookup_or_default<int>(
468 "pass_index", bke::AttrDomain::Layer, 0);
469 return layer_passes[layer_idx];
470}
471
472static void rna_GreasePencilLayer_pass_index_set(PointerRNA *ptr, int value)
473{
474 GreasePencil &grease_pencil = *rna_grease_pencil(ptr);
476 static_cast<const GreasePencilLayer *>(ptr->data)->wrap();
477 const int layer_idx = *grease_pencil.get_layer_index(layer);
478
479 if (bke::SpanAttributeWriter<int> layer_passes =
480 grease_pencil.attributes_for_write().lookup_or_add_for_write_span<int>(
481 "pass_index", bke::AttrDomain::Layer))
482 {
483 layer_passes.span[layer_idx] = std::max(0, value);
484 layer_passes.finish();
485 }
486}
487
488static void rna_GreasePencilLayer_parent_set(PointerRNA *ptr,
489 PointerRNA value,
490 ReportList * /*reports*/)
491{
492 bke::greasepencil::Layer &layer = static_cast<GreasePencilLayer *>(ptr->data)->wrap();
493 Object *parent = static_cast<Object *>(value.data);
494
495 ed::greasepencil::grease_pencil_layer_parent_set(layer, parent, layer.parent_bone_name(), false);
496}
497
498static void rna_GreasePencilLayer_bone_set(PointerRNA *ptr, const char *value)
499{
500 bke::greasepencil::Layer &layer = static_cast<GreasePencilLayer *>(ptr->data)->wrap();
501
503}
504
505static void rna_GreasePencilLayer_tint_color_get(PointerRNA *ptr, float *values)
506{
507 const GreasePencil &grease_pencil = *rna_grease_pencil(ptr);
509 static_cast<const GreasePencilLayer *>(ptr->data)->wrap();
510 const int layer_idx = *grease_pencil.get_layer_index(layer);
511
512 const VArray tint_colors = *grease_pencil.attributes().lookup_or_default<ColorGeometry4f>(
513 "tint_color", bke::AttrDomain::Layer, ColorGeometry4f(0.0f, 0.0f, 0.0f, 0.0f));
514 copy_v3_v3(values, tint_colors[layer_idx]);
515}
516
517static void rna_GreasePencilLayer_tint_color_set(PointerRNA *ptr, const float *values)
518{
519 GreasePencil &grease_pencil = *rna_grease_pencil(ptr);
521 static_cast<const GreasePencilLayer *>(ptr->data)->wrap();
522 const int layer_idx = *grease_pencil.get_layer_index(layer);
523
525 grease_pencil.attributes_for_write().lookup_or_add_for_write_span<ColorGeometry4f>(
526 "tint_color",
528 bke::AttributeInitValue(ColorGeometry4f(0.0f, 0.0f, 0.0f, 0.0f))))
529 {
530 copy_v3_v3(tint_colors.span[layer_idx], values);
531 tint_colors.finish();
532 }
533}
534
535static float rna_GreasePencilLayer_tint_factor_get(PointerRNA *ptr)
536{
537 const GreasePencil &grease_pencil = *rna_grease_pencil(ptr);
539 static_cast<const GreasePencilLayer *>(ptr->data)->wrap();
540 const int layer_idx = *grease_pencil.get_layer_index(layer);
541
542 const VArray tint_colors = *grease_pencil.attributes().lookup_or_default<ColorGeometry4f>(
543 "tint_color", bke::AttrDomain::Layer, ColorGeometry4f(0.0f, 0.0f, 0.0f, 0.0f));
544 return tint_colors[layer_idx][3];
545}
546
547static void rna_GreasePencilLayer_tint_factor_set(PointerRNA *ptr, const float value)
548{
549 GreasePencil &grease_pencil = *rna_grease_pencil(ptr);
551 static_cast<const GreasePencilLayer *>(ptr->data)->wrap();
552 const int layer_idx = *grease_pencil.get_layer_index(layer);
553
555 grease_pencil.attributes_for_write().lookup_or_add_for_write_span<ColorGeometry4f>(
556 "tint_color",
558 bke::AttributeInitValue(ColorGeometry4f(0.0f, 0.0f, 0.0f, 0.0f))))
559 {
560 tint_colors.span[layer_idx][3] = value;
561 tint_colors.finish();
562 }
563}
564
565static float rna_GreasePencilLayer_radius_offset_get(PointerRNA *ptr)
566{
567 const GreasePencil &grease_pencil = *rna_grease_pencil(ptr);
569 static_cast<const GreasePencilLayer *>(ptr->data)->wrap();
570 const int layer_idx = *grease_pencil.get_layer_index(layer);
571
572 const VArray radius_offsets = *grease_pencil.attributes().lookup_or_default<float>(
573 "radius_offset", bke::AttrDomain::Layer, 0.0f);
574 return radius_offsets[layer_idx];
575}
576
577static void rna_GreasePencilLayer_radius_offset_set(PointerRNA *ptr, const float value)
578{
579 GreasePencil &grease_pencil = *rna_grease_pencil(ptr);
581 static_cast<const GreasePencilLayer *>(ptr->data)->wrap();
582 const int layer_idx = *grease_pencil.get_layer_index(layer);
583
584 if (bke::SpanAttributeWriter<float> radius_offsets =
585 grease_pencil.attributes_for_write().lookup_or_add_for_write_span<float>(
586 "radius_offset", bke::AttrDomain::Layer, bke::AttributeInitValue(0.0f)))
587 {
588 radius_offsets.span[layer_idx] = value;
589 radius_offsets.finish();
590 }
591}
592
593static void rna_GreasePencilLayer_matrix_local_get(PointerRNA *ptr, float *values)
594{
596 static_cast<const GreasePencilLayer *>(ptr->data)->wrap();
597 std::copy_n(layer.local_transform().base_ptr(), 16, values);
598}
599
600static void rna_GreasePencilLayer_matrix_parent_inverse_get(PointerRNA *ptr, float *values)
601{
603 static_cast<const GreasePencilLayer *>(ptr->data)->wrap();
604 std::copy_n(layer.parent_inverse().base_ptr(), 16, values);
605}
606
607static PointerRNA rna_GreasePencil_active_layer_get(PointerRNA *ptr)
608{
609 GreasePencil *grease_pencil = rna_grease_pencil(ptr);
610 if (grease_pencil->has_active_layer()) {
612 *ptr, RNA_GreasePencilLayer, static_cast<void *>(grease_pencil->get_active_layer()));
613 }
614 return {};
615}
616
617static void rna_GreasePencil_active_layer_set(PointerRNA *ptr,
618 PointerRNA value,
619 ReportList * /*reports*/)
620{
621 GreasePencil *grease_pencil = rna_grease_pencil(ptr);
622 grease_pencil->set_active_layer(static_cast<bke::greasepencil::Layer *>(value.data));
624}
625
626static PointerRNA rna_GreasePencil_active_group_get(PointerRNA *ptr)
627{
628 GreasePencil *grease_pencil = rna_grease_pencil(ptr);
629 if (grease_pencil->has_active_group()) {
631 *ptr, RNA_GreasePencilLayerGroup, static_cast<void *>(grease_pencil->get_active_group()));
632 }
633 return {};
634}
635
636static void rna_GreasePencil_active_group_set(PointerRNA *ptr,
637 PointerRNA value,
638 ReportList * /*reports*/)
639{
640 using namespace bke::greasepencil;
641 GreasePencil *grease_pencil = rna_grease_pencil(ptr);
642 TreeNode *node = static_cast<TreeNode *>(value.data);
643 if (node->is_group()) {
644 grease_pencil->set_active_node(node);
646 }
647}
648
649static std::optional<std::string> rna_GreasePencilLayerGroup_path(const PointerRNA *ptr)
650{
651 GreasePencilLayerTreeGroup *group = static_cast<GreasePencilLayerTreeGroup *>(ptr->data);
652 return tree_node_name_path(group->wrap().as_node(), "layer_groups");
653}
654
655static void rna_GreasePencilLayerGroup_is_expanded_set(PointerRNA *ptr, const bool value)
656{
657 GreasePencilLayerTreeGroup *group = static_cast<GreasePencilLayerTreeGroup *>(ptr->data);
658 group->wrap().set_expanded(value);
659}
660
661static void rna_GreasePencilLayerGroup_children_begin(CollectionPropertyIterator *iter,
662 PointerRNA *ptr)
663{
664 using namespace blender::bke::greasepencil;
665 LayerGroup *layer_group = static_cast<LayerGroup *>(ptr->data);
666 ListBaseT<GreasePencilLayerTreeNode> *children = &layer_group->children;
667
668 rna_iterator_listbase_begin(iter, ptr, children, nullptr);
669}
670
671static void rna_GreasePencilLayerGroup_children_next(CollectionPropertyIterator *iter)
672{
674}
675
676static PointerRNA rna_GreasePencilLayerGroup_children_get(CollectionPropertyIterator *iter)
677{
679 iter->parent.owner_id, RNA_GreasePencilTreeNode, rna_iterator_listbase_get(iter));
680}
681
682static int rna_GreasePencilLayerGroup_children_length(PointerRNA *ptr)
683{
684 using namespace blender::bke::greasepencil;
685 TreeNode *node = static_cast<TreeNode *>(ptr->data);
686
687 BLI_assert(node->is_group());
688
689 return node->as_group().num_direct_nodes();
690}
691
692static bool rna_GreasePencilLayerGroup_children_lookup_int(PointerRNA *ptr,
693 int index,
694 PointerRNA *r_ptr)
695{
696 using namespace blender::bke::greasepencil;
697 LayerGroup *layer_group = static_cast<LayerGroup *>(ptr->data);
698 ListBaseT<GreasePencilLayerTreeNode> *lb = &layer_group->children;
699
700 *r_ptr = rna_listbase_lookup_int(ptr, RNA_GreasePencilTreeNode, lb, index);
701 return true;
702}
703
704static void rna_iterator_grease_pencil_layer_groups_begin(CollectionPropertyIterator *iter,
705 PointerRNA *ptr)
706{
707 using namespace bke::greasepencil;
708 GreasePencil *grease_pencil = rna_grease_pencil(ptr);
709 const Span<const LayerGroup *> groups = grease_pencil->layer_groups();
710
711 iter->internal.count.item = 0;
712 iter->valid = !groups.is_empty();
713}
714
715static void rna_iterator_grease_pencil_layer_groups_next(CollectionPropertyIterator *iter)
716{
717 using namespace bke::greasepencil;
718 GreasePencil *grease_pencil = static_cast<GreasePencil *>(iter->parent.data);
719 const Span<const LayerGroup *> groups = grease_pencil->layer_groups();
720
721 iter->internal.count.item++;
722 iter->valid = groups.index_range().contains(iter->internal.count.item);
723}
724
725static PointerRNA rna_iterator_grease_pencil_layer_groups_get(CollectionPropertyIterator *iter)
726{
727 using namespace bke::greasepencil;
728 GreasePencil *grease_pencil = static_cast<GreasePencil *>(iter->parent.data);
729 Span<LayerGroup *> groups = grease_pencil->layer_groups_for_write();
730
732 RNA_GreasePencilLayerGroup,
733 static_cast<void *>(groups[iter->internal.count.item]));
734}
735
736static int rna_iterator_grease_pencil_layer_groups_length(PointerRNA *ptr)
737{
738 GreasePencil *grease_pencil = rna_grease_pencil(ptr);
739 return grease_pencil->layer_groups().size();
740}
741
742static void rna_iterator_grease_pencil_root_nodes_begin(CollectionPropertyIterator *iter,
743 PointerRNA *ptr)
744{
745 using namespace blender::bke::greasepencil;
746 GreasePencil *grease_pencil = rna_grease_pencil(ptr);
747
748 LayerGroup &root_group = grease_pencil->root_group();
749 ListBaseT<GreasePencilLayerTreeNode> *children = &root_group.children;
750
751 rna_iterator_listbase_begin(iter, ptr, children, nullptr);
752}
753
754static void rna_iterator_grease_pencil_root_nodes_next(CollectionPropertyIterator *iter)
755{
757}
758
759static PointerRNA rna_iterator_grease_pencil_root_nodes_get(CollectionPropertyIterator *iter)
760{
762 iter->parent.owner_id, RNA_GreasePencilTreeNode, rna_iterator_listbase_get(iter));
763}
764
765static int rna_iterator_grease_pencil_root_nodes_length(PointerRNA *ptr)
766{
767 using namespace blender::bke::greasepencil;
768 GreasePencil *grease_pencil = rna_grease_pencil(ptr);
769 return grease_pencil->root_group().num_direct_nodes();
770}
771
772static int rna_group_color_tag_get(PointerRNA *ptr)
773{
774 using namespace bke::greasepencil;
775 GreasePencilLayerTreeGroup *group = static_cast<GreasePencilLayerTreeGroup *>(ptr->data);
776 return group->color_tag;
777}
778
779static void rna_group_color_tag_set(PointerRNA *ptr, int value)
780{
781 GreasePencilLayerTreeGroup *group = static_cast<GreasePencilLayerTreeGroup *>(ptr->data);
782 group->color_tag = GroupColorTag(value);
784}
785
786} // namespace blender
787
788#else
789
790namespace blender {
791
793{
794 StructRNA *srna;
795 PropertyRNA *prop;
796
797 static const EnumPropertyItem rna_enum_drawing_type_items[] = {
798 {GP_DRAWING, "DRAWING", 0, "Drawing", ""},
799 {GP_DRAWING_REFERENCE, "REFERENCE", 0, "Reference", ""},
800 {0, nullptr, 0, nullptr, nullptr}};
801
802 srna = RNA_def_struct(brna, "GreasePencilDrawing", nullptr);
803 RNA_def_struct_sdna(srna, "GreasePencilDrawing");
804 RNA_def_struct_ui_text(srna, "Grease Pencil Drawing", "A Grease Pencil drawing");
805
806 /* Type. */
807 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
808 RNA_def_property_enum_sdna(prop, nullptr, "base.type");
809 RNA_def_property_enum_items(prop, rna_enum_drawing_type_items);
811 RNA_def_property_ui_text(prop, "Type", "Drawing type");
812 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
813
814 /* User Count. */
815 prop = RNA_def_property(srna, "user_count", PROP_INT, PROP_NONE);
816 RNA_def_property_int_funcs(prop, "rna_Drawing_user_count_get", nullptr, nullptr);
818 RNA_def_property_ui_text(prop, "User Count", "The number of keyframes this drawing is used by");
819 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
820
821 /* Curve offsets. */
822 prop = RNA_def_property(srna, "curve_offsets", PROP_COLLECTION, PROP_NONE);
823 RNA_def_property_struct_type(prop, "IntAttributeValue");
826 "rna_GreasePencilDrawing_curve_offset_data_begin",
827 "rna_iterator_array_next",
828 "rna_iterator_array_end",
829 "rna_iterator_array_get",
830 "rna_GreasePencilDrawing_curve_offset_data_length",
831 "rna_GreasePencilDrawing_curve_offset_data_lookup_int",
832 nullptr,
833 nullptr);
836 prop, "Curve Offsets", "Offset indices of the first point of each curve");
837 RNA_def_property_update(prop, 0, "rna_grease_pencil_update");
838
840
841 /* Attributes. */
843}
844
846{
847 StructRNA *srna;
848 PropertyRNA *prop;
849
850 static const EnumPropertyItem rna_enum_keyframe_type_items[] = {
852 "KEYFRAME",
853 ICON_KEYTYPE_KEYFRAME_VEC,
854 "Keyframe",
855 "Normal keyframe, e.g. for key poses"},
857 "BREAKDOWN",
858 ICON_KEYTYPE_BREAKDOWN_VEC,
859 "Breakdown",
860 "A breakdown pose, e.g. for transitions between key poses"},
862 "MOVING_HOLD",
863 ICON_KEYTYPE_MOVING_HOLD_VEC,
864 "Moving Hold",
865 "A keyframe that is part of a moving hold"},
867 "EXTREME",
868 ICON_KEYTYPE_EXTREME_VEC,
869 "Extreme",
870 "An 'extreme' pose, or some other purpose as needed"},
872 "JITTER",
873 ICON_KEYTYPE_JITTER_VEC,
874 "Jitter",
875 "A filler or baked keyframe for keying on ones, or some other purpose as needed"},
877 "GENERATED",
878 ICON_KEYTYPE_GENERATED_VEC,
879 "Generated",
880 "A key generated automatically by a tool, not manually created"},
881 {0, nullptr, 0, nullptr, nullptr},
882 };
883
884 srna = RNA_def_struct(brna, "GreasePencilFrame", nullptr);
885 RNA_def_struct_sdna(srna, "GreasePencilFrame");
886 RNA_def_struct_ui_text(srna, "Grease Pencil Frame", "A Grease Pencil keyframe");
887
888 /* Drawing. */
889 prop = RNA_def_property(srna, "drawing", PROP_POINTER, PROP_NONE);
890 RNA_def_property_struct_type(prop, "GreasePencilDrawing");
892 prop, "rna_Frame_drawing_get", "rna_Frame_drawing_set", nullptr, nullptr);
894 RNA_def_property_ui_text(prop, "Drawing", "A Grease Pencil drawing");
895 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
896
897 /* Frame number. */
898 prop = RNA_def_property(srna, "frame_number", PROP_INT, PROP_NONE);
899 /* TODO: Make property editable, ensure frame number isn't already in use. */
901 RNA_def_property_int_funcs(prop, "rna_Frame_frame_number_get", nullptr, nullptr);
903 RNA_def_property_ui_text(prop, "Frame Number", "The frame number in the scene");
904 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
905
906 /* Selection status. */
907 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
908 RNA_def_property_boolean_sdna(prop, nullptr, "flag", GP_FRAME_SELECTED);
909 RNA_def_property_ui_text(prop, "Select", "Frame Selection in the Dope Sheet");
910 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
911
912 /* Keyframe type. */
913 prop = RNA_def_property(srna, "keyframe_type", PROP_ENUM, PROP_NONE);
914 RNA_def_property_enum_sdna(prop, nullptr, "type");
916 RNA_def_property_enum_items(prop, rna_enum_keyframe_type_items);
917 RNA_def_property_ui_text(prop, "Keyframe Type", "Type of keyframe");
919 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
920}
921
923{
924 StructRNA *srna;
925
926 RNA_def_property_srna(cprop, "GreasePencilFrames");
927 srna = RNA_def_struct(brna, "GreasePencilFrames", nullptr);
928 RNA_def_struct_sdna(srna, "GreasePencilLayer");
929 RNA_def_struct_ui_text(srna, "Grease Pencil Frames", "Collection of Grease Pencil frames");
930
932}
933
935{
936 StructRNA *srna;
937 PropertyRNA *prop;
938
939 srna = RNA_def_struct(brna, "GreasePencilLayerMask", nullptr);
940 RNA_def_struct_sdna(srna, "GreasePencilLayerMask");
941 RNA_def_struct_ui_text(srna, "Grease Pencil Masking Layers", "List of Mask Layers");
942 // RNA_def_struct_path_func(srna, "rna_GreasePencilLayerMask_path");
943
944 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
945 RNA_def_property_ui_text(prop, "Layer", "Mask layer name");
946 RNA_def_property_string_sdna(prop, nullptr, "layer_name");
948 "rna_grease_pencil_layer_mask_name_get",
949 "rna_grease_pencil_layer_mask_name_length",
950 "rna_grease_pencil_layer_mask_name_set");
954
955 prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
957 RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
958 RNA_def_property_ui_text(prop, "Hide", "Set mask Visibility");
959 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
960
961 prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
963 RNA_def_property_ui_icon(prop, ICON_SELECT_INTERSECT, 1);
964 RNA_def_property_ui_text(prop, "Invert", "Invert mask");
965 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
966}
967
969{
970 StructRNA *srna;
971 PropertyRNA *prop;
972
973 RNA_def_property_srna(cprop, "GreasePencilLayerMasks");
974 srna = RNA_def_struct(brna, "GreasePencilLayerMasks", nullptr);
975 RNA_def_struct_sdna(srna, "GreasePencilLayer");
977 srna, "Grease Pencil Mask Layers", "Collection of Grease Pencil masking layers");
978
979 prop = RNA_def_property(srna, "active_mask_index", PROP_INT, PROP_UNSIGNED);
982 "rna_grease_pencil_active_mask_index_get",
983 "rna_grease_pencil_active_mask_index_set",
984 "rna_grease_pencil_active_mask_index_range");
985 RNA_def_property_ui_text(prop, "Active Layer Mask Index", "Active index in layer mask array");
987}
988
990{
991 StructRNA *srna;
992 PropertyRNA *prop;
993
994 srna = RNA_def_struct(brna, "GreasePencilTreeNode", nullptr);
996 srna, "Tree Node", "Grease Pencil node in the layer tree. Either a layer or a group");
997 RNA_def_struct_sdna(srna, "GreasePencilLayerTreeNode");
998 RNA_def_struct_refine_func(srna, "rna_GreasePencilTreeNode_refine");
999
1000 /* Name. */
1001 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1002 RNA_def_property_ui_text(prop, "Name", "The name of the tree node");
1004 "rna_GreasePencilTreeNode_name_get",
1005 "rna_GreasePencilTreeNode_name_length",
1006 "rna_GreasePencilTreeNode_name_set");
1007 RNA_def_struct_name_property(srna, prop);
1008 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | NA_RENAME, "rna_grease_pencil_update");
1009
1010 /* Visibility. */
1011 prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
1013 RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
1014 RNA_def_property_ui_text(prop, "Hide", "Set tree node visibility");
1015 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1016
1017 /* Lock. */
1018 prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
1020 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
1021 RNA_def_property_ui_text(prop, "Locked", "Protect tree node from editing");
1022 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1023
1024 /* Select. */
1025 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
1027 RNA_def_property_ui_text(prop, "Select", "Tree node is selected");
1028 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1029
1030 /* Onion Skinning. */
1031 prop = RNA_def_property(srna, "use_onion_skinning", PROP_BOOLEAN, PROP_NONE);
1032 RNA_def_property_ui_icon(prop, ICON_ONIONSKIN_OFF, 1);
1034 prop, nullptr, "flag", GP_LAYER_TREE_NODE_HIDE_ONION_SKINNING);
1036 prop, "Onion Skinning", "Display onion skins before and after the current frame");
1037 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1038
1039 /* Use Masks. */
1040 prop = RNA_def_property(srna, "use_masks", PROP_BOOLEAN, PROP_NONE);
1041 RNA_def_property_ui_icon(prop, ICON_CLIPUV_HLT, -1);
1044 prop,
1045 "Use Masks",
1046 "The visibility of drawings in this tree node is affected by the layers in the masks list");
1047 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1048
1049 /* Channel color. */
1050 prop = RNA_def_property(srna, "channel_color", PROP_FLOAT, PROP_COLOR);
1051 RNA_def_property_float_sdna(prop, nullptr, "color");
1052 RNA_def_property_array(prop, 3);
1053 RNA_def_property_editable_func(prop, "rna_GreasePencilTreeNode_channel_color_editable");
1054 RNA_def_property_ui_text(prop, "Channel Color", "Color of the channel in the dope sheet");
1056
1057 /* Next tree node. */
1058 prop = RNA_def_property(srna, "next_node", PROP_POINTER, PROP_NONE);
1059 RNA_def_property_pointer_sdna(prop, nullptr, "next");
1060 RNA_def_property_struct_type(prop, "GreasePencilTreeNode");
1061 RNA_def_property_ui_text(prop, "Next Node", "The layer tree node after (i.e. above) this one");
1064
1065 /* Previous tree node. */
1066 prop = RNA_def_property(srna, "prev_node", PROP_POINTER, PROP_NONE);
1067 RNA_def_property_pointer_sdna(prop, nullptr, "prev");
1068 RNA_def_property_struct_type(prop, "GreasePencilTreeNode");
1070 prop, "Previous Node", "The layer tree node before (i.e. below) this one");
1073
1074 /* Parent group. */
1075 prop = RNA_def_property(srna, "parent_group", PROP_POINTER, PROP_NONE);
1076 RNA_def_property_struct_type(prop, "GreasePencilLayerGroup");
1078 prop, "rna_GreasePencilTreeNode_parent_layer_group_get", nullptr, nullptr, nullptr);
1079 RNA_def_property_ui_text(prop, "Parent Layer Group", "The parent group of this layer tree node");
1082}
1083
1085{
1086 StructRNA *srna;
1087 PropertyRNA *prop;
1088
1089 static const EnumPropertyItem rna_enum_layer_blend_modes_items[] = {
1090 {GP_LAYER_BLEND_NONE, "REGULAR", 0, "Regular", ""},
1091 {GP_LAYER_BLEND_HARDLIGHT, "HARDLIGHT", 0, "Hard Light", ""},
1092 {GP_LAYER_BLEND_ADD, "ADD", 0, "Add", ""},
1093 {GP_LAYER_BLEND_SUBTRACT, "SUBTRACT", 0, "Subtract", ""},
1094 {GP_LAYER_BLEND_MULTIPLY, "MULTIPLY", 0, "Multiply", ""},
1095 {GP_LAYER_BLEND_DIVIDE, "DIVIDE", 0, "Divide", ""},
1096 {0, nullptr, 0, nullptr, nullptr}};
1097
1098 srna = RNA_def_struct(brna, "GreasePencilLayer", "GreasePencilTreeNode");
1099 RNA_def_struct_sdna(srna, "GreasePencilLayer");
1100 RNA_def_struct_ui_text(srna, "Grease Pencil Layer", "Collection of related drawings");
1101 RNA_def_struct_path_func(srna, "rna_GreasePencilLayer_path");
1102
1103 /* Frames. */
1104 prop = RNA_def_property(srna, "frames", PROP_COLLECTION, PROP_NONE);
1105 RNA_def_property_struct_type(prop, "GreasePencilFrame");
1106 RNA_def_property_ui_text(prop, "Frames", "Grease Pencil frames");
1108 "rna_GreasePencilLayer_frames_begin",
1109 "rna_iterator_array_next",
1110 "rna_iterator_array_end",
1111 "rna_GreasePencilLayer_frames_get",
1112 "rna_GreasePencilLayer_frames_length",
1113 "rna_GreasePencilLayer_frames_lookup_int",
1114 nullptr,
1115 nullptr);
1116 rna_def_grease_pencil_frames(brna, prop);
1117
1118 /* Mask Layers */
1119 prop = RNA_def_property(srna, "mask_layers", PROP_COLLECTION, PROP_NONE);
1120 RNA_def_property_collection_sdna(prop, nullptr, "masks", nullptr);
1121 RNA_def_property_struct_type(prop, "GreasePencilLayerMask");
1122 RNA_def_property_ui_text(prop, "Masks", "List of Masking Layers");
1124
1125 /* Lock Frame. */
1126 prop = RNA_def_property(srna, "lock_frame", PROP_BOOLEAN, PROP_NONE);
1128 prop, "GreasePencilLayerTreeNode", "flag", GP_LAYER_TREE_NODE_MUTE);
1129 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
1131 RNA_def_property_ui_text(prop, "Frame Locked", "Lock current frame displayed by layer");
1132 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1133
1134 /* Opacity */
1135 prop = RNA_def_property(srna, "opacity", PROP_FLOAT, PROP_FACTOR);
1136 RNA_def_property_float_sdna(prop, "GreasePencilLayer", "opacity");
1137 RNA_def_property_ui_text(prop, "Opacity", "Layer Opacity");
1138 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1139
1140 /* Tint Color. */
1141 prop = RNA_def_property(srna, "tint_color", PROP_FLOAT, PROP_COLOR);
1142 RNA_def_property_array(prop, 3);
1144 "rna_GreasePencilLayer_tint_color_get",
1145 "rna_GreasePencilLayer_tint_color_set",
1146 nullptr);
1147 RNA_def_property_range(prop, 0.0f, 1.0f);
1148 RNA_def_property_ui_text(prop, "Tint Color", "Color for tinting stroke colors");
1149 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1150
1151 /* Tint Factor. */
1152 prop = RNA_def_property(srna, "tint_factor", PROP_FLOAT, PROP_FACTOR);
1154 "rna_GreasePencilLayer_tint_factor_get",
1155 "rna_GreasePencilLayer_tint_factor_set",
1156 nullptr);
1157 RNA_def_property_range(prop, 0.0f, 1.0f);
1158 RNA_def_property_ui_text(prop, "Tint Factor", "Factor of tinting color");
1159 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1160
1161 /* Radius Offset. */
1162 prop = RNA_def_property(srna, "radius_offset", PROP_FLOAT, PROP_TRANSLATION);
1164 "rna_GreasePencilLayer_radius_offset_get",
1165 "rna_GreasePencilLayer_radius_offset_set",
1166 nullptr);
1168 RNA_def_property_ui_text(prop, "Radius Offset", "Radius change to apply to current strokes");
1169 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1170
1171 prop = RNA_def_property(srna, "use_lights", PROP_BOOLEAN, PROP_NONE);
1173 prop, "GreasePencilLayerTreeNode", "flag", GP_LAYER_TREE_NODE_USE_LIGHTS);
1175 prop, "Use Lights", "Enable the use of lights on stroke and fill materials");
1176 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1177
1178 /* Pass index for modifiers. */
1179 prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
1181 "Pass Index",
1182 "Identifier that can be used with some modifiers to restrict their "
1183 "influence to only certain layers");
1185 "rna_GreasePencilLayer_pass_index_get",
1186 "rna_GreasePencilLayer_pass_index_set",
1187 nullptr);
1188 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1189
1190 prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
1191 RNA_def_property_struct_type(prop, "Object");
1193 prop, nullptr, "rna_GreasePencilLayer_parent_set", nullptr, nullptr);
1196 RNA_def_property_ui_text(prop, "Parent", "Parent object");
1197 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_dependency_update");
1198
1199 prop = RNA_def_property(srna, "parent_bone", PROP_STRING, PROP_NONE);
1200 RNA_def_property_string_sdna(prop, nullptr, "parsubstr");
1201 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_GreasePencilLayer_bone_set");
1203 prop,
1204 "Parent Bone",
1205 "Name of parent bone. Only used when the parent object is an armature.");
1206 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_dependency_update");
1207
1208 prop = RNA_def_property(srna, "translation", PROP_FLOAT, PROP_TRANSLATION);
1209 RNA_def_property_array(prop, 3);
1210 RNA_def_property_float_sdna(prop, nullptr, "translation");
1212 RNA_def_property_ui_text(prop, "Translation", "Translation of the layer");
1213 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1214
1215 prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER);
1216 RNA_def_property_array(prop, 3);
1217 RNA_def_property_float_sdna(prop, nullptr, "rotation");
1219 RNA_def_property_ui_text(prop, "Rotation", "Euler rotation of the layer");
1220 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1221
1222 prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
1223 RNA_def_property_array(prop, 3);
1224 RNA_def_property_float_sdna(prop, nullptr, "scale");
1226 RNA_def_property_ui_text(prop, "Scale", "Scale of the layer");
1227 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1228
1229 prop = RNA_def_property(srna, "viewlayer_render", PROP_STRING, PROP_NONE);
1230 RNA_def_property_string_sdna(prop, nullptr, "viewlayername");
1232 prop,
1233 "ViewLayer",
1234 "Only include Layer in this View Layer render output (leave blank to include always)");
1235
1236 prop = RNA_def_property(srna, "use_viewlayer_masks", PROP_BOOLEAN, PROP_NONE);
1238 prop, "GreasePencilLayerTreeNode", "flag", GP_LAYER_TREE_NODE_DISABLE_MASKS_IN_VIEWLAYER);
1240 prop, "Use Masks in Render", "Include the mask layers when rendering the view-layer");
1241 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1242
1243 prop = RNA_def_property(srna, "blend_mode", PROP_ENUM, PROP_NONE);
1244 RNA_def_property_enum_sdna(prop, nullptr, "blend_mode");
1245 RNA_def_property_enum_items(prop, rna_enum_layer_blend_modes_items);
1246 RNA_def_property_ui_text(prop, "Blend Mode", "Blend mode");
1247 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1248
1249 prop = RNA_def_property(srna, "ignore_locked_materials", PROP_BOOLEAN, PROP_NONE);
1251 prop, "GreasePencilLayerTreeNode", "flag", GP_LAYER_TREE_NODE_IGNORE_LOCKED_MATERIALS);
1254 prop, "Ignore Material Locking", "Allow editing strokes even if they use locked materials");
1255 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, nullptr);
1256 /* Local transformation matrix. */
1257 prop = RNA_def_property(srna, "matrix_local", PROP_FLOAT, PROP_MATRIX);
1260 RNA_def_property_ui_text(prop, "Local Matrix", "Local transformation matrix of the layer");
1261 RNA_def_property_float_funcs(prop, "rna_GreasePencilLayer_matrix_local_get", nullptr, nullptr);
1262 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1263
1264 /* Inverse transform of layer's parent. */
1265 prop = RNA_def_property(srna, "matrix_parent_inverse", PROP_FLOAT, PROP_MATRIX);
1269 prop, "Inverse Parent Matrix", "Inverse of layer's parent transformation matrix");
1271 prop, "rna_GreasePencilLayer_matrix_parent_inverse_get", nullptr, nullptr);
1272
1274}
1275
1277{
1278 StructRNA *srna;
1279 PropertyRNA *prop;
1280
1281 RNA_def_property_srna(cprop, "GreasePencilv3Layers");
1282 srna = RNA_def_struct(brna, "GreasePencilv3Layers", nullptr);
1283 RNA_def_struct_sdna(srna, "GreasePencil");
1284 RNA_def_struct_ui_text(srna, "Grease Pencil Layers", "Collection of Grease Pencil layers");
1285
1286 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
1287 RNA_def_property_struct_type(prop, "GreasePencilLayer");
1289 "rna_GreasePencil_active_layer_get",
1290 "rna_GreasePencil_active_layer_set",
1291 nullptr,
1292 nullptr);
1294 RNA_def_property_ui_text(prop, "Active Layer", "Active Grease Pencil layer");
1296
1298}
1299
1301 {LAYERGROUP_COLOR_NONE, "NONE", ICON_X, "Reset color tag", ""},
1302 {LAYERGROUP_COLOR_01, "COLOR1", ICON_LAYERGROUP_COLOR_01, "Color tag 1", ""},
1303 {LAYERGROUP_COLOR_02, "COLOR2", ICON_LAYERGROUP_COLOR_02, "Color tag 2", ""},
1304 {LAYERGROUP_COLOR_03, "COLOR3", ICON_LAYERGROUP_COLOR_03, "Color tag 3", ""},
1305 {LAYERGROUP_COLOR_04, "COLOR4", ICON_LAYERGROUP_COLOR_04, "Color tag 4", ""},
1306 {LAYERGROUP_COLOR_05, "COLOR5", ICON_LAYERGROUP_COLOR_05, "Color tag 5", ""},
1307 {LAYERGROUP_COLOR_06, "COLOR6", ICON_LAYERGROUP_COLOR_06, "Color tag 6", ""},
1308 {LAYERGROUP_COLOR_07, "COLOR7", ICON_LAYERGROUP_COLOR_07, "Color tag 7", ""},
1309 {LAYERGROUP_COLOR_08, "COLOR8", ICON_LAYERGROUP_COLOR_08, "Color tag 8", ""},
1310 {0, nullptr, 0, nullptr, nullptr},
1311};
1312
1314{
1315 StructRNA *srna;
1316 PropertyRNA *prop;
1317
1318 srna = RNA_def_struct(brna, "GreasePencilLayerGroup", "GreasePencilTreeNode");
1319 RNA_def_struct_sdna(srna, "GreasePencilLayerTreeGroup");
1320 RNA_def_struct_ui_text(srna, "Grease Pencil Layer Group", "Group of Grease Pencil layers");
1321 RNA_def_struct_path_func(srna, "rna_GreasePencilLayerGroup_path");
1322
1323 /* Expanded */
1324 prop = RNA_def_property(srna, "is_expanded", PROP_BOOLEAN, PROP_NONE);
1326 prop, "GreasePencilLayerTreeNode", "flag", GP_LAYER_TREE_NODE_EXPANDED);
1327 RNA_def_property_ui_text(prop, "Expanded", "The layer group is expanded in the UI");
1330 RNA_def_property_boolean_funcs(prop, nullptr, "rna_GreasePencilLayerGroup_is_expanded_set");
1331 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1332
1333 /* Color tag. */
1334 prop = RNA_def_property(srna, "color_tag", PROP_ENUM, PROP_NONE);
1335 RNA_def_property_enum_funcs(prop, "rna_group_color_tag_get", "rna_group_color_tag_set", nullptr);
1337
1338 /* Children */
1339 prop = RNA_def_property(srna, "children", PROP_COLLECTION, PROP_NONE);
1340 RNA_def_property_struct_type(prop, "GreasePencilTreeNode");
1342 "rna_GreasePencilLayerGroup_children_begin",
1343 "rna_GreasePencilLayerGroup_children_next",
1344 nullptr,
1345 "rna_GreasePencilLayerGroup_children_get",
1346 "rna_GreasePencilLayerGroup_children_length",
1347 "rna_GreasePencilLayerGroup_children_lookup_int",
1348 nullptr,
1349 nullptr);
1351 "Children",
1352 "The direct children of this layer group. Ordered by stack order, "
1353 "meaning the first child is the bottom most child in the layer tree.");
1354}
1355
1357{
1358 StructRNA *srna;
1359 PropertyRNA *prop;
1360
1361 RNA_def_property_srna(cprop, "GreasePencilv3LayerGroup");
1362 srna = RNA_def_struct(brna, "GreasePencilv3LayerGroup", nullptr);
1363 RNA_def_struct_sdna(srna, "GreasePencil");
1364 RNA_def_struct_ui_text(srna, "Grease Pencil Group", "Collection of Grease Pencil layers");
1365
1366 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
1367 RNA_def_property_struct_type(prop, "GreasePencilLayerGroup");
1369 "rna_GreasePencil_active_group_get",
1370 "rna_GreasePencil_active_group_set",
1371 nullptr,
1372 nullptr);
1374 RNA_def_property_ui_text(prop, "Active Layer Group", "Active Grease Pencil layer group");
1376
1378}
1379
1381{
1382 PropertyRNA *prop;
1383
1384 static const EnumPropertyItem prop_enum_onion_modes_items[] = {
1386 "ABSOLUTE",
1387 0,
1388 "Frames",
1389 "Frames in absolute range of the scene frame"},
1391 "RELATIVE",
1392 0,
1393 "Keyframes",
1394 "Frames in relative range of the Grease Pencil keyframes"},
1395 {GP_ONION_SKINNING_MODE_SELECTED, "SELECTED", 0, "Selected", "Only selected keyframes"},
1396 {0, nullptr, 0, nullptr, nullptr},
1397 };
1398
1399 static const EnumPropertyItem prop_enum_onion_keyframe_type_items[] = {
1400 {GREASE_PENCIL_ONION_SKINNING_FILTER_ALL, "ALL", 0, "All", "Include all Keyframe types"},
1402 "KEYFRAME",
1403 ICON_KEYTYPE_KEYFRAME_VEC,
1404 "Keyframe",
1405 "Normal keyframe, e.g. for key poses"},
1407 "BREAKDOWN",
1408 ICON_KEYTYPE_BREAKDOWN_VEC,
1409 "Breakdown",
1410 "A breakdown pose, e.g. for transitions between key poses"},
1412 "MOVING_HOLD",
1413 ICON_KEYTYPE_MOVING_HOLD_VEC,
1414 "Moving Hold",
1415 "A keyframe that is part of a moving hold"},
1417 "EXTREME",
1418 ICON_KEYTYPE_EXTREME_VEC,
1419 "Extreme",
1420 "An 'extreme' pose, or some other purpose as needed"},
1422 "JITTER",
1423 ICON_KEYTYPE_JITTER_VEC,
1424 "Jitter",
1425 "A filler or baked keyframe for keying on ones, or some other purpose as needed"},
1427 "GENERATED",
1428 ICON_KEYTYPE_GENERATED_VEC,
1429 "Generated",
1430 "A key generated automatically by a tool, not manually created"},
1431 {0, nullptr, 0, nullptr, nullptr},
1432 };
1433
1434 prop = RNA_def_property(srna, "ghost_before_range", PROP_INT, PROP_NONE);
1435 RNA_def_property_int_sdna(prop, nullptr, "onion_skinning_settings.num_frames_before");
1436 RNA_def_property_range(prop, 0, 120);
1439 "Frames Before",
1440 "Maximum number of frames to show before current frame "
1441 "(0 = don't show any frames before current)");
1442 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1443
1444 prop = RNA_def_property(srna, "ghost_after_range", PROP_INT, PROP_NONE);
1445 RNA_def_property_int_sdna(prop, nullptr, "onion_skinning_settings.num_frames_after");
1446 RNA_def_property_range(prop, 0, 120);
1449 "Frames After",
1450 "Maximum number of frames to show after current frame "
1451 "(0 = don't show any frames after current)");
1452 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1453
1454 prop = RNA_def_property(srna, "use_ghost_custom_colors", PROP_BOOLEAN, PROP_NONE);
1456 prop, nullptr, "onion_skinning_settings.flag", GP_ONION_SKINNING_USE_CUSTOM_COLORS);
1458 RNA_def_property_ui_text(prop, "Use Custom Ghost Colors", "Use custom colors for ghost frames");
1459 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1460
1461 prop = RNA_def_property(srna, "before_color", PROP_FLOAT, PROP_COLOR);
1462 RNA_def_property_float_sdna(prop, nullptr, "onion_skinning_settings.color_before");
1463 RNA_def_property_array(prop, 3);
1464 RNA_def_property_range(prop, 0.0f, 1.0f);
1466 RNA_def_property_ui_text(prop, "Before Color", "Base color for ghosts before the active frame");
1469 "rna_grease_pencil_update");
1470
1471 prop = RNA_def_property(srna, "after_color", PROP_FLOAT, PROP_COLOR);
1472 RNA_def_property_float_sdna(prop, nullptr, "onion_skinning_settings.color_after");
1473 RNA_def_property_array(prop, 3);
1474 RNA_def_property_range(prop, 0.0f, 1.0f);
1476 RNA_def_property_ui_text(prop, "After Color", "Base color for ghosts after the active frame");
1479 "rna_grease_pencil_update");
1480
1481 prop = RNA_def_property(srna, "onion_mode", PROP_ENUM, PROP_NONE);
1482 RNA_def_property_enum_sdna(prop, nullptr, "onion_skinning_settings.mode");
1483 RNA_def_property_enum_items(prop, prop_enum_onion_modes_items);
1485 RNA_def_property_ui_text(prop, "Mode", "Mode to display frames");
1486 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1487
1488 prop = RNA_def_property(srna, "onion_keyframe_type", PROP_ENUM, PROP_NONE);
1489 RNA_def_property_enum_sdna(prop, nullptr, "onion_skinning_settings.filter");
1491 RNA_def_property_enum_items(prop, prop_enum_onion_keyframe_type_items);
1492 RNA_def_property_ui_text(prop, "Filter by Type", "Type of keyframe (for filtering)");
1494 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1495
1496 prop = RNA_def_property(srna, "use_onion_fade", PROP_BOOLEAN, PROP_NONE);
1498 prop, nullptr, "onion_skinning_settings.flag", GP_ONION_SKINNING_USE_FADE);
1501 prop, "Fade", "Display onion keyframes with a fade in color transparency");
1502 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1503
1504 prop = RNA_def_property(srna, "use_onion_loop", PROP_BOOLEAN, PROP_NONE);
1506 prop, nullptr, "onion_skinning_settings.flag", GP_ONION_SKINNING_SHOW_LOOP);
1509 prop, "Show Start Frame", "Display onion keyframes for looping animations");
1510 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1511
1512 prop = RNA_def_property(srna, "onion_factor", PROP_FLOAT, PROP_NONE);
1513 RNA_def_property_float_sdna(prop, nullptr, "onion_skinning_settings.opacity");
1514 RNA_def_property_range(prop, 0.0, 1.0f);
1516 RNA_def_property_ui_text(prop, "Onion Opacity", "Change fade opacity of displayed onion frames");
1517 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1518}
1519
1521{
1522 StructRNA *srna;
1523 PropertyRNA *prop;
1524
1525 srna = RNA_def_struct(brna, "GreasePencil", "ID");
1526 RNA_def_struct_sdna(srna, "GreasePencil");
1527 RNA_def_struct_ui_text(srna, "Grease Pencil", "Grease Pencil data-block");
1528 RNA_def_struct_ui_icon(srna, ICON_OUTLINER_DATA_GREASEPENCIL);
1529
1530 /* attributes */
1532
1533 /* Animation Data */
1535
1536 /* Materials */
1537 prop = RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
1538 RNA_def_property_collection_sdna(prop, nullptr, "material_array", "material_array_num");
1539 RNA_def_property_struct_type(prop, "Material");
1540 RNA_def_property_ui_text(prop, "Materials", "");
1541 RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.cc */
1543 nullptr,
1544 nullptr,
1545 nullptr,
1546 nullptr,
1547 nullptr,
1548 nullptr,
1549 nullptr,
1550 "rna_IDMaterials_assign_int");
1551
1552 /* Layers */
1553 prop = RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
1554 RNA_def_property_struct_type(prop, "GreasePencilLayer");
1556 "rna_iterator_grease_pencil_layers_begin",
1557 "rna_iterator_grease_pencil_layers_next",
1558 nullptr,
1559 "rna_iterator_grease_pencil_layers_get",
1560 "rna_iterator_grease_pencil_layers_length",
1561 nullptr, /* TODO */
1562 nullptr, /* TODO */
1563 nullptr);
1564 RNA_def_property_ui_text(prop, "Layers", "Grease Pencil layers");
1565 rna_def_grease_pencil_layers(brna, prop);
1566
1567 /* Layer Groups */
1568 prop = RNA_def_property(srna, "layer_groups", PROP_COLLECTION, PROP_NONE);
1569 RNA_def_property_struct_type(prop, "GreasePencilLayerGroup");
1571 "rna_iterator_grease_pencil_layer_groups_begin",
1572 "rna_iterator_grease_pencil_layer_groups_next",
1573 nullptr,
1574 "rna_iterator_grease_pencil_layer_groups_get",
1575 "rna_iterator_grease_pencil_layer_groups_length",
1576 nullptr, /* TODO */
1577 nullptr, /* TODO */
1578 nullptr);
1579 RNA_def_property_ui_text(prop, "Layer Groups", "Grease Pencil layer groups");
1581
1582 /* Root nodes. */
1583 prop = RNA_def_property(srna, "root_nodes", PROP_COLLECTION, PROP_NONE);
1584 RNA_def_property_struct_type(prop, "GreasePencilTreeNode");
1586 "rna_iterator_grease_pencil_root_nodes_begin",
1587 "rna_iterator_grease_pencil_root_nodes_next",
1588 nullptr,
1589 "rna_iterator_grease_pencil_root_nodes_get",
1590 "rna_iterator_grease_pencil_root_nodes_length",
1591 nullptr,
1592 nullptr,
1593 nullptr);
1595 "Root Nodes",
1596 "The root nodes of the layer tree. Ordered by stack order, meaning the "
1597 "first node is the bottom most node in the layer tree.");
1598
1599 prop = RNA_def_property(srna, "use_autolock_layers", PROP_BOOLEAN, PROP_NONE);
1602 prop,
1603 "Auto-Lock Layers",
1604 "Automatically lock all layers except the active one to avoid accidental changes");
1605 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_autolock");
1606
1607 /* Uses a single flag, because the depth order can only be 2D or 3D. */
1608 prop = RNA_def_property(srna, "stroke_depth_order", PROP_ENUM, PROP_NONE);
1609 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "flag");
1612 prop,
1613 "Stroke Depth Order",
1614 "Defines how the strokes are ordered in 3D space (for objects not displayed 'In Front')");
1615 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1616
1617 /* Onion skinning. */
1619
1621}
1622
1633
1634} // namespace blender
1635
1636#endif
Generic geometry attributes built on CustomData.
Low-level operations for curves.
#define G_MAIN
Low-level operations for grease pencil.
#define TIP_(msgid)
#define BLT_I18NCONTEXT_ID_GPENCIL
#define GREASE_PENCIL_ONION_SKINNING_FILTER_ALL
#define MINAFRAME
#define MAXFRAME
#define RNA_TRANSLATION_PREC_DEFAULT
Definition RNA_types.hh:272
#define ND_DATA
Definition WM_types.hh:552
#define NC_SCREEN
Definition WM_types.hh:390
#define NC_SCENE
Definition WM_types.hh:391
#define ND_TOOLSETTINGS
Definition WM_types.hh:468
#define NA_EDITED
Definition WM_types.hh:634
#define NC_GPENCIL
Definition WM_types.hh:412
#define NA_RENAME
Definition WM_types.hh:638
#define NA_SELECTED
Definition WM_types.hh:639
#define BLI_assert_unreachable()
btScalar max
constexpr const T * data() const
Definition BLI_span.hh:219
constexpr int64_t count(const T &value) const
Definition BLI_span.hh:304
constexpr int64_t size() const
Definition BLI_span.hh:256
constexpr IndexRange index_range() const
Definition BLI_span.hh:405
constexpr bool is_empty() const
Definition BLI_span.hh:264
constexpr bool contains(int64_t value) const
constexpr int64_t count(const T &value) const
Definition BLI_span.hh:304
int3 size(int miplvl=0) const
#define FLT_MAX
#define layer
bool grease_pencil_layer_parent_set(bke::greasepencil::Layer &layer, Object *parent, StringRefNull bone, const bool keep_transform)
BLI_INLINE Texture * wrap(MTLTexture *texture)
BMesh Iterators.
void WM_main_add_notifier(uint type, void *reference)
UserDef U
Definition blender.cc:58
const EnumPropertyItem enum_layergroup_color_items[]
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
@ BEZT_KEYTYPE_MOVEHOLD
@ BEZT_KEYTYPE_GENERATED
@ BEZT_KEYTYPE_KEYFRAME
@ BEZT_KEYTYPE_BREAKDOWN
@ GP_LAYER_TREE_NODE_HIDE_ONION_SKINNING
@ GP_LAYER_TREE_NODE_DISABLE_MASKS_IN_VIEWLAYER
@ GP_LAYER_TREE_NODE_IGNORE_LOCKED_MATERIALS
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
void RNA_api_grease_pencil_layer_masks(StructRNA *srna)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_api_grease_pencil_drawing(StructRNA *srna)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_api_grease_pencil(StructRNA *srna)
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
void RNA_def_struct_refine_func(StructRNA *srna, const char *refine)
@ GP_ONION_SKINNING_FILTER_KEYTYPE_KEYFRAME
@ GP_ONION_SKINNING_FILTER_KEYTYPE_MOVEHOLD
@ GP_ONION_SKINNING_FILTER_KEYTYPE_JITTER
@ GP_ONION_SKINNING_FILTER_KEYTYPE_EXTREME
@ GP_ONION_SKINNING_FILTER_KEYTYPE_BREAKDOWN
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[])
static void rna_def_grease_pencil_onion_skinning(StructRNA *srna)
void RNA_api_grease_pencil_layers(StructRNA *srna)
void rna_pointer_create_with_ancestors(const PointerRNA &parent, StructRNA *type, void *data, PointerRNA &r_ptr)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
MINLINE int max_ii(int a, int b)
static void rna_def_grease_pencil_layers(BlenderRNA *brna, PropertyRNA *cprop)
@ USER_ANIM_SHOW_CHANNEL_GROUP_COLORS
static void rna_def_grease_pencil_drawing(BlenderRNA *brna)
const EnumPropertyItem rna_enum_stroke_depth_order_items[]
void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition RNA_types.hh:588
@ PROPOVERRIDE_IGNORE
Definition RNA_types.hh:609
@ PROPOVERRIDE_NO_COMPARISON
Definition RNA_types.hh:596
static void rna_def_grease_pencil_layer_masks(BlenderRNA *brna, PropertyRNA *cprop)
void RNA_def_grease_pencil(BlenderRNA *brna)
static void rna_def_grease_pencil_layer(BlenderRNA *brna)
void rna_def_animdata_common(StructRNA *srna)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier_c_str, int type, int subtype)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
@ PROP_BOOLEAN
Definition RNA_types.hh:210
@ PROP_POINTER
Definition RNA_types.hh:215
@ PROP_STRING
Definition RNA_types.hh:213
@ PROP_COLLECTION
Definition RNA_types.hh:216
void RNA_api_grease_pencil_layer(StructRNA *srna)
void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring, const char *assignint)
static void rna_def_grease_pencil_frames(BlenderRNA *brna, PropertyRNA *cprop)
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void DEG_id_tag_update(ID *id, unsigned int flags)
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
char char size_t BLI_str_escape(char *__restrict dst, StringRef src, size_t dst_maxncpy) ATTR_NONNULL(1)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
static void rna_def_grease_pencil_data(BlenderRNA *brna)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
static void rna_def_grease_pencil_tree_node(BlenderRNA *brna)
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
void * rna_iterator_array_get(CollectionPropertyIterator *iter)
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
PointerRNA rna_listbase_lookup_int(PointerRNA *ptr, StructRNA *type, ListBase *lb, int index)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void * rna_iterator_listbase_get(CollectionPropertyIterator *iter)
static void rna_def_grease_pencil_layer_group(BlenderRNA *brna)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_api_grease_pencil_layer_groups(StructRNA *srna)
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1074
@ PROP_EDITABLE
Definition RNA_types.hh:376
@ PROP_ID_SELF_CHECK
Definition RNA_types.hh:440
@ PROP_ANIMATABLE
Definition RNA_types.hh:389
@ PROP_LIB_EXCEPTION
Definition RNA_types.hh:382
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
static void rna_def_grease_pencil_layer_mask(BlenderRNA *brna)
void RNA_api_grease_pencil_frames(StructRNA *srna)
static void rna_def_grease_pencil_layer_groups(BlenderRNA *brna, PropertyRNA *cprop)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
PointerRNA RNA_pointer_create_with_parent(const PointerRNA &parent, StructRNA *type, void *data)
void DEG_relations_tag_update(Main *bmain)
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
@ PROP_FACTOR
Definition RNA_types.hh:308
@ PROP_TRANSLATION
Definition RNA_types.hh:318
@ PROP_MATRIX
Definition RNA_types.hh:322
@ PROP_UNSIGNED
Definition RNA_types.hh:306
void rna_iterator_listbase_begin(CollectionPropertyIterator *iter, PointerRNA *ptr, ListBase *lb, IteratorSkipFunc skip)
void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop, const bool allow_replace)
void RNA_def_property_array(PropertyRNA *prop, int length)
const int rna_matrix_dimsize_4x4[]
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
void rna_iterator_array_begin(CollectionPropertyIterator *iter, PointerRNA *ptr, void *data, size_t itemsize, int64_t length, bool free_ptr, IteratorSkipFunc skip)
static void rna_def_grease_pencil_frame(BlenderRNA *brna)
void rna_iterator_listbase_next(CollectionPropertyIterator *iter)
void rna_def_attributes_common(StructRNA *srna, const AttributeOwnerType type)
#define min(a, b)
Definition sort.cc:38
union blender::CollectionPropertyIterator::@041041065315317147142203032351220146061055321205 internal
ListBaseT< GreasePencilLayerTreeNode > children