Blender V5.0
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_define.hh"
17#include "RNA_enum_types.hh"
18
19#include "rna_internal.hh"
20
21#include "WM_api.hh"
22
24 {0,
25 "2D",
26 0,
27 "2D Layers",
28 "Display strokes using Grease Pencil layer order and stroke order to define depth"},
30 "3D",
31 0,
32 "3D Location",
33 "Display strokes using real 3D position in 3D space"},
34 {0, nullptr, 0, nullptr, nullptr},
35};
36
37#ifdef RNA_RUNTIME
38
39# include <fmt/format.h>
40
41# include "BKE_attribute.hh"
42# include "BKE_curves.hh"
43# include "BKE_global.hh"
44# include "BKE_grease_pencil.hh"
45
46# include "BLI_math_matrix.hh"
47# include "BLI_span.hh"
48# include "BLI_string.h"
49
50# include "DEG_depsgraph.hh"
51# include "DEG_depsgraph_build.hh"
52
53# include "ED_grease_pencil.hh"
54
55static GreasePencil *rna_grease_pencil(const PointerRNA *ptr)
56{
57 return reinterpret_cast<GreasePencil *>(ptr->owner_id);
58}
59
60static void rna_grease_pencil_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
61{
62 DEG_id_tag_update(&rna_grease_pencil(ptr)->id, ID_RECALC_GEOMETRY);
63 WM_main_add_notifier(NC_GPENCIL | NA_EDITED, rna_grease_pencil(ptr));
64}
65
66static void rna_grease_pencil_autolock(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
67{
68 using namespace blender::bke::greasepencil;
69 GreasePencil *grease_pencil = rna_grease_pencil(ptr);
70 if (grease_pencil->flag & GREASE_PENCIL_AUTOLOCK_LAYERS) {
71 grease_pencil->autolock_inactive_layers();
72 }
73 else {
74 for (Layer *layer : grease_pencil->layers_for_write()) {
75 layer->set_locked(false);
76 }
77 }
78
79 rna_grease_pencil_update(nullptr, nullptr, ptr);
80}
81
82static void rna_grease_pencil_dependency_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
83{
84 DEG_id_tag_update(&rna_grease_pencil(ptr)->id, ID_RECALC_GEOMETRY);
86 WM_main_add_notifier(NC_GPENCIL | NA_EDITED, rna_grease_pencil(ptr));
87}
88
89static int rna_Drawing_user_count_get(PointerRNA *ptr)
90{
91 using namespace blender::bke::greasepencil;
92 const GreasePencilDrawing *drawing = static_cast<const GreasePencilDrawing *>(ptr->data);
93 return drawing->wrap().user_count();
94}
95
96static int rna_GreasePencilDrawing_curve_offset_data_length(PointerRNA *ptr)
97{
98 const GreasePencilDrawing *drawing = static_cast<GreasePencilDrawing *>(ptr->data);
99 return drawing->geometry.curve_num + 1;
100}
101
102static void rna_GreasePencilDrawing_curve_offset_data_begin(CollectionPropertyIterator *iter,
104{
105 GreasePencilDrawing *drawing = static_cast<GreasePencilDrawing *>(ptr->data);
107 ptr,
108 drawing->geometry.wrap().offsets_for_write().data(),
109 sizeof(int),
110 drawing->geometry.curve_num + 1,
111 false,
112 nullptr);
113}
114
115static bool rna_GreasePencilDrawing_curve_offset_data_lookup_int(PointerRNA *ptr,
116 int index,
117 PointerRNA *r_ptr)
118{
119 GreasePencilDrawing *drawing = static_cast<GreasePencilDrawing *>(ptr->data);
120 if (index < 0 || index >= drawing->geometry.curve_num + 1) {
121 return false;
122 }
124 *ptr, &RNA_IntAttributeValue, &drawing->geometry.wrap().offsets_for_write()[index], *r_ptr);
125 return true;
126}
127
128static void rna_GreasePencilLayer_frames_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
129{
130 using namespace blender::bke::greasepencil;
131 Layer &layer = static_cast<GreasePencilLayer *>(ptr->data)->wrap();
132 blender::Span<FramesMapKeyT> sorted_keys = layer.sorted_keys();
133
135 ptr,
136 (void *)sorted_keys.data(),
137 sizeof(FramesMapKeyT),
138 sorted_keys.size(),
139 false,
140 nullptr);
141}
142
143static PointerRNA rna_GreasePencilLayer_frames_get(CollectionPropertyIterator *iter)
144{
145 using namespace blender::bke::greasepencil;
146 const FramesMapKeyT frame_key = *static_cast<FramesMapKeyT *>(rna_iterator_array_get(iter));
147 const Layer &layer = static_cast<GreasePencilLayer *>(iter->parent.data)->wrap();
148 const GreasePencilFrame *frame = layer.frames().lookup_ptr(frame_key);
150 iter->parent,
151 &RNA_GreasePencilFrame,
152 static_cast<void *>(const_cast<GreasePencilFrame *>(frame)));
153}
154
155static int rna_GreasePencilLayer_frames_length(PointerRNA *ptr)
156{
157 using namespace blender::bke::greasepencil;
158 Layer &layer = static_cast<GreasePencilLayer *>(ptr->data)->wrap();
159 return layer.frames().size();
160}
161
162static bool rna_GreasePencilLayer_frames_lookup_int(PointerRNA *ptr, int index, PointerRNA *r_ptr)
163{
164 using namespace blender::bke::greasepencil;
165 Layer &layer = static_cast<GreasePencilLayer *>(ptr->data)->wrap();
166 if (index < 0 || index >= layer.sorted_keys().size()) {
167 return false;
168 }
169 const FramesMapKeyT frame_key = layer.sorted_keys()[index];
170 const GreasePencilFrame *frame = layer.frames().lookup_ptr(frame_key);
172 &RNA_GreasePencilFrame,
173 static_cast<void *>(const_cast<GreasePencilFrame *>(frame)),
174 *r_ptr);
175 return true;
176}
177
178static std::pair<int, const blender::bke::greasepencil::Layer *> find_layer_of_frame(
179 const GreasePencil &grease_pencil, const GreasePencilFrame &find_frame)
180{
181 using namespace blender::bke::greasepencil;
182 for (const Layer *layer : grease_pencil.layers()) {
183 for (const auto &[key, frame] : layer->frames().items()) {
184 if (&frame == &find_frame) {
185 return {int(key), layer};
186 }
187 }
188 }
189 return {0, nullptr};
190}
191
192static std::pair<int, blender::bke::greasepencil::Layer *> find_layer_of_frame(
193 GreasePencil &grease_pencil, const GreasePencilFrame &find_frame)
194{
195 using namespace blender::bke::greasepencil;
196 for (Layer *layer : grease_pencil.layers_for_write()) {
197 for (const auto &[key, frame] : layer->frames().items()) {
198 if (&frame == &find_frame) {
199 return {int(key), layer};
200 }
201 }
202 }
203 return {0, nullptr};
204}
205
206static PointerRNA rna_Frame_drawing_get(PointerRNA *ptr)
207{
208 using namespace blender::bke::greasepencil;
209 const GreasePencil &grease_pencil = *rna_grease_pencil(ptr);
210 GreasePencilFrame &frame_to_find = *static_cast<GreasePencilFrame *>(ptr->data);
211 if (frame_to_find.is_end()) {
212 return PointerRNA_NULL;
213 }
214
215 /* RNA doesn't give access to the parented layer object, so we have to iterate over all layers
216 * and search for the matching GreasePencilFrame pointer in the frames collection. */
217 auto [frame_number, this_layer] = find_layer_of_frame(grease_pencil, frame_to_find);
218 if (this_layer == nullptr) {
219 return PointerRNA_NULL;
220 }
221
222 const Drawing *drawing = grease_pencil.get_drawing_at(*this_layer, frame_number);
224 *ptr, &RNA_GreasePencilDrawing, static_cast<void *>(const_cast<Drawing *>(drawing)));
225}
226
227static void rna_Frame_drawing_set(PointerRNA *frame_ptr,
228 const PointerRNA drawing_ptr,
229 ReportList * /*reports*/)
230{
231 using namespace blender::bke::greasepencil;
232 GreasePencil &grease_pencil = *rna_grease_pencil(frame_ptr);
233 GreasePencilFrame &frame_to_find = *static_cast<GreasePencilFrame *>(frame_ptr->data);
234 /* It shouldn't be possible for the user to get an PointerRNA to a frame that just marks the end
235 * of another frame. */
236 BLI_assert(!frame_to_find.is_end());
237
238 /* RNA doesn't give access to the parented layer object, so we have to iterate over all layers
239 * and search for the matching GreasePencilFrame pointer in the frames collection. */
240 auto [frame_number, this_layer] = find_layer_of_frame(grease_pencil, frame_to_find);
241 /* Layer should exist. */
242 BLI_assert(this_layer != nullptr);
243
244 Drawing *dst_drawing = grease_pencil.get_drawing_at(*this_layer, frame_number);
245 if (dst_drawing == nullptr) {
246 return;
247 }
248 const Drawing *src_drawing = static_cast<const Drawing *>(drawing_ptr.data);
249 if (src_drawing == nullptr) {
250 /* Clear the drawing. */
251 *dst_drawing = {};
252 }
253 else {
254 *dst_drawing = *src_drawing;
255 }
256}
257
258static int rna_Frame_frame_number_get(PointerRNA *ptr)
259{
260 using namespace blender::bke::greasepencil;
261 const GreasePencil &grease_pencil = *rna_grease_pencil(ptr);
262 GreasePencilFrame &frame_to_find = *static_cast<GreasePencilFrame *>(ptr->data);
263
264 /* RNA doesn't give access to the parented layer object, so we have to iterate over all layers
265 * and search for the matching GreasePencilFrame pointer in the frames collection. */
266 auto [frame_number, this_layer] = find_layer_of_frame(grease_pencil, frame_to_find);
267 /* Layer should exist. */
268 BLI_assert(this_layer != nullptr);
269 return frame_number;
270}
271
272static void rna_grease_pencil_layer_mask_name_get(PointerRNA *ptr, char *dst)
273{
274 using namespace blender;
275 GreasePencilLayerMask *mask = static_cast<GreasePencilLayerMask *>(ptr->data);
276 if (mask->layer_name != nullptr) {
277 strcpy(dst, mask->layer_name);
278 }
279 else {
280 dst[0] = '\0';
281 }
282}
283
284static int rna_grease_pencil_layer_mask_name_length(PointerRNA *ptr)
285{
286 using namespace blender;
287 GreasePencilLayerMask *mask = static_cast<GreasePencilLayerMask *>(ptr->data);
288 if (mask->layer_name != nullptr) {
289 return strlen(mask->layer_name);
290 }
291 return 0;
292}
293
294static void rna_grease_pencil_layer_mask_name_set(PointerRNA *ptr, const char *value)
295{
296 using namespace blender;
297 GreasePencil *grease_pencil = rna_grease_pencil(ptr);
298 GreasePencilLayerMask *mask = static_cast<GreasePencilLayerMask *>(ptr->data);
299
300 const std::string oldname(mask->layer_name);
301 if (bke::greasepencil::TreeNode *node = grease_pencil->find_node_by_name(oldname)) {
302 grease_pencil->rename_node(*G_MAIN, *node, value);
303 }
304}
305
306static int rna_grease_pencil_active_mask_index_get(PointerRNA *ptr)
307{
308 GreasePencilLayer *layer = static_cast<GreasePencilLayer *>(ptr->data);
309 return layer->active_mask_index;
310}
311
312static void rna_grease_pencil_active_mask_index_set(PointerRNA *ptr, int value)
313{
314 GreasePencilLayer *layer = static_cast<GreasePencilLayer *>(ptr->data);
315 layer->active_mask_index = value;
316}
317
318static void rna_grease_pencil_active_mask_index_range(
319 PointerRNA *ptr, int *min, int *max, int * /*softmin*/, int * /*softmax*/)
320{
321 GreasePencilLayer *layer = static_cast<GreasePencilLayer *>(ptr->data);
322 *min = 0;
323 *max = max_ii(0, BLI_listbase_count(&layer->masks) - 1);
324}
325
326static void tree_node_name_get(blender::bke::greasepencil::TreeNode &node, char *dst)
327{
328 if (!node.name().is_empty()) {
329 strcpy(dst, node.name().c_str());
330 }
331 else {
332 dst[0] = '\0';
333 }
334}
335
336static int tree_node_name_length(blender::bke::greasepencil::TreeNode &node)
337{
338 if (!node.name().is_empty()) {
339 return node.name().size();
340 }
341 return 0;
342}
343
344static std::optional<std::string> tree_node_name_path(blender::bke::greasepencil::TreeNode &node,
345 const char *prefix)
346{
347 using namespace blender::bke::greasepencil;
348 BLI_assert(!node.name().is_empty());
349 const size_t name_length = node.name().size();
350 std::string name_esc(name_length * 2, '\0');
351 BLI_str_escape(name_esc.data(), node.name().c_str(), name_length * 2);
352 return fmt::format("{}[\"{}\"]", prefix, name_esc.c_str());
353}
354
355static StructRNA *rna_GreasePencilTreeNode_refine(PointerRNA *ptr)
356{
357 GreasePencilLayerTreeNode *node = static_cast<GreasePencilLayerTreeNode *>(ptr->data);
358 switch (node->type) {
360 return &RNA_GreasePencilLayer;
362 return &RNA_GreasePencilLayerGroup;
363 default:
365 }
366 return nullptr;
367}
368
369static void rna_GreasePencilTreeNode_name_get(PointerRNA *ptr, char *value)
370{
371 GreasePencilLayerTreeNode *node = static_cast<GreasePencilLayerTreeNode *>(ptr->data);
372 tree_node_name_get(node->wrap(), value);
373}
374
375static int rna_GreasePencilTreeNode_name_length(PointerRNA *ptr)
376{
377 GreasePencilLayerTreeNode *node = static_cast<GreasePencilLayerTreeNode *>(ptr->data);
378 return tree_node_name_length(node->wrap());
379}
380
381static void rna_GreasePencilTreeNode_name_set(PointerRNA *ptr, const char *value)
382{
383 GreasePencil *grease_pencil = rna_grease_pencil(ptr);
384 GreasePencilLayerTreeNode *node = static_cast<GreasePencilLayerTreeNode *>(ptr->data);
385
386 grease_pencil->rename_node(*G_MAIN, node->wrap(), value);
387}
388
389static PointerRNA rna_GreasePencilTreeNode_parent_layer_group_get(PointerRNA *ptr)
390{
391 GreasePencil *grease_pencil = rna_grease_pencil(ptr);
392 GreasePencilLayerTreeNode *node = static_cast<GreasePencilLayerTreeNode *>(ptr->data);
393 /* Return 'None' when node is in the root group. This group is not meant to be seen. */
394 if (node->parent == nullptr || node->parent == grease_pencil->root_group_ptr) {
395 return PointerRNA_NULL;
396 }
398 *ptr, &RNA_GreasePencilLayerGroup, static_cast<void *>(node->parent));
399}
400
401static void rna_iterator_grease_pencil_layers_begin(CollectionPropertyIterator *iter,
403{
404 using namespace blender::bke::greasepencil;
405 GreasePencil *grease_pencil = rna_grease_pencil(ptr);
406 const blender::Span<const Layer *> layers = grease_pencil->layers();
407
408 iter->internal.count.item = 0;
409 iter->valid = !layers.is_empty();
410}
411
412static void rna_iterator_grease_pencil_layers_next(CollectionPropertyIterator *iter)
413{
414 using namespace blender::bke::greasepencil;
415 GreasePencil *grease_pencil = static_cast<GreasePencil *>(iter->parent.data);
416 const blender::Span<const Layer *> layers = grease_pencil->layers();
417
418 iter->internal.count.item++;
419 iter->valid = layers.index_range().contains(iter->internal.count.item);
420}
421
422static PointerRNA rna_iterator_grease_pencil_layers_get(CollectionPropertyIterator *iter)
423{
424 using namespace blender::bke::greasepencil;
425 GreasePencil *grease_pencil = static_cast<GreasePencil *>(iter->parent.data);
426 blender::Span<Layer *> layers = grease_pencil->layers_for_write();
427
429 &RNA_GreasePencilLayer,
430 static_cast<void *>(layers[iter->internal.count.item]));
431}
432
433static int rna_iterator_grease_pencil_layers_length(PointerRNA *ptr)
434{
435 GreasePencil *grease_pencil = rna_grease_pencil(ptr);
436 return grease_pencil->layers().size();
437}
438
439static std::optional<std::string> rna_GreasePencilLayer_path(const PointerRNA *ptr)
440{
441 GreasePencilLayer *layer = static_cast<GreasePencilLayer *>(ptr->data);
442 return tree_node_name_path(layer->wrap().as_node(), "layers");
443}
444
445static int rna_GreasePencilLayer_pass_index_get(PointerRNA *ptr)
446{
447 using namespace blender;
448 const GreasePencil &grease_pencil = *rna_grease_pencil(ptr);
449 const bke::greasepencil::Layer &layer =
450 static_cast<const GreasePencilLayer *>(ptr->data)->wrap();
451 const int layer_idx = *grease_pencil.get_layer_index(layer);
452
453 const VArray layer_passes = *grease_pencil.attributes().lookup_or_default<int>(
454 "pass_index", bke::AttrDomain::Layer, 0);
455 return layer_passes[layer_idx];
456}
457
458static void rna_GreasePencilLayer_pass_index_set(PointerRNA *ptr, int value)
459{
460 using namespace blender;
461 GreasePencil &grease_pencil = *rna_grease_pencil(ptr);
462 const bke::greasepencil::Layer &layer =
463 static_cast<const GreasePencilLayer *>(ptr->data)->wrap();
464 const int layer_idx = *grease_pencil.get_layer_index(layer);
465
466 if (bke::SpanAttributeWriter<int> layer_passes =
467 grease_pencil.attributes_for_write().lookup_or_add_for_write_span<int>(
468 "pass_index", bke::AttrDomain::Layer))
469 {
470 layer_passes.span[layer_idx] = std::max(0, value);
471 layer_passes.finish();
472 }
473}
474
475static void rna_GreasePencilLayer_parent_set(PointerRNA *ptr,
476 PointerRNA value,
477 ReportList * /*reports*/)
478{
479 using namespace blender;
480 bke::greasepencil::Layer &layer = static_cast<GreasePencilLayer *>(ptr->data)->wrap();
481 Object *parent = static_cast<Object *>(value.data);
482
484}
485
486static void rna_GreasePencilLayer_bone_set(PointerRNA *ptr, const char *value)
487{
488 using namespace blender;
489 bke::greasepencil::Layer &layer = static_cast<GreasePencilLayer *>(ptr->data)->wrap();
490
492}
493
494static void rna_GreasePencilLayer_tint_color_get(PointerRNA *ptr, float *values)
495{
496 using namespace blender;
497 const GreasePencil &grease_pencil = *rna_grease_pencil(ptr);
498 const bke::greasepencil::Layer &layer =
499 static_cast<const GreasePencilLayer *>(ptr->data)->wrap();
500 const int layer_idx = *grease_pencil.get_layer_index(layer);
501
502 const VArray tint_colors = *grease_pencil.attributes().lookup_or_default<ColorGeometry4f>(
503 "tint_color", bke::AttrDomain::Layer, ColorGeometry4f(0.0f, 0.0f, 0.0f, 0.0f));
504 copy_v3_v3(values, tint_colors[layer_idx]);
505}
506
507static void rna_GreasePencilLayer_tint_color_set(PointerRNA *ptr, const float *values)
508{
509 using namespace blender;
510 GreasePencil &grease_pencil = *rna_grease_pencil(ptr);
511 const bke::greasepencil::Layer &layer =
512 static_cast<const GreasePencilLayer *>(ptr->data)->wrap();
513 const int layer_idx = *grease_pencil.get_layer_index(layer);
514
516 grease_pencil.attributes_for_write().lookup_or_add_for_write_span<ColorGeometry4f>(
517 "tint_color",
520 ColorGeometry4f(0.0f, 0.0f, 0.0f, 0.0f), grease_pencil.layers().size()))))
521 {
522 copy_v3_v3(tint_colors.span[layer_idx], values);
523 tint_colors.finish();
524 }
525}
526
527static float rna_GreasePencilLayer_tint_factor_get(PointerRNA *ptr)
528{
529 using namespace blender;
530 const GreasePencil &grease_pencil = *rna_grease_pencil(ptr);
531 const bke::greasepencil::Layer &layer =
532 static_cast<const GreasePencilLayer *>(ptr->data)->wrap();
533 const int layer_idx = *grease_pencil.get_layer_index(layer);
534
535 const VArray tint_colors = *grease_pencil.attributes().lookup_or_default<ColorGeometry4f>(
536 "tint_color", bke::AttrDomain::Layer, ColorGeometry4f(0.0f, 0.0f, 0.0f, 0.0f));
537 return tint_colors[layer_idx][3];
538}
539
540static void rna_GreasePencilLayer_tint_factor_set(PointerRNA *ptr, const float value)
541{
542 using namespace blender;
543 GreasePencil &grease_pencil = *rna_grease_pencil(ptr);
544 const bke::greasepencil::Layer &layer =
545 static_cast<const GreasePencilLayer *>(ptr->data)->wrap();
546 const int layer_idx = *grease_pencil.get_layer_index(layer);
547
549 grease_pencil.attributes_for_write().lookup_or_add_for_write_span<ColorGeometry4f>(
550 "tint_color",
553 ColorGeometry4f(0.0f, 0.0f, 0.0f, 0.0f), grease_pencil.layers().size()))))
554 {
555 tint_colors.span[layer_idx][3] = value;
556 tint_colors.finish();
557 }
558}
559
560static float rna_GreasePencilLayer_radius_offset_get(PointerRNA *ptr)
561{
562 using namespace blender;
563 const GreasePencil &grease_pencil = *rna_grease_pencil(ptr);
564 const bke::greasepencil::Layer &layer =
565 static_cast<const GreasePencilLayer *>(ptr->data)->wrap();
566 const int layer_idx = *grease_pencil.get_layer_index(layer);
567
568 const VArray radius_offsets = *grease_pencil.attributes().lookup_or_default<float>(
569 "radius_offset", bke::AttrDomain::Layer, 0.0f);
570 return radius_offsets[layer_idx];
571}
572
573static void rna_GreasePencilLayer_radius_offset_set(PointerRNA *ptr, const float value)
574{
575 using namespace blender;
576 GreasePencil &grease_pencil = *rna_grease_pencil(ptr);
577 const bke::greasepencil::Layer &layer =
578 static_cast<const GreasePencilLayer *>(ptr->data)->wrap();
579 const int layer_idx = *grease_pencil.get_layer_index(layer);
580
581 if (bke::SpanAttributeWriter<float> radius_offsets =
582 grease_pencil.attributes_for_write().lookup_or_add_for_write_span<float>(
583 "radius_offset",
586 VArray<float>::from_single(0.0f, grease_pencil.layers().size()))))
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 PointerRNA_NULL;
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<blender::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 PointerRNA_NULL;
634}
635
636static void rna_GreasePencil_active_group_set(PointerRNA *ptr,
637 PointerRNA value,
638 ReportList * /*reports*/)
639{
640 using namespace blender::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_iterator_grease_pencil_layer_groups_begin(CollectionPropertyIterator *iter,
663{
664 using namespace blender::bke::greasepencil;
665 GreasePencil *grease_pencil = rna_grease_pencil(ptr);
666 const blender::Span<const LayerGroup *> groups = grease_pencil->layer_groups();
667
668 iter->internal.count.item = 0;
669 iter->valid = !groups.is_empty();
670}
671
672static void rna_iterator_grease_pencil_layer_groups_next(CollectionPropertyIterator *iter)
673{
674 using namespace blender::bke::greasepencil;
675 GreasePencil *grease_pencil = static_cast<GreasePencil *>(iter->parent.data);
676 const blender::Span<const LayerGroup *> groups = grease_pencil->layer_groups();
677
678 iter->internal.count.item++;
679 iter->valid = groups.index_range().contains(iter->internal.count.item);
680}
681
682static PointerRNA rna_iterator_grease_pencil_layer_groups_get(CollectionPropertyIterator *iter)
683{
684 using namespace blender::bke::greasepencil;
685 GreasePencil *grease_pencil = static_cast<GreasePencil *>(iter->parent.data);
686 blender::Span<LayerGroup *> groups = grease_pencil->layer_groups_for_write();
687
689 &RNA_GreasePencilLayerGroup,
690 static_cast<void *>(groups[iter->internal.count.item]));
691}
692
693static int rna_iterator_grease_pencil_layer_groups_length(PointerRNA *ptr)
694{
695 GreasePencil *grease_pencil = rna_grease_pencil(ptr);
696 return grease_pencil->layer_groups().size();
697}
698
699static int rna_group_color_tag_get(PointerRNA *ptr)
700{
701 using namespace blender::bke::greasepencil;
702 GreasePencilLayerTreeGroup *group = static_cast<GreasePencilLayerTreeGroup *>(ptr->data);
703 return group->color_tag;
704}
705
706static void rna_group_color_tag_set(PointerRNA *ptr, int value)
707{
708 GreasePencilLayerTreeGroup *group = static_cast<GreasePencilLayerTreeGroup *>(ptr->data);
709 group->color_tag = value;
711}
712
713#else
714
716{
717 StructRNA *srna;
718 PropertyRNA *prop;
719
720 static const EnumPropertyItem rna_enum_drawing_type_items[] = {
721 {GP_DRAWING, "DRAWING", 0, "Drawing", ""},
722 {GP_DRAWING_REFERENCE, "REFERENCE", 0, "Reference", ""},
723 {0, nullptr, 0, nullptr, nullptr}};
724
725 srna = RNA_def_struct(brna, "GreasePencilDrawing", nullptr);
726 RNA_def_struct_sdna(srna, "GreasePencilDrawing");
727 RNA_def_struct_ui_text(srna, "Grease Pencil Drawing", "A Grease Pencil drawing");
728
729 /* Type. */
730 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
731 RNA_def_property_enum_sdna(prop, nullptr, "base.type");
732 RNA_def_property_enum_items(prop, rna_enum_drawing_type_items);
734 RNA_def_property_ui_text(prop, "Type", "Drawing type");
735 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
736
737 /* User Count. */
738 prop = RNA_def_property(srna, "user_count", PROP_INT, PROP_NONE);
739 RNA_def_property_int_funcs(prop, "rna_Drawing_user_count_get", nullptr, nullptr);
741 RNA_def_property_ui_text(prop, "User Count", "The number of keyframes this drawing is used by");
742 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
743
744 /* Curve offsets. */
745 prop = RNA_def_property(srna, "curve_offsets", PROP_COLLECTION, PROP_NONE);
746 RNA_def_property_struct_type(prop, "IntAttributeValue");
749 "rna_GreasePencilDrawing_curve_offset_data_begin",
750 "rna_iterator_array_next",
751 "rna_iterator_array_end",
752 "rna_iterator_array_get",
753 "rna_GreasePencilDrawing_curve_offset_data_length",
754 "rna_GreasePencilDrawing_curve_offset_data_lookup_int",
755 nullptr,
756 nullptr);
759 prop, "Curve Offsets", "Offset indices of the first point of each curve");
760 RNA_def_property_update(prop, 0, "rna_grease_pencil_update");
761
763
764 /* Attributes. */
766}
767
769{
770 StructRNA *srna;
771 PropertyRNA *prop;
772
773 static const EnumPropertyItem rna_enum_keyframe_type_items[] = {
775 "KEYFRAME",
776 ICON_KEYTYPE_KEYFRAME_VEC,
777 "Keyframe",
778 "Normal keyframe, e.g. for key poses"},
780 "BREAKDOWN",
781 ICON_KEYTYPE_BREAKDOWN_VEC,
782 "Breakdown",
783 "A breakdown pose, e.g. for transitions between key poses"},
785 "MOVING_HOLD",
786 ICON_KEYTYPE_MOVING_HOLD_VEC,
787 "Moving Hold",
788 "A keyframe that is part of a moving hold"},
790 "EXTREME",
791 ICON_KEYTYPE_EXTREME_VEC,
792 "Extreme",
793 "An 'extreme' pose, or some other purpose as needed"},
795 "JITTER",
796 ICON_KEYTYPE_JITTER_VEC,
797 "Jitter",
798 "A filler or baked keyframe for keying on ones, or some other purpose as needed"},
800 "GENERATED",
801 ICON_KEYTYPE_GENERATED_VEC,
802 "Generated",
803 "A key generated automatically by a tool, not manually created"},
804 {0, nullptr, 0, nullptr, nullptr},
805 };
806
807 srna = RNA_def_struct(brna, "GreasePencilFrame", nullptr);
808 RNA_def_struct_sdna(srna, "GreasePencilFrame");
809 RNA_def_struct_ui_text(srna, "Grease Pencil Frame", "A Grease Pencil keyframe");
810
811 /* Drawing. */
812 prop = RNA_def_property(srna, "drawing", PROP_POINTER, PROP_NONE);
813 RNA_def_property_struct_type(prop, "GreasePencilDrawing");
815 prop, "rna_Frame_drawing_get", "rna_Frame_drawing_set", nullptr, nullptr);
817 RNA_def_property_ui_text(prop, "Drawing", "A Grease Pencil drawing");
818 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
819
820 /* Frame number. */
821 prop = RNA_def_property(srna, "frame_number", PROP_INT, PROP_NONE);
822 /* TODO: Make property editable, ensure frame number isn't already in use. */
824 RNA_def_property_int_funcs(prop, "rna_Frame_frame_number_get", nullptr, nullptr);
826 RNA_def_property_ui_text(prop, "Frame Number", "The frame number in the scene");
827 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
828
829 /* Selection status. */
830 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
831 RNA_def_property_boolean_sdna(prop, nullptr, "flag", GP_FRAME_SELECTED);
832 RNA_def_property_ui_text(prop, "Select", "Frame Selection in the Dope Sheet");
833 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
834
835 /* Keyframe type. */
836 prop = RNA_def_property(srna, "keyframe_type", PROP_ENUM, PROP_NONE);
837 RNA_def_property_enum_sdna(prop, nullptr, "type");
839 RNA_def_property_enum_items(prop, rna_enum_keyframe_type_items);
840 RNA_def_property_ui_text(prop, "Keyframe Type", "Type of keyframe");
842 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
843}
844
846{
847 StructRNA *srna;
848
849 RNA_def_property_srna(cprop, "GreasePencilFrames");
850 srna = RNA_def_struct(brna, "GreasePencilFrames", nullptr);
851 RNA_def_struct_sdna(srna, "GreasePencilLayer");
852 RNA_def_struct_ui_text(srna, "Grease Pencil Frames", "Collection of Grease Pencil frames");
853
855}
856
858{
859 StructRNA *srna;
860 PropertyRNA *prop;
861
862 srna = RNA_def_struct(brna, "GreasePencilLayerMask", nullptr);
863 RNA_def_struct_sdna(srna, "GreasePencilLayerMask");
864 RNA_def_struct_ui_text(srna, "Grease Pencil Masking Layers", "List of Mask Layers");
865 // RNA_def_struct_path_func(srna, "rna_GreasePencilLayerMask_path");
866
867 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
868 RNA_def_property_ui_text(prop, "Layer", "Mask layer name");
869 RNA_def_property_string_sdna(prop, nullptr, "layer_name");
871 "rna_grease_pencil_layer_mask_name_get",
872 "rna_grease_pencil_layer_mask_name_length",
873 "rna_grease_pencil_layer_mask_name_set");
877
878 prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
880 RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
881 RNA_def_property_ui_text(prop, "Hide", "Set mask Visibility");
882 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
883
884 prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
886 RNA_def_property_ui_icon(prop, ICON_SELECT_INTERSECT, 1);
887 RNA_def_property_ui_text(prop, "Invert", "Invert mask");
888 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
889}
890
892{
893 StructRNA *srna;
894 PropertyRNA *prop;
895
896 RNA_def_property_srna(cprop, "GreasePencilLayerMasks");
897 srna = RNA_def_struct(brna, "GreasePencilLayerMasks", nullptr);
898 RNA_def_struct_sdna(srna, "GreasePencilLayer");
900 srna, "Grease Pencil Mask Layers", "Collection of Grease Pencil masking layers");
901
902 prop = RNA_def_property(srna, "active_mask_index", PROP_INT, PROP_UNSIGNED);
905 "rna_grease_pencil_active_mask_index_get",
906 "rna_grease_pencil_active_mask_index_set",
907 "rna_grease_pencil_active_mask_index_range");
908 RNA_def_property_ui_text(prop, "Active Layer Mask Index", "Active index in layer mask array");
909}
910
912{
913 StructRNA *srna;
914 PropertyRNA *prop;
915
916 srna = RNA_def_struct(brna, "GreasePencilTreeNode", nullptr);
918 srna, "Tree Node", "Grease Pencil node in the layer tree. Either a layer or a group");
919 RNA_def_struct_sdna(srna, "GreasePencilLayerTreeNode");
920 RNA_def_struct_refine_func(srna, "rna_GreasePencilTreeNode_refine");
921
922 /* Name. */
923 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
924 RNA_def_property_ui_text(prop, "Name", "The name of the tree node");
926 "rna_GreasePencilTreeNode_name_get",
927 "rna_GreasePencilTreeNode_name_length",
928 "rna_GreasePencilTreeNode_name_set");
930 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | NA_RENAME, "rna_grease_pencil_update");
931
932 /* Visibility. */
933 prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
935 RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
936 RNA_def_property_ui_text(prop, "Hide", "Set tree node visibility");
937 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
938
939 /* Lock. */
940 prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
942 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
943 RNA_def_property_ui_text(prop, "Locked", "Protect tree node from editing");
944 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
945
946 /* Select. */
947 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
949 RNA_def_property_ui_text(prop, "Select", "Tree node is selected");
950 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
951
952 /* Onion Skinning. */
953 prop = RNA_def_property(srna, "use_onion_skinning", PROP_BOOLEAN, PROP_NONE);
954 RNA_def_property_ui_icon(prop, ICON_ONIONSKIN_OFF, 1);
956 prop, nullptr, "flag", GP_LAYER_TREE_NODE_HIDE_ONION_SKINNING);
958 prop, "Onion Skinning", "Display onion skins before and after the current frame");
959 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
960
961 /* Use Masks. */
962 prop = RNA_def_property(srna, "use_masks", PROP_BOOLEAN, PROP_NONE);
963 RNA_def_property_ui_icon(prop, ICON_CLIPUV_HLT, -1);
966 prop,
967 "Use Masks",
968 "The visibility of drawings in this tree node is affected by the layers in the masks list");
969 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
970
971 /* Channel color. */
972 prop = RNA_def_property(srna, "channel_color", PROP_FLOAT, PROP_COLOR);
973 RNA_def_property_float_sdna(prop, nullptr, "color");
974 RNA_def_property_array(prop, 3);
975 RNA_def_property_ui_text(prop, "Channel Color", "Color of the channel in the dope sheet");
977
978 /* Next tree node. */
979 prop = RNA_def_property(srna, "next_node", PROP_POINTER, PROP_NONE);
980 RNA_def_property_pointer_sdna(prop, nullptr, "next");
981 RNA_def_property_struct_type(prop, "GreasePencilTreeNode");
982 RNA_def_property_ui_text(prop, "Next Node", "The layer tree node after (i.e. above) this one");
985
986 /* Previous tree node. */
987 prop = RNA_def_property(srna, "prev_node", PROP_POINTER, PROP_NONE);
988 RNA_def_property_pointer_sdna(prop, nullptr, "prev");
989 RNA_def_property_struct_type(prop, "GreasePencilTreeNode");
991 prop, "Previous Node", "The layer tree node before (i.e. below) this one");
994
995 /* Parent group. */
996 prop = RNA_def_property(srna, "parent_group", PROP_POINTER, PROP_NONE);
997 RNA_def_property_struct_type(prop, "GreasePencilLayerGroup");
999 prop, "rna_GreasePencilTreeNode_parent_layer_group_get", nullptr, nullptr, nullptr);
1000 RNA_def_property_ui_text(prop, "Parent Layer Group", "The parent group of this layer tree node");
1003}
1004
1006{
1007 StructRNA *srna;
1008 PropertyRNA *prop;
1009
1010 static const float scale_defaults[3] = {1.0f, 1.0f, 1.0f};
1011
1012 static const EnumPropertyItem rna_enum_layer_blend_modes_items[] = {
1013 {GP_LAYER_BLEND_NONE, "REGULAR", 0, "Regular", ""},
1014 {GP_LAYER_BLEND_HARDLIGHT, "HARDLIGHT", 0, "Hard Light", ""},
1015 {GP_LAYER_BLEND_ADD, "ADD", 0, "Add", ""},
1016 {GP_LAYER_BLEND_SUBTRACT, "SUBTRACT", 0, "Subtract", ""},
1017 {GP_LAYER_BLEND_MULTIPLY, "MULTIPLY", 0, "Multiply", ""},
1018 {GP_LAYER_BLEND_DIVIDE, "DIVIDE", 0, "Divide", ""},
1019 {0, nullptr, 0, nullptr, nullptr}};
1020
1021 srna = RNA_def_struct(brna, "GreasePencilLayer", "GreasePencilTreeNode");
1022 RNA_def_struct_sdna(srna, "GreasePencilLayer");
1023 RNA_def_struct_ui_text(srna, "Grease Pencil Layer", "Collection of related drawings");
1024 RNA_def_struct_path_func(srna, "rna_GreasePencilLayer_path");
1025
1026 /* Frames. */
1027 prop = RNA_def_property(srna, "frames", PROP_COLLECTION, PROP_NONE);
1028 RNA_def_property_struct_type(prop, "GreasePencilFrame");
1029 RNA_def_property_ui_text(prop, "Frames", "Grease Pencil frames");
1031 "rna_GreasePencilLayer_frames_begin",
1032 "rna_iterator_array_next",
1033 "rna_iterator_array_end",
1034 "rna_GreasePencilLayer_frames_get",
1035 "rna_GreasePencilLayer_frames_length",
1036 "rna_GreasePencilLayer_frames_lookup_int",
1037 nullptr,
1038 nullptr);
1039 rna_def_grease_pencil_frames(brna, prop);
1040
1041 /* Mask Layers */
1042 prop = RNA_def_property(srna, "mask_layers", PROP_COLLECTION, PROP_NONE);
1043 RNA_def_property_collection_sdna(prop, nullptr, "masks", nullptr);
1044 RNA_def_property_struct_type(prop, "GreasePencilLayerMask");
1045 RNA_def_property_ui_text(prop, "Masks", "List of Masking Layers");
1047
1048 /* Lock Frame. */
1049 prop = RNA_def_property(srna, "lock_frame", PROP_BOOLEAN, PROP_NONE);
1051 prop, "GreasePencilLayerTreeNode", "flag", GP_LAYER_TREE_NODE_MUTE);
1052 RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
1054 RNA_def_property_ui_text(prop, "Frame Locked", "Lock current frame displayed by layer");
1055 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1056
1057 /* Opacity */
1058 prop = RNA_def_property(srna, "opacity", PROP_FLOAT, PROP_FACTOR);
1059 RNA_def_property_float_sdna(prop, "GreasePencilLayer", "opacity");
1060 RNA_def_property_ui_text(prop, "Opacity", "Layer Opacity");
1061 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1062
1063 /* Tint Color. */
1064 prop = RNA_def_property(srna, "tint_color", PROP_FLOAT, PROP_COLOR);
1065 RNA_def_property_array(prop, 3);
1067 "rna_GreasePencilLayer_tint_color_get",
1068 "rna_GreasePencilLayer_tint_color_set",
1069 nullptr);
1070 RNA_def_property_range(prop, 0.0f, 1.0f);
1071 RNA_def_property_ui_text(prop, "Tint Color", "Color for tinting stroke colors");
1072 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1073
1074 /* Tint Factor. */
1075 prop = RNA_def_property(srna, "tint_factor", PROP_FLOAT, PROP_FACTOR);
1077 "rna_GreasePencilLayer_tint_factor_get",
1078 "rna_GreasePencilLayer_tint_factor_set",
1079 nullptr);
1080 RNA_def_property_range(prop, 0.0f, 1.0f);
1081 RNA_def_property_ui_text(prop, "Tint Factor", "Factor of tinting color");
1082 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1083
1084 /* Radius Offset. */
1085 prop = RNA_def_property(srna, "radius_offset", PROP_FLOAT, PROP_TRANSLATION);
1087 "rna_GreasePencilLayer_radius_offset_get",
1088 "rna_GreasePencilLayer_radius_offset_set",
1089 nullptr);
1091 RNA_def_property_ui_text(prop, "Radius Offset", "Radius change to apply to current strokes");
1092 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1093
1094 prop = RNA_def_property(srna, "use_lights", PROP_BOOLEAN, PROP_NONE);
1096 prop, "GreasePencilLayerTreeNode", "flag", GP_LAYER_TREE_NODE_USE_LIGHTS);
1098 prop, "Use Lights", "Enable the use of lights on stroke and fill materials");
1099 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1100
1101 /* pass index for compositing and modifiers */
1102 prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
1103 RNA_def_property_ui_text(prop, "Pass Index", "Index number for the \"Layer Index\" pass");
1105 "rna_GreasePencilLayer_pass_index_get",
1106 "rna_GreasePencilLayer_pass_index_set",
1107 nullptr);
1108 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1109
1110 prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
1111 RNA_def_property_struct_type(prop, "Object");
1113 prop, nullptr, "rna_GreasePencilLayer_parent_set", nullptr, nullptr);
1116 RNA_def_property_ui_text(prop, "Parent", "Parent object");
1117 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_dependency_update");
1118
1119 prop = RNA_def_property(srna, "parent_bone", PROP_STRING, PROP_NONE);
1120 RNA_def_property_string_sdna(prop, nullptr, "parsubstr");
1121 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_GreasePencilLayer_bone_set");
1123 prop,
1124 "Parent Bone",
1125 "Name of parent bone. Only used when the parent object is an armature.");
1126 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_dependency_update");
1127
1128 prop = RNA_def_property(srna, "translation", PROP_FLOAT, PROP_TRANSLATION);
1129 RNA_def_property_array(prop, 3);
1130 RNA_def_property_float_sdna(prop, nullptr, "translation");
1132 RNA_def_property_ui_text(prop, "Translation", "Translation of the layer");
1133 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1134
1135 prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER);
1136 RNA_def_property_array(prop, 3);
1137 RNA_def_property_float_sdna(prop, nullptr, "rotation");
1139 RNA_def_property_ui_text(prop, "Rotation", "Euler rotation of the layer");
1140 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1141
1142 prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
1143 RNA_def_property_array(prop, 3);
1144 RNA_def_property_float_sdna(prop, nullptr, "scale");
1145 RNA_def_property_float_array_default(prop, scale_defaults);
1147 RNA_def_property_ui_text(prop, "Scale", "Scale of the layer");
1148 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1149
1150 prop = RNA_def_property(srna, "viewlayer_render", PROP_STRING, PROP_NONE);
1151 RNA_def_property_string_sdna(prop, nullptr, "viewlayername");
1153 prop,
1154 "ViewLayer",
1155 "Only include Layer in this View Layer render output (leave blank to include always)");
1156
1157 prop = RNA_def_property(srna, "use_viewlayer_masks", PROP_BOOLEAN, PROP_NONE);
1159 prop, "GreasePencilLayerTreeNode", "flag", GP_LAYER_TREE_NODE_DISABLE_MASKS_IN_VIEWLAYER);
1161 prop, "Use Masks in Render", "Include the mask layers when rendering the view-layer");
1162 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1163
1164 prop = RNA_def_property(srna, "blend_mode", PROP_ENUM, PROP_NONE);
1165 RNA_def_property_enum_sdna(prop, nullptr, "blend_mode");
1166 RNA_def_property_enum_items(prop, rna_enum_layer_blend_modes_items);
1167 RNA_def_property_ui_text(prop, "Blend Mode", "Blend mode");
1168 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1169
1170 prop = RNA_def_property(srna, "ignore_locked_materials", PROP_BOOLEAN, PROP_NONE);
1172 prop, "GreasePencilLayerTreeNode", "flag", GP_LAYER_TREE_NODE_IGNORE_LOCKED_MATERIALS);
1175 prop, "Ignore Material Locking", "Allow editing strokes even if they use locked materials");
1176 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, nullptr);
1177 /* Local transformation matrix. */
1178 prop = RNA_def_property(srna, "matrix_local", PROP_FLOAT, PROP_MATRIX);
1181 RNA_def_property_ui_text(prop, "Local Matrix", "Local transformation matrix of the layer");
1182 RNA_def_property_float_funcs(prop, "rna_GreasePencilLayer_matrix_local_get", nullptr, nullptr);
1183 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1184
1185 /* Inverse transform of layer's parent. */
1186 prop = RNA_def_property(srna, "matrix_parent_inverse", PROP_FLOAT, PROP_MATRIX);
1190 prop, "Inverse Parent Matrix", "Inverse of layer's parent transformation matrix");
1192 prop, "rna_GreasePencilLayer_matrix_parent_inverse_get", nullptr, nullptr);
1193
1195}
1196
1198{
1199 StructRNA *srna;
1200 PropertyRNA *prop;
1201
1202 RNA_def_property_srna(cprop, "GreasePencilv3Layers");
1203 srna = RNA_def_struct(brna, "GreasePencilv3Layers", nullptr);
1204 RNA_def_struct_sdna(srna, "GreasePencil");
1205 RNA_def_struct_ui_text(srna, "Grease Pencil Layers", "Collection of Grease Pencil layers");
1206
1207 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
1208 RNA_def_property_struct_type(prop, "GreasePencilLayer");
1210 "rna_GreasePencil_active_layer_get",
1211 "rna_GreasePencil_active_layer_set",
1212 nullptr,
1213 nullptr);
1215 RNA_def_property_ui_text(prop, "Active Layer", "Active Grease Pencil layer");
1217
1219}
1220
1222 {LAYERGROUP_COLOR_NONE, "NONE", ICON_X, "Reset color tag", ""},
1223 {LAYERGROUP_COLOR_01, "COLOR1", ICON_LAYERGROUP_COLOR_01, "Color tag 1", ""},
1224 {LAYERGROUP_COLOR_02, "COLOR2", ICON_LAYERGROUP_COLOR_02, "Color tag 2", ""},
1225 {LAYERGROUP_COLOR_03, "COLOR3", ICON_LAYERGROUP_COLOR_03, "Color tag 3", ""},
1226 {LAYERGROUP_COLOR_04, "COLOR4", ICON_LAYERGROUP_COLOR_04, "Color tag 4", ""},
1227 {LAYERGROUP_COLOR_05, "COLOR5", ICON_LAYERGROUP_COLOR_05, "Color tag 5", ""},
1228 {LAYERGROUP_COLOR_06, "COLOR6", ICON_LAYERGROUP_COLOR_06, "Color tag 6", ""},
1229 {LAYERGROUP_COLOR_07, "COLOR7", ICON_LAYERGROUP_COLOR_07, "Color tag 7", ""},
1230 {LAYERGROUP_COLOR_08, "COLOR8", ICON_LAYERGROUP_COLOR_08, "Color tag 8", ""},
1231 {0, nullptr, 0, nullptr, nullptr},
1232};
1233
1235{
1236 StructRNA *srna;
1237 PropertyRNA *prop;
1238
1239 srna = RNA_def_struct(brna, "GreasePencilLayerGroup", "GreasePencilTreeNode");
1240 RNA_def_struct_sdna(srna, "GreasePencilLayerTreeGroup");
1241 RNA_def_struct_ui_text(srna, "Grease Pencil Layer Group", "Group of Grease Pencil layers");
1242 RNA_def_struct_path_func(srna, "rna_GreasePencilLayerGroup_path");
1243
1244 /* Expanded */
1245 prop = RNA_def_property(srna, "is_expanded", PROP_BOOLEAN, PROP_NONE);
1247 prop, "GreasePencilLayerTreeNode", "flag", GP_LAYER_TREE_NODE_EXPANDED);
1248 RNA_def_property_ui_text(prop, "Expanded", "The layer group is expanded in the UI");
1251 RNA_def_property_boolean_funcs(prop, nullptr, "rna_GreasePencilLayerGroup_is_expanded_set");
1252 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1253
1254 /* Color tag. */
1255 prop = RNA_def_property(srna, "color_tag", PROP_ENUM, PROP_NONE);
1256 RNA_def_property_enum_funcs(prop, "rna_group_color_tag_get", "rna_group_color_tag_set", nullptr);
1258}
1259
1261{
1262 StructRNA *srna;
1263 PropertyRNA *prop;
1264
1265 RNA_def_property_srna(cprop, "GreasePencilv3LayerGroup");
1266 srna = RNA_def_struct(brna, "GreasePencilv3LayerGroup", nullptr);
1267 RNA_def_struct_sdna(srna, "GreasePencil");
1268 RNA_def_struct_ui_text(srna, "Grease Pencil Group", "Collection of Grease Pencil layers");
1269
1270 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
1271 RNA_def_property_struct_type(prop, "GreasePencilLayerGroup");
1273 "rna_GreasePencil_active_group_get",
1274 "rna_GreasePencil_active_group_set",
1275 nullptr,
1276 nullptr);
1278 RNA_def_property_ui_text(prop, "Active Layer Group", "Active Grease Pencil layer group");
1280
1282}
1283
1285{
1286 PropertyRNA *prop;
1287
1288 static const EnumPropertyItem prop_enum_onion_modes_items[] = {
1290 "ABSOLUTE",
1291 0,
1292 "Frames",
1293 "Frames in absolute range of the scene frame"},
1295 "RELATIVE",
1296 0,
1297 "Keyframes",
1298 "Frames in relative range of the Grease Pencil keyframes"},
1299 {GP_ONION_SKINNING_MODE_SELECTED, "SELECTED", 0, "Selected", "Only selected keyframes"},
1300 {0, nullptr, 0, nullptr, nullptr},
1301 };
1302
1303 static const EnumPropertyItem prop_enum_onion_keyframe_type_items[] = {
1304 {GREASE_PENCIL_ONION_SKINNING_FILTER_ALL, "ALL", 0, "All", "Include all Keyframe types"},
1306 "KEYFRAME",
1307 ICON_KEYTYPE_KEYFRAME_VEC,
1308 "Keyframe",
1309 "Normal keyframe, e.g. for key poses"},
1311 "BREAKDOWN",
1312 ICON_KEYTYPE_BREAKDOWN_VEC,
1313 "Breakdown",
1314 "A breakdown pose, e.g. for transitions between key poses"},
1316 "MOVING_HOLD",
1317 ICON_KEYTYPE_MOVING_HOLD_VEC,
1318 "Moving Hold",
1319 "A keyframe that is part of a moving hold"},
1321 "EXTREME",
1322 ICON_KEYTYPE_EXTREME_VEC,
1323 "Extreme",
1324 "An 'extreme' pose, or some other purpose as needed"},
1326 "JITTER",
1327 ICON_KEYTYPE_JITTER_VEC,
1328 "Jitter",
1329 "A filler or baked keyframe for keying on ones, or some other purpose as needed"},
1331 "GENERATED",
1332 ICON_KEYTYPE_GENERATED_VEC,
1333 "Generated",
1334 "A key generated automatically by a tool, not manually created"},
1335 {0, nullptr, 0, nullptr, nullptr},
1336 };
1337
1338 prop = RNA_def_property(srna, "ghost_before_range", PROP_INT, PROP_NONE);
1339 RNA_def_property_int_sdna(prop, nullptr, "onion_skinning_settings.num_frames_before");
1340 RNA_def_property_range(prop, 0, 120);
1343 "Frames Before",
1344 "Maximum number of frames to show before current frame "
1345 "(0 = don't show any frames before current)");
1346 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1347
1348 prop = RNA_def_property(srna, "ghost_after_range", PROP_INT, PROP_NONE);
1349 RNA_def_property_int_sdna(prop, nullptr, "onion_skinning_settings.num_frames_after");
1350 RNA_def_property_range(prop, 0, 120);
1353 "Frames After",
1354 "Maximum number of frames to show after current frame "
1355 "(0 = don't show any frames after current)");
1356 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1357
1358 prop = RNA_def_property(srna, "use_ghost_custom_colors", PROP_BOOLEAN, PROP_NONE);
1360 prop, nullptr, "onion_skinning_settings.flag", GP_ONION_SKINNING_USE_CUSTOM_COLORS);
1362 RNA_def_property_ui_text(prop, "Use Custom Ghost Colors", "Use custom colors for ghost frames");
1363 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1364
1365 prop = RNA_def_property(srna, "before_color", PROP_FLOAT, PROP_COLOR);
1366 RNA_def_property_float_sdna(prop, nullptr, "onion_skinning_settings.color_before");
1367 RNA_def_property_array(prop, 3);
1368 RNA_def_property_range(prop, 0.0f, 1.0f);
1370 RNA_def_property_ui_text(prop, "Before Color", "Base color for ghosts before the active frame");
1373 "rna_grease_pencil_update");
1374
1375 prop = RNA_def_property(srna, "after_color", PROP_FLOAT, PROP_COLOR);
1376 RNA_def_property_float_sdna(prop, nullptr, "onion_skinning_settings.color_after");
1377 RNA_def_property_array(prop, 3);
1378 RNA_def_property_range(prop, 0.0f, 1.0f);
1380 RNA_def_property_ui_text(prop, "After Color", "Base color for ghosts after the active frame");
1383 "rna_grease_pencil_update");
1384
1385 prop = RNA_def_property(srna, "onion_mode", PROP_ENUM, PROP_NONE);
1386 RNA_def_property_enum_sdna(prop, nullptr, "onion_skinning_settings.mode");
1387 RNA_def_property_enum_items(prop, prop_enum_onion_modes_items);
1389 RNA_def_property_ui_text(prop, "Mode", "Mode to display frames");
1390 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1391
1392 prop = RNA_def_property(srna, "onion_keyframe_type", PROP_ENUM, PROP_NONE);
1393 RNA_def_property_enum_sdna(prop, nullptr, "onion_skinning_settings.filter");
1395 RNA_def_property_enum_items(prop, prop_enum_onion_keyframe_type_items);
1396 RNA_def_property_ui_text(prop, "Filter by Type", "Type of keyframe (for filtering)");
1398 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1399
1400 prop = RNA_def_property(srna, "use_onion_fade", PROP_BOOLEAN, PROP_NONE);
1402 prop, nullptr, "onion_skinning_settings.flag", GP_ONION_SKINNING_USE_FADE);
1405 prop, "Fade", "Display onion keyframes with a fade in color transparency");
1406 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1407
1408 prop = RNA_def_property(srna, "use_onion_loop", PROP_BOOLEAN, PROP_NONE);
1410 prop, nullptr, "onion_skinning_settings.flag", GP_ONION_SKINNING_SHOW_LOOP);
1413 prop, "Show Start Frame", "Display onion keyframes for looping animations");
1414 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1415
1416 prop = RNA_def_property(srna, "onion_factor", PROP_FLOAT, PROP_NONE);
1417 RNA_def_property_float_sdna(prop, nullptr, "onion_skinning_settings.opacity");
1418 RNA_def_property_range(prop, 0.0, 1.0f);
1420 RNA_def_property_ui_text(prop, "Onion Opacity", "Change fade opacity of displayed onion frames");
1421 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1422}
1423
1425{
1426 StructRNA *srna;
1427 PropertyRNA *prop;
1428
1429 srna = RNA_def_struct(brna, "GreasePencil", "ID");
1430 RNA_def_struct_sdna(srna, "GreasePencil");
1431 RNA_def_struct_ui_text(srna, "Grease Pencil", "Grease Pencil data-block");
1432 RNA_def_struct_ui_icon(srna, ICON_OUTLINER_DATA_GREASEPENCIL);
1433
1434 /* attributes */
1436
1437 /* Animation Data */
1439
1440 /* Materials */
1441 prop = RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
1442 RNA_def_property_collection_sdna(prop, nullptr, "material_array", "material_array_num");
1443 RNA_def_property_struct_type(prop, "Material");
1444 RNA_def_property_ui_text(prop, "Materials", "");
1445 RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.cc */
1447 nullptr,
1448 nullptr,
1449 nullptr,
1450 nullptr,
1451 nullptr,
1452 nullptr,
1453 nullptr,
1454 "rna_IDMaterials_assign_int");
1455
1456 /* Layers */
1457 prop = RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
1458 RNA_def_property_struct_type(prop, "GreasePencilLayer");
1460 "rna_iterator_grease_pencil_layers_begin",
1461 "rna_iterator_grease_pencil_layers_next",
1462 nullptr,
1463 "rna_iterator_grease_pencil_layers_get",
1464 "rna_iterator_grease_pencil_layers_length",
1465 nullptr, /* TODO */
1466 nullptr, /* TODO */
1467 nullptr);
1468 RNA_def_property_ui_text(prop, "Layers", "Grease Pencil layers");
1469 rna_def_grease_pencil_layers(brna, prop);
1470
1471 /* Layer Groups */
1472 prop = RNA_def_property(srna, "layer_groups", PROP_COLLECTION, PROP_NONE);
1473 RNA_def_property_struct_type(prop, "GreasePencilLayerGroup");
1475 "rna_iterator_grease_pencil_layer_groups_begin",
1476 "rna_iterator_grease_pencil_layer_groups_next",
1477 nullptr,
1478 "rna_iterator_grease_pencil_layer_groups_get",
1479 "rna_iterator_grease_pencil_layer_groups_length",
1480 nullptr, /* TODO */
1481 nullptr, /* TODO */
1482 nullptr);
1483 RNA_def_property_ui_text(prop, "Layer Groups", "Grease Pencil layer groups");
1485
1486 prop = RNA_def_property(srna, "use_autolock_layers", PROP_BOOLEAN, PROP_NONE);
1489 prop,
1490 "Auto-Lock Layers",
1491 "Automatically lock all layers except the active one to avoid accidental changes");
1492 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_autolock");
1493
1494 /* Uses a single flag, because the depth order can only be 2D or 3D. */
1495 prop = RNA_def_property(srna, "stroke_depth_order", PROP_ENUM, PROP_NONE);
1496 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "flag");
1499 prop,
1500 "Stroke Depth Order",
1501 "Defines how the strokes are ordered in 3D space (for objects not displayed 'In Front')");
1502 RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_grease_pencil_update");
1503
1504 /* Onion skinning. */
1506}
1507
1518
1519#endif
Generic geometry attributes built on CustomData.
Low-level operations for curves.
#define G_MAIN
Low-level operations for grease pencil.
#define BLI_assert_unreachable()
Definition BLI_assert.h:93
#define BLI_assert(a)
Definition BLI_assert.h:46
int BLI_listbase_count(const ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:524
MINLINE int max_ii(int a, int b)
MINLINE void copy_v3_v3(float r[3], const float a[3])
size_t BLI_str_escape(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define BLT_I18NCONTEXT_ID_GPENCIL
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1074
@ BEZT_KEYTYPE_EXTREME
@ BEZT_KEYTYPE_JITTER
@ BEZT_KEYTYPE_BREAKDOWN
@ BEZT_KEYTYPE_MOVEHOLD
@ BEZT_KEYTYPE_GENERATED
@ BEZT_KEYTYPE_KEYFRAME
@ GP_LAYER_BLEND_HARDLIGHT
@ GP_LAYER_BLEND_NONE
@ GP_LAYER_BLEND_MULTIPLY
@ GP_LAYER_BLEND_DIVIDE
@ GP_LAYER_BLEND_SUBTRACT
@ LAYERGROUP_COLOR_01
@ LAYERGROUP_COLOR_NONE
@ LAYERGROUP_COLOR_06
@ LAYERGROUP_COLOR_04
@ LAYERGROUP_COLOR_05
@ LAYERGROUP_COLOR_03
@ LAYERGROUP_COLOR_08
@ LAYERGROUP_COLOR_07
@ LAYERGROUP_COLOR_02
@ GP_ONION_SKINNING_MODE_ABSOLUTE
@ GP_ONION_SKINNING_MODE_SELECTED
@ GP_ONION_SKINNING_MODE_RELATIVE
@ GP_LAYER_MASK_INVERT
@ GP_LAYER_TREE_GROUP
@ GP_LAYER_TREE_NODE_EXPANDED
@ GP_LAYER_TREE_NODE_IGNORE_LOCKED_MATERIALS
@ GP_LAYER_TREE_NODE_LOCKED
@ GP_LAYER_TREE_NODE_MUTE
@ GP_LAYER_TREE_NODE_HIDE
@ GP_LAYER_TREE_NODE_SELECT
@ GP_LAYER_TREE_NODE_HIDE_ONION_SKINNING
@ GP_LAYER_TREE_NODE_USE_LIGHTS
@ GP_LAYER_TREE_NODE_HIDE_MASKS
@ GP_LAYER_TREE_NODE_DISABLE_MASKS_IN_VIEWLAYER
@ GP_DRAWING_REFERENCE
@ GREASE_PENCIL_AUTOLOCK_LAYERS
@ GREASE_PENCIL_STROKE_ORDER_3D
@ GP_ONION_SKINNING_USE_FADE
@ GP_ONION_SKINNING_SHOW_LOOP
@ GP_ONION_SKINNING_USE_CUSTOM_COLORS
@ GP_ONION_SKINNING_FILTER_KEYTYPE_MOVEHOLD
@ GP_ONION_SKINNING_FILTER_KEYTYPE_JITTER
@ GP_ONION_SKINNING_FILTER_KEYTYPE_KEYFRAME
@ GP_ONION_SKINNING_FILTER_KEYTYPE_BREAKDOWN
@ GP_ONION_SKINNING_FILTER_KEYTYPE_EXTREME
#define GREASE_PENCIL_ONION_SKINNING_FILTER_ALL
#define MINAFRAME
#define MAXFRAME
ParameterFlag
Definition RNA_types.hh:544
@ PROP_FLOAT
Definition RNA_types.hh:164
@ PROP_BOOLEAN
Definition RNA_types.hh:162
@ PROP_ENUM
Definition RNA_types.hh:166
@ PROP_INT
Definition RNA_types.hh:163
@ PROP_STRING
Definition RNA_types.hh:165
@ PROP_POINTER
Definition RNA_types.hh:167
@ PROP_COLLECTION
Definition RNA_types.hh:168
#define RNA_TRANSLATION_PREC_DEFAULT
Definition RNA_types.hh:224
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition RNA_types.hh:503
@ PROPOVERRIDE_NO_COMPARISON
Definition RNA_types.hh:511
@ PROPOVERRIDE_IGNORE
Definition RNA_types.hh:523
@ PROP_ANIMATABLE
Definition RNA_types.hh:319
@ PROP_EDITABLE
Definition RNA_types.hh:306
@ PROP_LIB_EXCEPTION
Definition RNA_types.hh:312
@ PROP_ID_SELF_CHECK
Definition RNA_types.hh:370
@ PROP_MATRIX
Definition RNA_types.hh:265
@ PROP_XYZ
Definition RNA_types.hh:269
@ PROP_COLOR
Definition RNA_types.hh:260
@ PROP_EULER
Definition RNA_types.hh:266
@ PROP_NONE
Definition RNA_types.hh:233
@ PROP_FACTOR
Definition RNA_types.hh:251
@ PROP_TRANSLATION
Definition RNA_types.hh:261
@ PROP_UNSIGNED
Definition RNA_types.hh:249
#define ND_DATA
Definition WM_types.hh:509
#define NC_SCREEN
Definition WM_types.hh:377
#define NC_SCENE
Definition WM_types.hh:378
#define ND_TOOLSETTINGS
Definition WM_types.hh:449
#define NA_EDITED
Definition WM_types.hh:584
#define NC_GPENCIL
Definition WM_types.hh:399
#define NA_RENAME
Definition WM_types.hh:588
#define NA_SELECTED
Definition WM_types.hh:589
const Map< FramesMapKeyT, GreasePencilFrame > & frames() const
Span< FramesMapKeyT > sorted_keys() const
bool is_group() const
static VArray from_single(T value, const int64_t size)
constexpr bool contains(int64_t value) const
constexpr const T * data() const
Definition BLI_span.hh:215
constexpr int64_t size() const
Definition BLI_span.hh:252
constexpr IndexRange index_range() const
Definition BLI_span.hh:401
constexpr bool is_empty() const
Definition BLI_span.hh:260
StringRefNull parent_bone_name() const
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
bool grease_pencil_layer_parent_set(bke::greasepencil::Layer &layer, Object *parent, StringRefNull bone, const bool keep_transform)
float wrap(float value, float max, float min)
Definition node_math.h:103
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
const PointerRNA PointerRNA_NULL
void * rna_iterator_array_get(CollectionPropertyIterator *iter)
void rna_iterator_array_begin(CollectionPropertyIterator *iter, PointerRNA *ptr, void *data, size_t itemsize, int64_t length, bool free_ptr, IteratorSkipFunc skip)
void rna_pointer_create_with_ancestors(const PointerRNA &parent, StructRNA *type, void *data, PointerRNA &r_ptr)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
PointerRNA RNA_pointer_create_with_parent(const PointerRNA &parent, StructRNA *type, void *data)
void rna_def_animdata_common(StructRNA *srna)
void rna_def_attributes_common(StructRNA *srna, const AttributeOwnerType type)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop)
void RNA_def_struct_refine_func(StructRNA *srna, const char *refine)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
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_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)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
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[])
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
void RNA_def_property_array(PropertyRNA *prop, int length)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
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_property_update(PropertyRNA *prop, int noteflag, const char *func)
const int rna_matrix_dimsize_4x4[]
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_enum_bitflag_sdna(PropertyRNA *prop, const char *structname, const char *propname)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
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_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
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)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_float_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_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_float_array_default(PropertyRNA *prop, const float *array)
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
static void rna_def_grease_pencil_frame(BlenderRNA *brna)
const EnumPropertyItem rna_enum_stroke_depth_order_items[]
const EnumPropertyItem enum_layergroup_color_items[]
static void rna_def_grease_pencil_tree_node(BlenderRNA *brna)
static void rna_def_grease_pencil_data(BlenderRNA *brna)
static void rna_def_grease_pencil_drawing(BlenderRNA *brna)
static void rna_def_grease_pencil_layer_group(BlenderRNA *brna)
static void rna_def_grease_pencil_layer_masks(BlenderRNA *brna, PropertyRNA *cprop)
static void rna_def_grease_pencil_layer_mask(BlenderRNA *brna)
void RNA_def_grease_pencil(BlenderRNA *brna)
static void rna_def_grease_pencil_onion_skinning(StructRNA *srna)
static void rna_def_grease_pencil_layer_groups(BlenderRNA *brna, PropertyRNA *cprop)
static void rna_def_grease_pencil_frames(BlenderRNA *brna, PropertyRNA *cprop)
static void rna_def_grease_pencil_layer(BlenderRNA *brna)
static void rna_def_grease_pencil_layers(BlenderRNA *brna, PropertyRNA *cprop)
void RNA_api_grease_pencil_drawing(StructRNA *srna)
void RNA_api_grease_pencil_frames(StructRNA *srna)
void RNA_api_grease_pencil_layer(StructRNA *srna)
void RNA_api_grease_pencil_layers(StructRNA *srna)
void RNA_api_grease_pencil_layer_groups(StructRNA *srna)
#define min(a, b)
Definition sort.cc:36
#define FLT_MAX
Definition stdcycles.h:14
union CollectionPropertyIterator::@220100362304005352221007113371015217044252346141 internal
struct GreasePencilLayerTreeGroup * parent
GreasePencilLayerTreeGroup * root_group_ptr
ID * owner_id
Definition RNA_types.hh:51
void * data
Definition RNA_types.hh:53
const T * base_ptr() const
max
Definition text_draw.cc:251
void WM_main_add_notifier(uint type, void *reference)
PointerRNA * ptr
Definition wm_files.cc:4238