Blender V5.3
rna_grease_pencil_api.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 "DNA_curves_types.h"
10#include "DNA_meshdata_types.h"
11#include "DNA_scene_types.h"
12
13#include "ED_object_vgroup.hh"
14#include "RNA_define.hh"
15#include "RNA_enum_types.hh"
16
17#include "WM_api.hh"
18
19#include "rna_internal.hh" /* own include */
20
21namespace blender {
22
24 {-1, "DOWN", 0, "Down", ""},
25 {1, "UP", 0, "Up", ""},
26 {0, nullptr, 0, nullptr, nullptr},
27};
28
29}
30
31#ifdef RNA_RUNTIME
32
33# include "BLI_listbase.hh"
34
35# include "BKE_attribute.hh"
36# include "BKE_context.hh"
37# include "BKE_curves.hh"
38# include "BKE_deform.hh"
40# include "BKE_grease_pencil.hh"
42# include "BKE_report.hh"
43# include "DNA_meshdata_types.h"
44
45# include "DEG_depsgraph.hh"
46
47# include "rna_curves_utils.hh"
48
49namespace blender {
50
51static void rna_GreasePencilDrawing_add_curves(ID *grease_pencil_id,
52 GreasePencilDrawing *drawing_ptr,
53 ReportList *reports,
54 const int *sizes,
55 const int sizes_num)
56{
57 bke::greasepencil::Drawing &drawing = drawing_ptr->wrap();
58 bke::CurvesGeometry &curves = drawing.strokes_for_write();
59 if (!rna_CurvesGeometry_add_curves(curves, reports, sizes, sizes_num)) {
60 return;
61 }
62
63 /* Default to `POLY` curves for the newly added ones. */
64 drawing.strokes_for_write().curve_types_for_write().take_back(sizes_num).fill(CURVE_TYPE_POLY);
65 drawing.strokes_for_write().update_curve_types();
66
67 drawing.tag_topology_changed();
68
69 /* Avoid updates for importers. */
70 if (grease_pencil_id->us > 0) {
71 DEG_id_tag_update(grease_pencil_id, ID_RECALC_GEOMETRY);
72 WM_main_add_notifier(NC_GEOM | ND_DATA, grease_pencil_id);
73 }
74}
75
76static void rna_GreasePencilDrawing_remove_curves(ID *grease_pencil_id,
77 GreasePencilDrawing *drawing_ptr,
78 ReportList *reports,
79 const int *indices_ptr,
80 const int indices_num)
81{
82 bke::greasepencil::Drawing &drawing = drawing_ptr->wrap();
83 bke::CurvesGeometry &curves = drawing.strokes_for_write();
84 if (!rna_CurvesGeometry_remove_curves(curves, reports, indices_ptr, indices_num)) {
85 return;
86 }
87
88 drawing.tag_topology_changed();
89
90 /* Avoid updates for importers. */
91 if (grease_pencil_id->us > 0) {
92 DEG_id_tag_update(grease_pencil_id, ID_RECALC_GEOMETRY);
93 WM_main_add_notifier(NC_GEOM | ND_DATA, grease_pencil_id);
94 }
95}
96
97static void rna_GreasePencilDrawing_resize_curves(ID *grease_pencil_id,
98 GreasePencilDrawing *drawing_ptr,
99 ReportList *reports,
100 const int *sizes_ptr,
101 const int sizes_num,
102 const int *indices_ptr,
103 const int indices_num)
104{
105 bke::greasepencil::Drawing &drawing = drawing_ptr->wrap();
106 bke::CurvesGeometry &curves = drawing.strokes_for_write();
107 if (!rna_CurvesGeometry_resize_curves(
108 curves, reports, sizes_ptr, sizes_num, indices_ptr, indices_num))
109 {
110 return;
111 }
112
113 drawing.tag_topology_changed();
114
115 /* Avoid updates for importers. */
116 if (grease_pencil_id->us > 0) {
117 DEG_id_tag_update(grease_pencil_id, ID_RECALC_GEOMETRY);
118 WM_main_add_notifier(NC_GEOM | ND_DATA, grease_pencil_id);
119 }
120}
121
122static void rna_GreasePencilDrawing_reorder_curves(ID *grease_pencil_id,
123 GreasePencilDrawing *drawing_ptr,
124 ReportList *reports,
125 const int *reorder_indices_ptr,
126 const int reorder_indices_num)
127{
128 bke::greasepencil::Drawing &drawing = drawing_ptr->wrap();
129 bke::CurvesGeometry &curves = drawing.strokes_for_write();
130 if (!rna_CurvesGeometry_reorder_curves(
131 curves, reports, reorder_indices_ptr, reorder_indices_num))
132 {
133 return;
134 }
135
136 drawing.tag_topology_changed();
137
138 /* Avoid updates for importers. */
139 if (grease_pencil_id->us > 0) {
140 DEG_id_tag_update(grease_pencil_id, ID_RECALC_GEOMETRY);
141 WM_main_add_notifier(NC_GEOM | ND_DATA, grease_pencil_id);
142 }
143}
144
145static void rna_GreasePencilDrawing_set_types(ID *grease_pencil_id,
146 GreasePencilDrawing *drawing_ptr,
147 ReportList *reports,
148 const int type,
149 const int *indices_ptr,
150 const int indices_num)
151{
152 bke::greasepencil::Drawing &drawing = drawing_ptr->wrap();
153 bke::CurvesGeometry &curves = drawing.strokes_for_write();
154 if (!rna_CurvesGeometry_set_types(curves, reports, type, indices_ptr, indices_num)) {
155 return;
156 }
157 /* Avoid updates for importers. */
158 if (grease_pencil_id->us > 0) {
159 DEG_id_tag_update(grease_pencil_id, ID_RECALC_GEOMETRY);
160 WM_main_add_notifier(NC_GEOM | ND_DATA, grease_pencil_id);
161 }
162}
163
164static void rna_GreasePencilDrawing_tag_positions_changed(GreasePencilDrawing *drawing_ptr)
165{
166 drawing_ptr->wrap().tag_positions_changed();
167}
168
169static void rna_GreasePencilDrawing_vertex_group_assign(ID *id,
170 GreasePencilDrawing *drawing_ptr,
171 ReportList *reports,
172 const char *vgroup_name,
173 const int *indices_ptr,
174 int indices_num,
175 float weight)
176{
177 GreasePencil &grease_pencil = *reinterpret_cast<GreasePencil *>(id);
178 const int vgroup_index = BKE_defgroup_name_index(&grease_pencil.vertex_group_names, vgroup_name);
179 if (vgroup_index == -1) {
180 return;
181 }
182
183 const bDeformGroup *dg = static_cast<const bDeformGroup *>(
184 BLI_findlink(&grease_pencil.vertex_group_names, vgroup_index));
185 if (dg->flag & DG_LOCK_WEIGHT) {
186 BKE_report(reports, RPT_ERROR, "Vertex Group is locked");
187 return;
188 }
189
190 bke::CurvesGeometry &curves = drawing_ptr->wrap().strokes_for_write();
191 const int def_nr = bke::greasepencil::ensure_vertex_group(vgroup_name,
192 curves.vertex_group_names);
193 const MutableSpan<MDeformVert> dverts = curves.deform_verts_for_write();
194 const int dverts_size = dverts.size();
195 const Span<int> indices(indices_ptr, indices_num);
196
197 for (const int i : indices) {
198 if (i < dverts_size) {
199 if (MDeformWeight *dw = BKE_defvert_ensure_index(&dverts[i], def_nr)) {
200 dw->weight = weight;
201 }
202 }
203 }
204 DEG_id_tag_update(&grease_pencil.id, ID_RECALC_GEOMETRY);
205 WM_main_add_notifier(NC_GPENCIL | NA_EDITED, &grease_pencil);
206}
207
208static void rna_GreasePencilDrawing_vertex_group_remove(ID *id,
209 GreasePencilDrawing *drawing_ptr,
210 ReportList *reports,
211 const char *vgroup_name,
212 const int *indices_ptr,
213 int indices_num)
214{
215 GreasePencil &grease_pencil = *reinterpret_cast<GreasePencil *>(id);
216 const int vgroup_index = BKE_defgroup_name_index(&grease_pencil.vertex_group_names, vgroup_name);
217 if (vgroup_index == -1) {
218 return;
219 }
220
221 const bDeformGroup *dg = static_cast<const bDeformGroup *>(
222 BLI_findlink(&grease_pencil.vertex_group_names, vgroup_index));
223 if (dg->flag & DG_LOCK_WEIGHT) {
224 BKE_report(reports, RPT_ERROR, "Vertex Group is locked");
225 return;
226 }
227
228 bke::CurvesGeometry &curves = drawing_ptr->wrap().strokes_for_write();
229 const int def_nr = BKE_defgroup_name_index(&curves.vertex_group_names, vgroup_name);
230 if (def_nr == -1) {
231 return;
232 }
233
234 const MutableSpan<MDeformVert> dverts = curves.deform_verts_for_write();
235 const int dverts_size = dverts.size();
236 const Span<int> indices(indices_ptr, indices_num);
237 for (const int i : indices) {
238 if (i < dverts_size) {
239 MDeformVert *dv = &dverts[i];
240 if (MDeformWeight *dw = BKE_defvert_find_index(dv, def_nr)) {
242 }
243 }
244 }
245
246 DEG_id_tag_update(&grease_pencil.id, ID_RECALC_GEOMETRY);
247 WM_main_add_notifier(NC_GPENCIL | NA_EDITED, &grease_pencil);
248}
249
250static void rna_GreasePencilDrawing_set_vertex_weights(ID *grease_pencil_id,
251 GreasePencilDrawing *drawing_ptr,
252 ReportList *reports,
253 const char *vertex_group_name,
254 const int *indices_ptr,
255 const int indices_num,
256 const float *weights_ptr,
257 const int weights_num,
258 const int assignmode)
259{
260 const Span<int> indices(indices_ptr, indices_num);
261 const Span<float> weights(weights_ptr, weights_num);
262 if (indices.size() != weights.size()) {
263 BKE_report(reports, RPT_ERROR, "Indices and weights must have the same lengths");
264 return;
265 }
266 if (!std::is_sorted(indices.begin(), indices.end())) {
267 BKE_report(reports, RPT_ERROR, "Indices must be sorted in ascending order");
268 return;
269 }
270 if (std::adjacent_find(indices.begin(), indices.end(), std::greater_equal<>()) != indices.end())
271 {
272 BKE_report(reports, RPT_ERROR, "Indices cannot have duplicates");
273 return;
274 }
275
276 const GreasePencil &grease_pencil = *reinterpret_cast<GreasePencil *>(grease_pencil_id);
277 const int vgroup_index = BKE_defgroup_name_index(&grease_pencil.vertex_group_names,
278 vertex_group_name);
279 if (vgroup_index == -1) {
280 BKE_reportf(reports, RPT_ERROR, "Vertex Group \"%s\" does not exist", vertex_group_name);
281 return;
282 }
283
284 const bDeformGroup *dg = static_cast<const bDeformGroup *>(
285 BLI_findlink(&grease_pencil.vertex_group_names, vgroup_index));
286 if (dg->flag & DG_LOCK_WEIGHT) {
287 BKE_reportf(reports, RPT_ERROR, "Vertex Group \"%s\" is locked", vertex_group_name);
288 return;
289 }
290
291 bke::CurvesGeometry &curves = drawing_ptr->wrap().strokes_for_write();
292 const int def_nr = bke::greasepencil::ensure_vertex_group(vertex_group_name,
293 curves.vertex_group_names);
294 const MutableSpan<MDeformVert> dverts = curves.deform_verts_for_write();
295 if (std::any_of(indices.begin(),
296 indices.end(),
297 [&](const int index) { return !dverts.index_range().contains(index); }))
298 {
299 BKE_reportf(reports, RPT_ERROR, "Indices must be in range");
300 return;
301 }
302
303 threading::parallel_for(indices.index_range(), 2048, [&](const IndexRange range) {
304 for (const int i : range) {
305 const int dvert_index = indices[i];
306 const float weight = weights[i];
307 MDeformVert *dv = &dverts[dvert_index];
308 /* Lets first check to see if this vert is already in the weight group and update it. */
309 if (MDeformWeight *dw = BKE_defvert_find_index(dv, def_nr)) {
310 switch (assignmode) {
311 case WEIGHT_REPLACE:
312 dw->weight = weight;
313 break;
314 case WEIGHT_ADD:
315 dw->weight += weight;
316 break;
317 case WEIGHT_SUBTRACT:
318 dw->weight -= weight;
319 break;
320 }
321 dw->weight = std::clamp(dw->weight, 0.0f, 1.0f);
322 }
323 else {
324 /* If the vert wasn't in the deform group then we must take a different form of action. */
325 switch (assignmode) {
326 case WEIGHT_SUBTRACT:
327 /* If we are subtracting then we don't need to do anything. */
328 return;
329
330 case WEIGHT_REPLACE:
331 case WEIGHT_ADD:
332 /* If we are doing an additive assignment, then we need to create the deform weight. */
333 /* We checked if the vertex was added before so no need to test again, simply add. */
334 BKE_defvert_add_index_notest(dv, def_nr, std::clamp(weight, 0.0f, 1.0f));
335 break;
336 }
337 }
338 }
339 });
340
342 DEG_id_tag_update(grease_pencil_id, ID_RECALC_GEOMETRY);
343}
344
345static GreasePencilFrame *rna_Frames_frame_new(ID *id,
346 GreasePencilLayer *layer_in,
347 ReportList *reports,
348 int frame_number)
349{
350 using namespace bke::greasepencil;
351 GreasePencil &grease_pencil = *reinterpret_cast<GreasePencil *>(id);
352 Layer &layer = layer_in->wrap();
353
354 if (layer.frames().contains(frame_number)) {
355 BKE_reportf(reports, RPT_ERROR, "Frame already exists on frame number %d", frame_number);
356 return nullptr;
357 }
358
359 grease_pencil.insert_frame(layer, frame_number, 0, BEZT_KEYTYPE_KEYFRAME);
360 DEG_id_tag_update(&grease_pencil.id, ID_RECALC_GEOMETRY);
362
363 return layer.frame_at(frame_number);
364}
365
366static void rna_Frames_frame_remove(ID *id,
367 GreasePencilLayer *layer_in,
368 ReportList *reports,
369 int frame_number)
370{
371 using namespace bke::greasepencil;
372 GreasePencil &grease_pencil = *reinterpret_cast<GreasePencil *>(id);
373 Layer &layer = layer_in->wrap();
374
375 if (!layer.frames().contains(frame_number)) {
376 BKE_reportf(reports, RPT_ERROR, "Frame does not exist on frame number %d", frame_number);
377 return;
378 }
379
380 if (grease_pencil.remove_frames(layer, {frame_number})) {
381 DEG_id_tag_update(&grease_pencil.id, ID_RECALC_GEOMETRY);
383 }
384
385 /* TODO: Use #PointerRNA::invalidate() to invalidate python objects pointing to the frame_number?
386 */
387}
388
389static GreasePencilFrame *rna_Frames_frame_copy(ID *id,
390 GreasePencilLayer *layer_in,
391 ReportList *reports,
392 int from_frame_number,
393 int to_frame_number,
394 bool instance_drawing)
395{
396 using namespace bke::greasepencil;
397 GreasePencil &grease_pencil = *reinterpret_cast<GreasePencil *>(id);
398 Layer &layer = layer_in->wrap();
399
400 if (!layer.frames().contains(from_frame_number)) {
401 BKE_reportf(reports, RPT_ERROR, "Frame does not exist on frame number %d", from_frame_number);
402 return nullptr;
403 }
404 if (layer.frames().contains(to_frame_number)) {
405 BKE_reportf(reports, RPT_ERROR, "Frame already exists on frame number %d", to_frame_number);
406 return nullptr;
407 }
408
409 grease_pencil.insert_duplicate_frame(
410 layer, from_frame_number, to_frame_number, instance_drawing);
412
413 return layer.frame_at(to_frame_number);
414}
415
416static GreasePencilFrame *rna_Frames_frame_move(ID *id,
417 GreasePencilLayer *layer_in,
418 ReportList *reports,
419 int from_frame_number,
420 int to_frame_number)
421{
422 using namespace bke::greasepencil;
423 GreasePencil &grease_pencil = *reinterpret_cast<GreasePencil *>(id);
424 Layer &layer = layer_in->wrap();
425
426 if (!layer.frames().contains(from_frame_number)) {
427 BKE_reportf(reports, RPT_ERROR, "Frame does not exist on frame number %d", from_frame_number);
428 return nullptr;
429 }
430 if (layer.frames().contains(to_frame_number)) {
431 BKE_reportf(reports, RPT_ERROR, "Frame already exists on frame number %d", to_frame_number);
432 return nullptr;
433 }
434
435 grease_pencil.insert_duplicate_frame(layer, from_frame_number, to_frame_number, true);
436 grease_pencil.remove_frames(layer, {from_frame_number});
438
439 /* TODO: Use #PointerRNA::invalidate() to invalidate python objects pointing to the
440 * from_frame_number? */
441
442 return layer.frame_at(to_frame_number);
443}
444
445static GreasePencilFrame *rna_GreasePencilLayer_get_frame_at(GreasePencilLayer *layer,
446 int frame_number)
447{
448 using namespace bke::greasepencil;
449 return static_cast<Layer *>(layer)->frame_at(frame_number);
450}
451
452static GreasePencilFrame *rna_GreasePencilLayer_current_frame(GreasePencilLayer *layer,
453 bContext *C)
454{
455 using namespace bke::greasepencil;
456 Scene *scene = CTX_data_scene(C);
457 return static_cast<Layer *>(layer)->frame_at(scene->r.cfra);
458}
459
460static GreasePencilLayer *rna_GreasePencil_layer_new(GreasePencil *grease_pencil,
461 const char *name,
462 const bool set_active,
463 PointerRNA *layer_group_ptr)
464{
465 using namespace bke::greasepencil;
466 LayerGroup *layer_group = nullptr;
467 if (layer_group_ptr && *layer_group_ptr) {
468 layer_group = static_cast<LayerGroup *>(layer_group_ptr->data);
469 }
470 Layer *layer;
471 if (layer_group) {
472 layer = &grease_pencil->add_layer(*layer_group, name);
473 }
474 else {
475 layer = &grease_pencil->add_layer(name);
476 }
477 if (set_active) {
478 grease_pencil->set_active_layer(layer);
479 }
480
482
483 return layer;
484}
485
486static void rna_GreasePencil_layer_remove(GreasePencil *grease_pencil, PointerRNA *layer_ptr)
487{
488 bke::greasepencil::Layer &layer = *static_cast<bke::greasepencil::Layer *>(layer_ptr->data);
489 grease_pencil->remove_layer(layer);
490
491 layer_ptr->invalidate();
492 DEG_id_tag_update(&grease_pencil->id, ID_RECALC_GEOMETRY);
494}
495
496static void rna_GreasePencil_layer_move(GreasePencil *grease_pencil,
497 PointerRNA *layer_ptr,
498 const int direction)
499{
500 if (direction == 0) {
501 return;
502 }
503
504 bke::greasepencil::TreeNode &layer_node =
505 static_cast<bke::greasepencil::Layer *>(layer_ptr->data)->as_node();
506 switch (direction) {
507 case -1:
508 grease_pencil->move_node_down(layer_node, 1);
509 break;
510 case 1:
511 grease_pencil->move_node_up(layer_node, 1);
512 break;
513 }
514
515 DEG_id_tag_update(&grease_pencil->id, ID_RECALC_GEOMETRY);
517}
518
519static void rna_GreasePencil_layer_move_top(GreasePencil *grease_pencil, PointerRNA *layer_ptr)
520{
521 bke::greasepencil::TreeNode &layer_node =
522 static_cast<bke::greasepencil::Layer *>(layer_ptr->data)->as_node();
523 grease_pencil->move_node_top(layer_node);
524
525 DEG_id_tag_update(&grease_pencil->id, ID_RECALC_GEOMETRY);
527}
528
529static void rna_GreasePencil_layer_move_bottom(GreasePencil *grease_pencil, PointerRNA *layer_ptr)
530{
531 bke::greasepencil::TreeNode &layer_node =
532 static_cast<bke::greasepencil::Layer *>(layer_ptr->data)->as_node();
533 grease_pencil->move_node_bottom(layer_node);
534
535 DEG_id_tag_update(&grease_pencil->id, ID_RECALC_GEOMETRY);
537}
538
539static void rna_GreasePencil_layer_move_to_layer_group(GreasePencil *grease_pencil,
540 PointerRNA *layer_ptr,
541 PointerRNA *layer_group_ptr)
542{
543 using namespace bke::greasepencil;
544 TreeNode &layer_node = static_cast<Layer *>(layer_ptr->data)->as_node();
545 LayerGroup *layer_group;
546 if (layer_group_ptr && *layer_group_ptr) {
547 layer_group = static_cast<LayerGroup *>(layer_group_ptr->data);
548 }
549 else {
550 layer_group = &grease_pencil->root_group();
551 }
552 if (layer_group == nullptr) {
553 return;
554 }
555 grease_pencil->move_node_into(layer_node, *layer_group);
556
557 DEG_id_tag_update(&grease_pencil->id, ID_RECALC_GEOMETRY);
559}
560
561static PointerRNA rna_GreasePencil_layer_group_new(GreasePencil *grease_pencil,
562 const char *name,
563 PointerRNA *parent_group_ptr)
564{
565 using namespace bke::greasepencil;
566 LayerGroup *parent_group;
567 if (parent_group_ptr && *parent_group_ptr) {
568 parent_group = static_cast<LayerGroup *>(parent_group_ptr->data);
569 }
570 else {
571 parent_group = &grease_pencil->root_group();
572 }
573 LayerGroup *new_layer_group = &grease_pencil->add_layer_group(*parent_group, name);
574
576
577 PointerRNA ptr = RNA_pointer_create_discrete(
578 &grease_pencil->id, RNA_GreasePencilLayerGroup, new_layer_group);
579 return ptr;
580}
581
582static void rna_GreasePencil_layer_group_remove(GreasePencil *grease_pencil,
583 PointerRNA *layer_group_ptr,
584 bool keep_children)
585{
586 using namespace bke::greasepencil;
587 LayerGroup &layer_group = *static_cast<LayerGroup *>(layer_group_ptr->data);
588 grease_pencil->remove_group(layer_group, keep_children);
589
590 layer_group_ptr->invalidate();
591 DEG_id_tag_update(&grease_pencil->id, ID_RECALC_GEOMETRY);
593}
594
595static void rna_GreasePencil_layer_group_move(GreasePencil *grease_pencil,
596 PointerRNA *layer_group_ptr,
597 int direction)
598{
599 if (direction == 0) {
600 return;
601 }
602
603 bke::greasepencil::TreeNode &layer_group_node =
604 static_cast<bke::greasepencil::LayerGroup *>(layer_group_ptr->data)->as_node();
605 switch (direction) {
606 case -1:
607 grease_pencil->move_node_down(layer_group_node, 1);
608 break;
609 case 1:
610 grease_pencil->move_node_up(layer_group_node, 1);
611 break;
612 }
613
614 DEG_id_tag_update(&grease_pencil->id, ID_RECALC_GEOMETRY);
616}
617
618static void rna_GreasePencil_layer_group_move_top(GreasePencil *grease_pencil,
619 PointerRNA *layer_group_ptr)
620{
621 bke::greasepencil::TreeNode &layer_group_node =
622 static_cast<bke::greasepencil::LayerGroup *>(layer_group_ptr->data)->as_node();
623 grease_pencil->move_node_top(layer_group_node);
624
625 DEG_id_tag_update(&grease_pencil->id, ID_RECALC_GEOMETRY);
627}
628
629static void rna_GreasePencil_layer_group_move_bottom(GreasePencil *grease_pencil,
630 PointerRNA *layer_group_ptr)
631{
632 bke::greasepencil::TreeNode &layer_group_node =
633 static_cast<bke::greasepencil::LayerGroup *>(layer_group_ptr->data)->as_node();
634 grease_pencil->move_node_bottom(layer_group_node);
635
636 DEG_id_tag_update(&grease_pencil->id, ID_RECALC_GEOMETRY);
638}
639
640static void rna_GreasePencil_layer_group_move_to_layer_group(GreasePencil *grease_pencil,
641 PointerRNA *layer_group_ptr,
642 PointerRNA *parent_group_ptr)
643{
644 using namespace bke::greasepencil;
645 TreeNode &layer_group_node = static_cast<LayerGroup *>(layer_group_ptr->data)->as_node();
646 LayerGroup *parent_group;
647 if (parent_group_ptr && *parent_group_ptr) {
648 parent_group = static_cast<LayerGroup *>(parent_group_ptr->data);
649 }
650 else {
651 parent_group = &grease_pencil->root_group();
652 }
653 grease_pencil->move_node_into(layer_group_node, *parent_group);
654
655 DEG_id_tag_update(&grease_pencil->id, ID_RECALC_GEOMETRY);
657}
658
659static GreasePencilLayerMask *rna_grease_pencil_layer_mask_add(GreasePencilLayer *layer,
660 ReportList *reports,
661 GreasePencilLayer *mask_layer)
662{
663 if (layer == nullptr) {
664 BKE_report(reports, RPT_ERROR, "Layer doesn't exist");
665 return nullptr;
666 }
667
668 if (mask_layer == nullptr) {
669 BKE_report(reports, RPT_ERROR, "Mask layer doesn't exist");
670 return nullptr;
671 }
672
673 /* Get the mask layer's name */
674 const std::string mask_layer_name = mask_layer->wrap().name();
675
676 /* Check if this layer is already in the masks list */
677 for (GreasePencilLayerMask &existing_mask : layer->masks) {
678 if (existing_mask.layer_name && STREQ(existing_mask.layer_name, mask_layer_name.c_str())) {
679 BKE_reportf(reports, RPT_WARNING, "Layer '%s' is already masked", mask_layer_name.c_str());
680 return &existing_mask;
681 }
682 }
683
684 GreasePencilLayerMask *new_mask = MEM_new<bke::greasepencil::LayerMask>(__func__,
685 mask_layer_name);
686
687 /* Add the mask to this layer's mask list */
688 BLI_addtail(&layer->masks, new_mask);
689
691
692 return new_mask;
693}
694
695static void rna_grease_pencil_layer_mask_remove(GreasePencilLayer *layer,
696 ReportList *reports,
697 PointerRNA *mask_ptr)
698{
699 if (layer == nullptr) {
700 BKE_report(reports, RPT_ERROR, "Layer doesn't exist");
701 return;
702 }
703
704 GreasePencilLayerMask *mask = static_cast<GreasePencilLayerMask *>(mask_ptr->data);
705 if (mask == nullptr) {
706 BKE_report(reports, RPT_ERROR, "Mask pointer doesn't exist");
707 return;
708 }
709
710 /* Verify the mask belongs to this layer. */
711 if (BLI_findindex(&layer->masks, mask) == -1) {
712 BKE_reportf(reports, RPT_ERROR, "Mask not found in layer");
713 return;
714 }
715
716 BLI_remlink(&layer->masks, mask);
717
718 MEM_delete(&mask->wrap());
719
720 /* Clear the RNA pointer. */
721 mask_ptr->invalidate();
722
724}
725
726static const char *rna_GreasePencil_unit_test_compare(GreasePencil *grease_pencil_1,
727 GreasePencil *grease_pencil_2,
728 float threshold)
729{
730 using namespace bke::compare_geometry;
731 const std::optional<GeoMismatch> mismatch = compare_grease_pencil(
732 *grease_pencil_1, *grease_pencil_2, threshold);
733
734 if (!mismatch) {
735 return "Same";
736 }
737
738 return mismatch_to_string(mismatch.value());
739}
740
741} // namespace blender
742
743#else
744
745namespace blender {
746
748{
749 FunctionRNA *func;
750 PropertyRNA *parm;
751
752 func = RNA_def_function(srna, "unit_test_compare", "rna_GreasePencil_unit_test_compare");
753 RNA_def_pointer(func, "grease_pencil", "GreasePencil", "", "Grease Pencil to compare to");
755 "threshold",
756 FLT_EPSILON * 60,
757 0.0f,
758 FLT_MAX,
759 "Threshold",
760 "Comparison tolerance threshold",
761 0.0f,
762 FLT_MAX);
763 parm = RNA_def_string(
764 func, "result", "nothing", 64, "Return value", "String description of result of comparison");
765 RNA_def_function_return(func, parm);
766}
767
769{
770 FunctionRNA *func;
771 PropertyRNA *parm;
772
773 func = RNA_def_function(srna, "add", "rna_grease_pencil_layer_mask_add");
774 RNA_def_function_ui_description(func, "Add an existing layer as a mask to this layer");
776 parm = RNA_def_pointer(func, "layer", "GreasePencilLayer", "", "Layer to add as a mask");
778 parm = RNA_def_pointer(
779 func, "mask", "GreasePencilLayerMask", "", "The mask entry referencing the layer");
781 RNA_def_function_return(func, parm);
782
783 func = RNA_def_function(srna, "remove", "rna_grease_pencil_layer_mask_remove");
784 RNA_def_function_ui_description(func, "Remove a mask from the layer");
786 parm = RNA_def_pointer(func, "mask", "GreasePencilLayerMask", "", "Mask to remove");
788}
789
791{
792 FunctionRNA *func;
793 PropertyRNA *parm;
794
795 func = RNA_def_function(srna, "add_strokes", "rna_GreasePencilDrawing_add_curves");
796 RNA_def_function_ui_description(func, "Add new strokes with provided sizes at the end");
798 parm = RNA_def_int_array(func,
799 "sizes",
800 1,
801 nullptr,
802 1,
803 INT_MAX,
804 "Sizes",
805 "The number of points in each stroke",
806 1,
807 10000);
809
810 func = RNA_def_function(srna, "remove_strokes", "rna_GreasePencilDrawing_remove_curves");
812 "Remove all strokes. If indices are provided, remove only the "
813 "strokes with the given indices.");
815 parm = RNA_def_int_array(func,
816 "indices",
817 1,
818 nullptr,
819 0,
820 INT_MAX,
821 "Indices",
822 "The indices of the strokes to remove",
823 0,
824 10000);
826
827 func = RNA_def_function(srna, "resize_strokes", "rna_GreasePencilDrawing_resize_curves");
829 func,
830 "Resize all existing strokes. If indices are provided, resize only the strokes with the "
831 "given indices. If the new size for a stroke is smaller, the stroke is trimmed. If "
832 "the new size for a stroke is larger, the new end values are default initialized.");
834 parm = RNA_def_int_array(func,
835 "sizes",
836 1,
837 nullptr,
838 1,
839 INT_MAX,
840 "Sizes",
841 "The number of points in each stroke",
842 1,
843 10000);
845 parm = RNA_def_int_array(func,
846 "indices",
847 1,
848 nullptr,
849 0,
850 INT_MAX,
851 "Indices",
852 "The indices of the stroke to resize",
853 0,
854 10000);
856
857 func = RNA_def_function(srna, "reorder_strokes", "rna_GreasePencilDrawing_reorder_curves");
858 RNA_def_function_ui_description(func, "Reorder the strokes by the new indices.");
860 parm = RNA_def_int_array(func,
861 "new_indices",
862 1,
863 nullptr,
864 0,
865 INT_MAX,
866 "New indices",
867 "The new index for each of the strokes",
868 0,
869 10000);
871
872 func = RNA_def_function(srna, "set_types", "rna_GreasePencilDrawing_set_types");
874 "Set the curve type. If indices are provided, set only the "
875 "types with the given curve indices.");
878 parm = RNA_def_int_array(func,
879 "indices",
880 1,
881 nullptr,
882 0,
883 INT_MAX,
884 "Indices",
885 "The indices of the curves to resize",
886 0,
887 INT_MAX);
889
890 func = RNA_def_function(
891 srna, "tag_positions_changed", "rna_GreasePencilDrawing_tag_positions_changed");
893 func, "Indicate that the positions of points in the drawing have changed");
894
895 func = RNA_def_function(
896 srna, "vertex_group_assign", "rna_GreasePencilDrawing_vertex_group_assign");
897 RNA_def_function_ui_description(func, "Assign points to vertex group");
899 parm = RNA_def_string(
900 func, "vgroup_name", "Group", MAX_NAME, "Vertex Group Name", "Name of the vertex group");
902 parm = RNA_def_int_array(func,
903 "indices_ptr",
904 1,
905 nullptr,
906 0,
907 0,
908 "Indices",
909 "The point indices to assign the weight to",
910 0,
911 0);
913 parm = RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight", 0.0f, 1.0f);
915
916 func = RNA_def_function(
917 srna, "vertex_group_remove", "rna_GreasePencilDrawing_vertex_group_remove");
918 RNA_def_function_ui_description(func, "Remove points from vertex group");
920 parm = RNA_def_string(
921 func, "vgroup_name", "Group", MAX_NAME, "Vertex Group Name", "Name of the vertex group");
923 parm = RNA_def_int_array(func,
924 "indices_ptr",
925 1,
926 nullptr,
927 0,
928 0,
929 "Indices",
930 "The point indices to remove from the vertex group",
931 0,
932 0);
934
935 static const EnumPropertyItem assign_mode_items[] = {
936 {WEIGHT_REPLACE, "REPLACE", 0, "Replace", "Replace"},
937 {WEIGHT_ADD, "ADD", 0, "Add", "Add"},
938 {WEIGHT_SUBTRACT, "SUBTRACT", 0, "Subtract", "Subtract"},
939 {0, nullptr, 0, nullptr, nullptr},
940 };
941 func = RNA_def_function(
942 srna, "set_vertex_weights", "rna_GreasePencilDrawing_set_vertex_weights");
943 RNA_def_function_ui_description(func, "Set the weights of vertices in a grease pencil drawing");
945 parm = RNA_def_string(func,
946 "vertex_group_name",
947 "Group",
948 MAX_NAME,
949 "Vertex Group Name",
950 "Name of the vertex group");
952 parm = RNA_def_int_array(func,
953 "indices",
954 1,
955 nullptr,
956 0,
957 0,
958 "Indices",
959 "The point indices in the vertex group to modify",
960 0,
961 0);
963 parm = RNA_def_float_array(func,
964 "weights",
965 1,
966 nullptr,
967 0.0f,
968 1.0f,
969 "Weights",
970 "The weight for each corresponding index in the indices array",
971 0,
972 0);
974 parm = RNA_def_enum(func, "assign_mode", assign_mode_items, 0, "", "");
975}
976
978{
979 FunctionRNA *func;
980 PropertyRNA *parm;
981
982 func = RNA_def_function(srna, "new", "rna_Frames_frame_new");
983 RNA_def_function_ui_description(func, "Add a new Grease Pencil frame");
985 parm = RNA_def_int(func,
986 "frame_number",
987 1,
988 MINAFRAME,
989 MAXFRAME,
990 "Frame Number",
991 "The frame on which the drawing appears",
992 MINAFRAME,
993 MAXFRAME);
995 parm = RNA_def_pointer(func, "frame", "GreasePencilFrame", "", "The newly created frame");
997 RNA_def_function_return(func, parm);
998
999 func = RNA_def_function(srna, "remove", "rna_Frames_frame_remove");
1000 RNA_def_function_ui_description(func, "Remove a Grease Pencil frame");
1002 parm = RNA_def_int(func,
1003 "frame_number",
1004 1,
1005 MINAFRAME,
1006 MAXFRAME,
1007 "Frame Number",
1008 "The frame number of the frame to remove",
1009 MINAFRAME,
1010 MAXFRAME);
1012
1013 func = RNA_def_function(srna, "copy", "rna_Frames_frame_copy");
1014 RNA_def_function_ui_description(func, "Copy a Grease Pencil frame");
1016 parm = RNA_def_int(func,
1017 "from_frame_number",
1018 1,
1019 MINAFRAME,
1020 MAXFRAME,
1021 "Source Frame Number",
1022 "The frame number of the source frame",
1023 MINAFRAME,
1024 MAXFRAME);
1026 parm = RNA_def_int(func,
1027 "to_frame_number",
1028 2,
1029 MINAFRAME,
1030 MAXFRAME,
1031 "Frame Number of Copy",
1032 "The frame number to copy the frame to",
1033 MINAFRAME,
1034 MAXFRAME);
1036 parm = RNA_def_boolean(func,
1037 "instance_drawing",
1038 false,
1039 "Instance Drawing",
1040 "Let the copied frame use the same drawing as the source");
1041 parm = RNA_def_pointer(func, "copy", "GreasePencilFrame", "", "The newly copied frame");
1042 RNA_def_function_return(func, parm);
1043
1044 func = RNA_def_function(srna, "move", "rna_Frames_frame_move");
1045 RNA_def_function_ui_description(func, "Move a Grease Pencil frame");
1047 parm = RNA_def_int(func,
1048 "from_frame_number",
1049 1,
1050 MINAFRAME,
1051 MAXFRAME,
1052 "Source Frame Number",
1053 "The frame number of the source frame",
1054 MINAFRAME,
1055 MAXFRAME);
1057 parm = RNA_def_int(func,
1058 "to_frame_number",
1059 2,
1060 MINAFRAME,
1061 MAXFRAME,
1062 "Target Frame Number",
1063 "The frame number to move the frame to",
1064 MINAFRAME,
1065 MAXFRAME);
1067 parm = RNA_def_pointer(func, "moved", "GreasePencilFrame", "", "The moved frame");
1068 RNA_def_function_return(func, parm);
1069}
1070
1072{
1073 FunctionRNA *func;
1074 PropertyRNA *parm;
1075
1076 func = RNA_def_function(srna, "get_frame_at", "rna_GreasePencilLayer_get_frame_at");
1077 RNA_def_function_ui_description(func, "Get the frame at given frame number");
1078 parm = RNA_def_int(
1079 func, "frame_number", 1, MINAFRAME, MAXFRAME, "Frame Number", "", MINAFRAME, MAXFRAME);
1081 parm = RNA_def_pointer(func, "frame", "GreasePencilFrame", "Frame", "");
1082 RNA_def_function_return(func, parm);
1083
1084 func = RNA_def_function(srna, "current_frame", "rna_GreasePencilLayer_current_frame");
1086 func, "The Grease Pencil frame at the current scene time on this layer");
1088 parm = RNA_def_pointer(func, "frame", "GreasePencilFrame", "", "");
1089 RNA_def_function_return(func, parm);
1090}
1091
1093{
1094 FunctionRNA *func;
1095 PropertyRNA *parm;
1096
1097 func = RNA_def_function(srna, "new", "rna_GreasePencil_layer_new");
1098 RNA_def_function_ui_description(func, "Add a new Grease Pencil layer");
1099 parm = RNA_def_string(func, "name", "GreasePencilLayer", MAX_NAME, "Name", "Name of the layer");
1102 func, "set_active", true, "Set Active", "Set the newly created layer as the active layer");
1103 parm = RNA_def_pointer(
1104 func,
1105 "layer_group",
1106 "GreasePencilLayerGroup",
1107 "",
1108 "The layer group the new layer will be created in (use None for the main stack)");
1110 parm = RNA_def_pointer(func, "layer", "GreasePencilLayer", "", "The newly created layer");
1112 RNA_def_function_return(func, parm);
1113
1114 func = RNA_def_function(srna, "remove", "rna_GreasePencil_layer_remove");
1115 RNA_def_function_ui_description(func, "Remove a Grease Pencil layer");
1116 parm = RNA_def_pointer(func, "layer", "GreasePencilLayer", "", "The layer to remove");
1119
1120 func = RNA_def_function(srna, "move", "rna_GreasePencil_layer_move");
1122 "Move a Grease Pencil layer in the layer group or main stack");
1123 parm = RNA_def_pointer(func, "layer", "GreasePencilLayer", "", "The layer to move");
1126 parm = RNA_def_enum(
1127 func, "type", rna_enum_tree_node_move_type_items, 1, "", "Direction of movement");
1129
1130 func = RNA_def_function(srna, "move_top", "rna_GreasePencil_layer_move_top");
1132 func, "Move a Grease Pencil layer to the top of the layer group or main stack");
1133 parm = RNA_def_pointer(func, "layer", "GreasePencilLayer", "", "The layer to move");
1136
1137 func = RNA_def_function(srna, "move_bottom", "rna_GreasePencil_layer_move_bottom");
1139 func, "Move a Grease Pencil layer to the bottom of the layer group or main stack");
1140 parm = RNA_def_pointer(func, "layer", "GreasePencilLayer", "", "The layer to move");
1143
1144 func = RNA_def_function(
1145 srna, "move_to_layer_group", "rna_GreasePencil_layer_move_to_layer_group");
1146 RNA_def_function_ui_description(func, "Move a Grease Pencil layer into a layer group");
1147 parm = RNA_def_pointer(func, "layer", "GreasePencilLayer", "", "The layer to move");
1150 parm = RNA_def_pointer(
1151 func,
1152 "layer_group",
1153 "GreasePencilLayerGroup",
1154 "",
1155 "The layer group the layer will be moved into (use None for the main stack)");
1158}
1159
1161{
1162 FunctionRNA *func;
1163 PropertyRNA *parm;
1164
1165 func = RNA_def_function(srna, "new", "rna_GreasePencil_layer_group_new");
1166 RNA_def_function_ui_description(func, "Add a new Grease Pencil layer group");
1167 parm = RNA_def_string(
1168 func, "name", "GreasePencilLayerGroup", MAX_NAME, "Name", "Name of the layer group");
1170 parm = RNA_def_pointer(func,
1171 "parent_group",
1172 "GreasePencilLayerGroup",
1173 "",
1174 "The parent layer group the new group will be created in (use None "
1175 "for the main stack)");
1177 parm = RNA_def_pointer(
1178 func, "layer_group", "GreasePencilLayerGroup", "", "The newly created layer group");
1180 RNA_def_function_return(func, parm);
1181
1182 func = RNA_def_function(srna, "remove", "rna_GreasePencil_layer_group_remove");
1183 RNA_def_function_ui_description(func, "Remove a new Grease Pencil layer group");
1184 parm = RNA_def_pointer(
1185 func, "layer_group", "GreasePencilLayerGroup", "", "The layer group to remove");
1188 parm = RNA_def_boolean(func,
1189 "keep_children",
1190 false,
1191 "",
1192 "Keep the children nodes of the group and only delete the group itself");
1193
1194 func = RNA_def_function(srna, "move", "rna_GreasePencil_layer_group_move");
1196 "Move a layer group in the parent layer group or main stack");
1197 parm = RNA_def_pointer(
1198 func, "layer_group", "GreasePencilLayerGroup", "", "The layer group to move");
1201 parm = RNA_def_enum(
1202 func, "type", rna_enum_tree_node_move_type_items, 1, "", "Direction of movement");
1204
1205 func = RNA_def_function(srna, "move_top", "rna_GreasePencil_layer_group_move_top");
1207 func, "Move a layer group to the top of the parent layer group or main stack");
1208 parm = RNA_def_pointer(
1209 func, "layer_group", "GreasePencilLayerGroup", "", "The layer group to move");
1212
1213 func = RNA_def_function(srna, "move_bottom", "rna_GreasePencil_layer_group_move_bottom");
1215 func, "Move a layer group to the bottom of the parent layer group or main stack");
1216 parm = RNA_def_pointer(
1217 func, "layer_group", "GreasePencilLayerGroup", "", "The layer group to move");
1220
1221 func = RNA_def_function(
1222 srna, "move_to_layer_group", "rna_GreasePencil_layer_group_move_to_layer_group");
1223 RNA_def_function_ui_description(func, "Move a layer group into a parent layer group");
1224 parm = RNA_def_pointer(
1225 func, "layer_group", "GreasePencilLayerGroup", "", "The layer group to move");
1228 parm = RNA_def_pointer(func,
1229 "parent_group",
1230 "GreasePencilLayerGroup",
1231 "",
1232 "The parent layer group the layer group will be moved into (use "
1233 "None for the main stack)");
1236}
1237
1238} // namespace blender
1239
1240#endif
Low-level operations for curves.
support for deformation groups and hooks.
Low-level operations for grease pencil.
Utility functions for vertex groups in grease pencil objects.
#define MAX_NAME
Definition DNA_defs.h:63
#define MINAFRAME
#define MAXFRAME
#define WEIGHT_REPLACE
#define WEIGHT_ADD
#define WEIGHT_SUBTRACT
#define C
Definition RandGen.cpp:29
#define NC_GEOM
Definition WM_types.hh:406
#define ND_DATA
Definition WM_types.hh:552
#define ND_VERTEX_GROUP
Definition WM_types.hh:553
#define NA_EDITED
Definition WM_types.hh:634
#define NC_GPENCIL
Definition WM_types.hh:412
#define NA_SELECTED
Definition WM_types.hh:639
#define STREQ(a, b)
Definition scene.h:133
#define FLT_MAX
#define INT_MAX
#define FLT_EPSILON
#define layer
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
std::optional< GeoMismatch > compare_grease_pencil(const GreasePencil &grease_pencil_1, const GreasePencil &grease_pencil_2, float threshold)
Checks if two Grease Pencil geometries are different, returning the type of mismatch if any.
const char * mismatch_to_string(const GeoMismatch &mismatch)
int ensure_vertex_group(StringRef name, ListBaseT< bDeformGroup > &vertex_group_names)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
Definition BLI_task.hh:69
BMesh Iterators.
void WM_main_add_notifier(uint type, void *reference)
void RNA_api_grease_pencil_layer_masks(StructRNA *srna)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
void RNA_api_grease_pencil_drawing(StructRNA *srna)
void RNA_api_grease_pencil(StructRNA *srna)
PropertyRNA * RNA_def_float_array(StructOrFunctionRNA *cont_, const char *identifier, const int len, const float *default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
void RNA_api_grease_pencil_layers(StructRNA *srna)
const EnumPropertyItem rna_enum_curves_type_items[]
Definition rna_curves.cc:26
@ FUNC_USE_REPORTS
@ FUNC_USE_SELF_ID
Definition RNA_types.hh:980
@ FUNC_USE_CONTEXT
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
int BKE_defgroup_name_index(const ListBaseT< bDeformGroup > *defbase, StringRef name)
Definition deform.cc:544
PropertyRNA * RNA_def_float_factor(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:541
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:593
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_api_grease_pencil_layer(StructRNA *srna)
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:138
void DEG_id_tag_update(ID *id, unsigned int flags)
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:162
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
MDeformWeight * BKE_defvert_ensure_index(MDeformVert *dv, int defgroup)
Definition deform.cc:830
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier_c_str, const char *call)
void RNA_def_function_flag(FunctionRNA *func, FunctionFlag flag)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
Definition report.cc:191
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:118
@ CURVE_TYPE_CATMULL_ROM
void RNA_api_grease_pencil_layer_groups(StructRNA *srna)
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1074
@ PROP_DYNAMIC
Definition RNA_types.hh:498
@ PROP_THICK_WRAP
Definition RNA_types.hh:493
@ PROP_NEVER_NULL
Definition RNA_types.hh:447
void RNA_api_grease_pencil_frames(StructRNA *srna)
PropertyRNA * RNA_def_int_array(StructOrFunctionRNA *cont_, const char *identifier, const int len, const int *default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
const EnumPropertyItem rna_enum_tree_node_move_type_items[]
Scene * CTX_data_scene(const bContext *C)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
@ PARM_REQUIRED
Definition RNA_types.hh:631
@ PARM_RNAPTR
Definition RNA_types.hh:633
void BKE_defvert_remove_group(MDeformVert *dvert, MDeformWeight *dw)
Definition deform.cc:885
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
MDeformWeight * BKE_defvert_find_index(const MDeformVert *dv, int defgroup)
Definition deform.cc:811