Blender V5.3
rna_mask.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cstdlib>
10
11#include "DNA_mask_types.h"
12#include "DNA_object_types.h" /* SELECT */
13#include "DNA_scene_types.h"
14
15#include "BLT_translation.hh"
16
17#include "RNA_define.hh"
18#include "RNA_enum_types.hh"
19
20#include "rna_internal.hh"
21
22#include "WM_types.hh"
23
24#ifdef RNA_RUNTIME
25
26# include <algorithm>
27# include <fmt/format.h>
28
29# include "DNA_movieclip_types.h"
30
31# include "BLI_listbase.hh"
32# include "BLI_math_vector_c.hh"
33# include "BLI_string.hh"
34# include "BLI_string_utf8.hh"
35
36# include "BKE_global.hh"
37# include "BKE_mask.hh"
38# include "BKE_movieclip.hh"
39# include "BKE_tracking.hh"
40
41# include "DEG_depsgraph.hh"
42
43# include "RNA_access.hh"
44
45# include "WM_api.hh"
46
47namespace blender {
48
49static void rna_Mask_update_data(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
50{
51 Mask *mask = id_cast<Mask *>(ptr->owner_id);
52
54 DEG_id_tag_update(&mask->id, 0);
55}
56
57static void rna_Mask_update_parent(Main *bmain, Scene *scene, PointerRNA *ptr)
58{
59 MaskParent *parent = static_cast<MaskParent *>(ptr->data);
60
61 if (parent->id) {
62 if (GS(parent->id->name) == ID_MC) {
63 MovieClip *clip = id_cast<MovieClip *>(parent->id);
64 MovieTracking *tracking = &clip->tracking;
65 MovieTrackingObject *tracking_object = BKE_tracking_object_get_named(tracking,
66 parent->parent);
67
68 if (tracking_object) {
69 int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(clip, scene->r.cfra);
70
71 if (parent->type == MASK_PARENT_POINT_TRACK) {
73 parent->sub_parent);
74
75 if (track) {
76 MovieTrackingMarker *marker = BKE_tracking_marker_get(track, clip_framenr);
77 float marker_pos_ofs[2], parmask_pos[2];
78 MovieClipUser user = {};
79
80 BKE_movieclip_user_set_frame(&user, scene->r.cfra);
81
82 add_v2_v2v2(marker_pos_ofs, marker->pos, track->offset);
83
84 BKE_mask_coord_from_movieclip(clip, &user, parmask_pos, marker_pos_ofs);
85
86 copy_v2_v2(parent->parent_orig, parmask_pos);
87 }
88 }
89 else /* if (parent->type == MASK_PARENT_PLANE_TRACK) */ {
91 tracking_object, parent->sub_parent);
92 if (plane_track) {
94 clip_framenr);
95
96 memcpy(parent->parent_corners_orig,
97 plane_marker->corners,
98 sizeof(parent->parent_corners_orig));
99 zero_v2(parent->parent_orig);
100 }
101 }
102 }
103 }
104 }
105
106 rna_Mask_update_data(bmain, scene, ptr);
107}
108
109static StructRNA *rna_MaskParent_id_typef(PointerRNA *ptr)
110{
111 MaskParent *mpar = static_cast<MaskParent *>(ptr->data);
112
113 return ID_code_to_RNA_type(mpar->id_type);
114}
115
116static void rna_MaskParent_id_type_set(PointerRNA *ptr, int value)
117{
118 MaskParent *mpar = static_cast<MaskParent *>(ptr->data);
119
120 /* change ID-type to the new type */
121 mpar->id_type = value;
122
123 /* clear the id-block if the type is invalid */
124 if ((mpar->id) && (GS(mpar->id->name) != mpar->id_type)) {
125 mpar->id = nullptr;
126 }
127}
128
129static void rna_Mask_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
130{
131 Mask *mask = id_cast<Mask *>(ptr->owner_id);
132
133 rna_iterator_listbase_begin(iter, ptr, &mask->masklayers, nullptr);
134}
135
136static int rna_Mask_layer_active_index_get(PointerRNA *ptr)
137{
138 Mask *mask = id_cast<Mask *>(ptr->owner_id);
139
140 return mask->masklay_act;
141}
142
143static void rna_Mask_layer_active_index_set(PointerRNA *ptr, int value)
144{
145 Mask *mask = id_cast<Mask *>(ptr->owner_id);
146
147 mask->masklay_act = value;
148}
149
150static void rna_Mask_layer_active_index_range(
151 PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
152{
153 Mask *mask = id_cast<Mask *>(ptr->owner_id);
154
155 *min = 0;
156 *max = max_ii(0, mask->masklay_tot - 1);
157
158 *softmin = *min;
159 *softmax = *max;
160}
161
162static std::optional<std::string> rna_MaskLayer_path(const PointerRNA *ptr)
163{
164 const MaskLayer *masklay = static_cast<MaskLayer *>(ptr->data);
165 char name_esc[sizeof(masklay->name) * 2];
166 BLI_str_escape(name_esc, masklay->name, sizeof(name_esc));
167 return fmt::format("layers[\"{}\"]", name_esc);
168}
169
170static PointerRNA rna_Mask_layer_active_get(PointerRNA *ptr)
171{
172 Mask *mask = id_cast<Mask *>(ptr->owner_id);
174
175 return RNA_pointer_create_with_parent(*ptr, RNA_MaskLayer, masklay);
176}
177
178static void rna_Mask_layer_active_set(PointerRNA *ptr, PointerRNA value, ReportList * /*reports*/)
179{
180 Mask *mask = id_cast<Mask *>(ptr->owner_id);
181 MaskLayer *masklay = static_cast<MaskLayer *>(value.data);
182
184}
185
186static void rna_MaskLayer_splines_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
187{
188 MaskLayer *masklay = static_cast<MaskLayer *>(ptr->data);
189
190 rna_iterator_listbase_begin(iter, ptr, &masklay->splines, nullptr);
191}
192
193static void rna_MaskLayer_name_set(PointerRNA *ptr, const char *value)
194{
195 Mask *mask = id_cast<Mask *>(ptr->owner_id);
196 MaskLayer *masklay = static_cast<MaskLayer *>(ptr->data);
197 char oldname[sizeof(masklay->name)], newname[sizeof(masklay->name)];
198
199 /* need to be on the stack */
200 STRNCPY(oldname, masklay->name);
201 STRNCPY_UTF8(newname, value);
202
203 BKE_mask_layer_rename(*G_MAIN, mask, masklay, oldname, newname);
204}
205
206static PointerRNA rna_MaskLayer_active_spline_get(PointerRNA *ptr)
207{
208 MaskLayer *masklay = static_cast<MaskLayer *>(ptr->data);
209
210 return RNA_pointer_create_with_parent(*ptr, RNA_MaskSpline, masklay->act_spline);
211}
212
213static void rna_MaskLayer_active_spline_set(PointerRNA *ptr,
214 PointerRNA value,
215 ReportList * /*reports*/)
216{
217 MaskLayer *masklay = static_cast<MaskLayer *>(ptr->data);
218 MaskSpline *spline = static_cast<MaskSpline *>(value.data);
219 int index = BLI_findindex(&masklay->splines, spline);
220
221 if (index != -1) {
222 masklay->act_spline = spline;
223 }
224 else {
225 masklay->act_spline = nullptr;
226 }
227}
228
229static PointerRNA rna_MaskLayer_active_spline_point_get(PointerRNA *ptr)
230{
231 MaskLayer *masklay = static_cast<MaskLayer *>(ptr->data);
232
233 return RNA_pointer_create_with_parent(*ptr, RNA_MaskSplinePoint, masklay->act_point);
234}
235
236static void rna_MaskLayer_active_spline_point_set(PointerRNA *ptr,
237 PointerRNA value,
238 ReportList * /*reports*/)
239{
240 MaskLayer *masklay = static_cast<MaskLayer *>(ptr->data);
241 MaskSpline *spline;
242 MaskSplinePoint *point = static_cast<MaskSplinePoint *>(value.data);
243
244 masklay->act_point = nullptr;
245
246 for (spline = masklay->splines.first(); spline; spline = spline->next) {
247 if (point >= spline->points && point < spline->points + spline->tot_point) {
248 masklay->act_point = point;
249
250 break;
251 }
252 }
253}
254
255static void rna_MaskSplinePoint_handle1_get(PointerRNA *ptr, float *values)
256{
257 MaskSplinePoint *point = static_cast<MaskSplinePoint *>(ptr->data);
258 BezTriple *bezt = &point->bezt;
259 copy_v2_v2(values, bezt->vec[0]);
260}
261
262static void rna_MaskSplinePoint_handle1_set(PointerRNA *ptr, const float *values)
263{
264 MaskSplinePoint *point = static_cast<MaskSplinePoint *>(ptr->data);
265 BezTriple *bezt = &point->bezt;
266 copy_v2_v2(bezt->vec[0], values);
267}
268
269static void rna_MaskSplinePoint_handle2_get(PointerRNA *ptr, float *values)
270{
271 MaskSplinePoint *point = static_cast<MaskSplinePoint *>(ptr->data);
272 BezTriple *bezt = &point->bezt;
273 copy_v2_v2(values, bezt->vec[2]);
274}
275
276static void rna_MaskSplinePoint_handle2_set(PointerRNA *ptr, const float *values)
277{
278 MaskSplinePoint *point = static_cast<MaskSplinePoint *>(ptr->data);
279 BezTriple *bezt = &point->bezt;
280 copy_v2_v2(bezt->vec[2], values);
281}
282
283static void rna_MaskSplinePoint_ctrlpoint_get(PointerRNA *ptr, float *values)
284{
285 MaskSplinePoint *point = static_cast<MaskSplinePoint *>(ptr->data);
286 BezTriple *bezt = &point->bezt;
287 copy_v2_v2(values, bezt->vec[1]);
288}
289
290static void rna_MaskSplinePoint_ctrlpoint_set(PointerRNA *ptr, const float *values)
291{
292 MaskSplinePoint *point = static_cast<MaskSplinePoint *>(ptr->data);
293 BezTriple *bezt = &point->bezt;
294 copy_v2_v2(bezt->vec[1], values);
295}
296
297static int rna_MaskSplinePoint_handle_type_get(PointerRNA *ptr)
298{
299 MaskSplinePoint *point = static_cast<MaskSplinePoint *>(ptr->data);
300 BezTriple *bezt = &point->bezt;
301
302 return bezt->h1;
303}
304
305static MaskSpline *mask_spline_from_point(Mask *mask, MaskSplinePoint *point)
306{
307 MaskLayer *mask_layer;
308 for (mask_layer = mask->masklayers.first(); mask_layer; mask_layer = mask_layer->next) {
309 MaskSpline *spline;
310 for (spline = mask_layer->splines.first(); spline; spline = spline->next) {
311 if (point >= spline->points && point < spline->points + spline->tot_point) {
312 return spline;
313 }
314 }
315 }
316 return nullptr;
317}
318
319static void mask_point_check_stick(MaskSplinePoint *point)
320{
321 BezTriple *bezt = &point->bezt;
322 if (bezt->h1 == HD_ALIGN && bezt->h2 == HD_ALIGN) {
323 float vec[3];
324 sub_v3_v3v3(vec, bezt->vec[0], bezt->vec[1]);
325 add_v3_v3v3(bezt->vec[2], bezt->vec[1], vec);
326 }
327}
328
329static void rna_MaskSplinePoint_handle_type_set(PointerRNA *ptr, int value)
330{
331 MaskSplinePoint *point = static_cast<MaskSplinePoint *>(ptr->data);
332 BezTriple *bezt = &point->bezt;
333 MaskSpline *spline = mask_spline_from_point(id_cast<Mask *>(ptr->owner_id), point);
334
335 bezt->h1 = bezt->h2 = eBezTriple_Handle(value);
336 mask_point_check_stick(point);
337 BKE_mask_calc_handle_point(spline, point);
338}
339
340static int rna_MaskSplinePoint_handle_left_type_get(PointerRNA *ptr)
341{
342 MaskSplinePoint *point = static_cast<MaskSplinePoint *>(ptr->data);
343 BezTriple *bezt = &point->bezt;
344
345 return bezt->h1;
346}
347
348static void rna_MaskSplinePoint_handle_left_type_set(PointerRNA *ptr, int value)
349{
350 MaskSplinePoint *point = static_cast<MaskSplinePoint *>(ptr->data);
351 BezTriple *bezt = &point->bezt;
352 MaskSpline *spline = mask_spline_from_point(id_cast<Mask *>(ptr->owner_id), point);
353
354 bezt->h1 = eBezTriple_Handle(value);
355 mask_point_check_stick(point);
356 BKE_mask_calc_handle_point(spline, point);
357}
358
359static int rna_MaskSplinePoint_handle_right_type_get(PointerRNA *ptr)
360{
361 MaskSplinePoint *point = static_cast<MaskSplinePoint *>(ptr->data);
362 BezTriple *bezt = &point->bezt;
363
364 return bezt->h2;
365}
366
367static void rna_MaskSplinePoint_handle_right_type_set(PointerRNA *ptr, int value)
368{
369 MaskSplinePoint *point = static_cast<MaskSplinePoint *>(ptr->data);
370 BezTriple *bezt = &point->bezt;
371 MaskSpline *spline = mask_spline_from_point(id_cast<Mask *>(ptr->owner_id), point);
372
373 bezt->h2 = eBezTriple_Handle(value);
374 mask_point_check_stick(point);
375 BKE_mask_calc_handle_point(spline, point);
376}
377
378/* ** API ** */
379
380static MaskLayer *rna_Mask_layers_new(Mask *mask, const char *name)
381{
382 MaskLayer *masklay = BKE_mask_layer_new(mask, name);
383
385
386 return masklay;
387}
388
389static void rna_Mask_layers_remove(Mask *mask, ReportList *reports, PointerRNA *masklay_ptr)
390{
391 MaskLayer *masklay = static_cast<MaskLayer *>(masklay_ptr->data);
392 if (BLI_findindex(&mask->masklayers, masklay) == -1) {
393 BKE_reportf(reports,
394 RPT_ERROR,
395 "Mask layer '%s' not found in mask '%s'",
396 masklay->name,
397 mask->id.name + 2);
398 return;
399 }
400
401 BKE_mask_layer_remove(mask, masklay);
402 masklay_ptr->invalidate();
403
405}
406
407static void rna_Mask_layers_clear(Mask *mask)
408{
409 BKE_mask_layer_free_list(&mask->masklayers);
410
412}
413
414static void rna_MaskSplinePoint_handle_single_select_set(PointerRNA *ptr, bool value)
415{
416 Mask *mask = id_cast<Mask *>(ptr->owner_id);
417 MaskSplinePoint *point = static_cast<MaskSplinePoint *>(ptr->data);
418
420
423}
424
425static bool rna_MaskSplinePoint_handle_single_select_get(PointerRNA *ptr)
426{
427 MaskSplinePoint *point = static_cast<MaskSplinePoint *>(ptr->data);
428
430}
431
432static MaskSpline *rna_MaskLayer_spline_new(ID *id, MaskLayer *mask_layer)
433{
434 Mask *mask = id_cast<Mask *>(id);
435 MaskSpline *new_spline;
436
437 new_spline = BKE_mask_spline_add(mask_layer);
438
440
441 return new_spline;
442}
443
444static void rna_MaskLayer_spline_remove(ID *id,
445 MaskLayer *mask_layer,
446 ReportList *reports,
447 PointerRNA *spline_ptr)
448{
449 Mask *mask = id_cast<Mask *>(id);
450 MaskSpline *spline = static_cast<MaskSpline *>(spline_ptr->data);
451
452 if (BKE_mask_spline_remove(mask_layer, spline) == false) {
454 reports, RPT_ERROR, "Mask layer '%s' does not contain spline given", mask_layer->name);
455 return;
456 }
457
458 spline_ptr->invalidate();
459
461}
462
463static void rna_Mask_start_frame_set(PointerRNA *ptr, int value)
464{
465 Mask *data = static_cast<Mask *>(ptr->data);
466 /* MINFRAME not MINAFRAME, since some output formats can't taken negative frames */
467 CLAMP(value, MINFRAME, MAXFRAME);
468 data->sfra = value;
469
470 if (data->sfra >= data->efra) {
471 data->efra = std::min(data->sfra, MAXFRAME);
472 }
473}
474
475static void rna_Mask_end_frame_set(PointerRNA *ptr, int value)
476{
477 Mask *data = static_cast<Mask *>(ptr->data);
478 CLAMP(value, MINFRAME, MAXFRAME);
479 data->efra = value;
480
481 if (data->sfra >= data->efra) {
482 data->sfra = std::max(data->efra, MINFRAME);
483 }
484}
485
486static void rna_MaskSpline_points_add(ID *id, MaskSpline *spline, int count)
487{
488 Mask *mask = id_cast<Mask *>(id);
490 int active_point_index = -1;
491 int i, spline_shape_index;
492
493 if (count <= 0) {
494 return;
495 }
496
497 for (layer = mask->masklayers.first(); layer; layer = layer->next) {
498 if (BLI_findindex(&layer->splines, spline) != -1) {
499 break;
500 }
501 }
502
503 if (!layer) {
504 /* Shall not happen actually */
505 BLI_assert_msg(0, "No layer found for the spline");
506 return;
507 }
508
509 if (layer->act_spline == spline) {
510 active_point_index = layer->act_point - spline->points;
511 }
512
513 spline->points = static_cast<MaskSplinePoint *>(
514 MEM_realloc_zeroed(spline->points, sizeof(MaskSplinePoint) * (spline->tot_point + count)));
515 spline->tot_point += count;
516
517 if (active_point_index >= 0) {
518 layer->act_point = spline->points + active_point_index;
519 }
520
521 spline_shape_index = BKE_mask_layer_shape_spline_to_index(layer, spline);
522
523 for (i = 0; i < count; i++) {
524 int point_index = spline->tot_point - count + i;
525 MaskSplinePoint *new_point = spline->points + point_index;
526 new_point->bezt.h1 = new_point->bezt.h2 = HD_ALIGN;
527 BKE_mask_calc_handle_point_auto(spline, new_point, true);
528 BKE_mask_parent_init(&new_point->parent);
529
530 /* Not efficient, but there's no other way for now */
531 BKE_mask_layer_shape_changed_add(layer, spline_shape_index + point_index, true, true);
532 }
533
535 DEG_id_tag_update(&mask->id, 0);
536}
537
538static void rna_MaskSpline_point_remove(ID *id,
539 MaskSpline *spline,
540 ReportList *reports,
541 PointerRNA *point_ptr)
542{
543 Mask *mask = id_cast<Mask *>(id);
544 MaskSplinePoint *point = static_cast<MaskSplinePoint *>(point_ptr->data);
545 MaskSplinePoint *new_point_array;
547 int active_point_index = -1;
548 int point_index;
549
550 for (layer = mask->masklayers.first(); layer; layer = layer->next) {
551 if (BLI_findindex(&layer->splines, spline) != -1) {
552 break;
553 }
554 }
555
556 if (!layer) {
557 /* Shall not happen actually */
558 BKE_report(reports, RPT_ERROR, "Mask layer not found for given spline");
559 return;
560 }
561
562 if (point < spline->points || point >= spline->points + spline->tot_point) {
563 BKE_report(reports, RPT_ERROR, "Point is not found in given spline");
564 return;
565 }
566
567 if (layer->act_spline == spline) {
568 active_point_index = layer->act_point - spline->points;
569 }
570
571 point_index = point - spline->points;
572
573 new_point_array = MEM_new_array<MaskSplinePoint>(size_t(spline->tot_point) - 1,
574 "remove mask point");
575
576 memcpy(new_point_array, spline->points, sizeof(MaskSplinePoint) * point_index);
577 memcpy(new_point_array + point_index,
578 spline->points + point_index + 1,
579 sizeof(MaskSplinePoint) * (spline->tot_point - point_index - 1));
580
581 MEM_delete(spline->points);
582 spline->points = new_point_array;
583 spline->tot_point--;
584
585 if (active_point_index >= 0) {
586 if (active_point_index == point_index) {
587 layer->act_point = nullptr;
588 }
589 else if (active_point_index < point_index) {
590 layer->act_point = spline->points + active_point_index;
591 }
592 else {
593 layer->act_point = spline->points + active_point_index - 1;
594 }
595 }
596
598 layer, BKE_mask_layer_shape_spline_to_index(layer, spline) + point_index, 1);
599
601 DEG_id_tag_update(&mask->id, 0);
602
603 point_ptr->invalidate();
604}
605
606} // namespace blender
607
608#else
609
610namespace blender {
611
613{
614 StructRNA *srna;
615 PropertyRNA *prop;
616
617 static const EnumPropertyItem mask_id_type_items[] = {
618 {ID_MC, "MOVIECLIP", ICON_SEQUENCE, "Movie Clip", ""},
619 {0, nullptr, 0, nullptr, nullptr},
620 };
621
622 static const EnumPropertyItem parent_type_items[] = {
623 {MASK_PARENT_POINT_TRACK, "POINT_TRACK", 0, "Point Track", ""},
624 {MASK_PARENT_PLANE_TRACK, "PLANE_TRACK", 0, "Plane Track", ""},
625 {0, nullptr, 0, nullptr, nullptr},
626 };
627
628 srna = RNA_def_struct(brna, "MaskParent", nullptr);
629 RNA_def_struct_ui_text(srna, "Mask Parent", "Parenting settings for masking element");
630
631 /* Target Properties - ID-block to Drive */
632 prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
636 // RNA_def_property_editable_func(prop, "rna_maskSpline_id_editable");
637 RNA_def_property_pointer_funcs(prop, nullptr, nullptr, "rna_MaskParent_id_typef", nullptr);
639 prop, "ID", "ID-block to which masking element would be parented to or to its property");
640 RNA_def_property_update(prop, 0, "rna_Mask_update_parent");
641
642 prop = RNA_def_property(srna, "id_type", PROP_ENUM, PROP_NONE);
643 RNA_def_property_enum_sdna(prop, nullptr, "id_type");
644 RNA_def_property_enum_items(prop, mask_id_type_items);
646 RNA_def_property_enum_funcs(prop, nullptr, "rna_MaskParent_id_type_set", nullptr);
647 // RNA_def_property_editable_func(prop, "rna_MaskParent_id_type_editable");
648 RNA_def_property_ui_text(prop, "ID Type", "Type of ID-block that can be used");
649 RNA_def_property_update(prop, 0, "rna_Mask_update_parent");
650
651 /* type */
652 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
653 RNA_def_property_enum_items(prop, parent_type_items);
654 RNA_def_property_ui_text(prop, "Parent Type", "Parent Type");
655 RNA_def_property_update(prop, 0, "rna_Mask_update_parent");
656
657 /* parent */
658 prop = RNA_def_property(srna, "parent", PROP_STRING, PROP_NONE);
660 prop, "Parent", "Name of parent object in specified data-block to which parenting happens");
662 RNA_def_property_update(prop, 0, "rna_Mask_update_parent");
663
664 /* sub_parent */
665 prop = RNA_def_property(srna, "sub_parent", PROP_STRING, PROP_NONE);
667 prop,
668 "Sub Parent",
669 "Name of parent sub-object in specified data-block to which parenting happens");
671 RNA_def_property_update(prop, 0, "rna_Mask_update_parent");
672}
673
675{
676 StructRNA *srna;
677 PropertyRNA *prop;
678
679 srna = RNA_def_struct(brna, "MaskSplinePointUW", nullptr);
681 srna, "Mask Spline UW Point", "Single point in spline segment defining feather");
682
683 /* u */
684 prop = RNA_def_property(srna, "u", PROP_FLOAT, PROP_NONE);
685 RNA_def_property_float_sdna(prop, nullptr, "u");
686 RNA_def_property_range(prop, 0.0, 1.0);
687 RNA_def_property_ui_text(prop, "U", "U coordinate of point along spline segment");
688 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
689
690 /* weight */
691 prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
692 RNA_def_property_float_sdna(prop, nullptr, "w");
693 RNA_def_property_range(prop, 0.0, 1.0);
694 RNA_def_property_ui_text(prop, "Weight", "Weight of feather point");
695 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
696
697 /* select */
698 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
699 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SELECT);
700 RNA_def_property_ui_text(prop, "Select", "Selection status");
701 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
702}
703
705{
706 StructRNA *srna;
707 PropertyRNA *prop;
708
709 static const EnumPropertyItem handle_type_items[] = {
710 {HD_AUTO, "AUTO", 0, "Auto", ""},
711 {HD_VECT, "VECTOR", 0, "Vector", ""},
712 {HD_ALIGN, "ALIGNED", 0, "Aligned Single", ""},
713 {HD_ALIGN_DOUBLESIDE, "ALIGNED_DOUBLESIDE", 0, "Aligned", ""},
714 {HD_FREE, "FREE", 0, "Free", ""},
715 {0, nullptr, 0, nullptr, nullptr},
716 };
717
719
720 srna = RNA_def_struct(brna, "MaskSplinePoint", nullptr);
722 srna, "Mask Spline Point", "Single point in spline used for defining mask");
723
724 /* Vector values */
725 prop = RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_TRANSLATION);
726 RNA_def_property_array(prop, 2);
728 prop, "rna_MaskSplinePoint_handle1_get", "rna_MaskSplinePoint_handle1_set", nullptr);
729 RNA_def_property_ui_text(prop, "Handle 1", "Coordinates of the first handle");
730 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
731
732 prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
733 RNA_def_property_array(prop, 2);
735 prop, "rna_MaskSplinePoint_ctrlpoint_get", "rna_MaskSplinePoint_ctrlpoint_set", nullptr);
736 RNA_def_property_ui_text(prop, "Control Point", "Coordinates of the control point");
737 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
738
739 prop = RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_TRANSLATION);
740 RNA_def_property_array(prop, 2);
742 prop, "rna_MaskSplinePoint_handle2_get", "rna_MaskSplinePoint_handle2_set", nullptr);
743 RNA_def_property_ui_text(prop, "Handle 2", "Coordinates of the second handle");
744 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
745
746 /* handle_type */
747 prop = RNA_def_property(srna, "handle_type", PROP_ENUM, PROP_NONE);
749 prop, "rna_MaskSplinePoint_handle_type_get", "rna_MaskSplinePoint_handle_type_set", nullptr);
750 RNA_def_property_enum_items(prop, handle_type_items);
751 RNA_def_property_ui_text(prop, "Handle Type", "Handle type");
752 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
753
754 /* handle_type */
755 prop = RNA_def_property(srna, "handle_left_type", PROP_ENUM, PROP_NONE);
757 "rna_MaskSplinePoint_handle_left_type_get",
758 "rna_MaskSplinePoint_handle_left_type_set",
759 nullptr);
760 RNA_def_property_enum_items(prop, handle_type_items);
761 RNA_def_property_ui_text(prop, "Handle 1 Type", "Handle type");
762 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
763
764 /* handle_right */
765 prop = RNA_def_property(srna, "handle_right_type", PROP_ENUM, PROP_NONE);
767 "rna_MaskSplinePoint_handle_right_type_get",
768 "rna_MaskSplinePoint_handle_right_type_set",
769 nullptr);
770 RNA_def_property_enum_items(prop, handle_type_items);
771 RNA_def_property_ui_text(prop, "Handle 2 Type", "Handle type");
772 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
773
774 /* weight */
775 prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
776 RNA_def_property_float_sdna(prop, nullptr, "bezt.weight");
777 RNA_def_property_range(prop, 0.0, 1.0);
778 RNA_def_property_ui_text(prop, "Weight", "Weight of the point");
779 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
780
781 /* select */
782
783 /* DEPRECATED */
784 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
785 RNA_def_property_boolean_sdna(prop, nullptr, "bezt.f2", SELECT);
787 prop,
788 "Select",
789 "Selection status of the control point. (Deprecated: use Select Control Point instead)");
790 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
791
792 prop = RNA_def_property(srna, "select_left_handle", PROP_BOOLEAN, PROP_NONE);
793 RNA_def_property_boolean_sdna(prop, nullptr, "bezt.f1", SELECT);
794 RNA_def_property_ui_text(prop, "Select Left Handle", "Selection status of the left handle");
795 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
796
797 prop = RNA_def_property(srna, "select_control_point", PROP_BOOLEAN, PROP_NONE);
798 RNA_def_property_boolean_sdna(prop, nullptr, "bezt.f2", SELECT);
799 RNA_def_property_ui_text(prop, "Select Control Point", "Selection status of the control point");
800 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
801
802 prop = RNA_def_property(srna, "select_right_handle", PROP_BOOLEAN, PROP_NONE);
803 RNA_def_property_boolean_sdna(prop, nullptr, "bezt.f3", SELECT);
804 RNA_def_property_ui_text(prop, "Select Right Handle", "Selection status of the right handle");
805 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
806
807 prop = RNA_def_property(srna, "select_single_handle", PROP_BOOLEAN, PROP_NONE);
809 "rna_MaskSplinePoint_handle_single_select_get",
810 "rna_MaskSplinePoint_handle_single_select_set");
812 prop, "Select Aligned Single Handle", "Selection status of the Aligned Single handle");
813 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
814
815 /* parent */
816 prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
817 RNA_def_property_struct_type(prop, "MaskParent");
818
819 /* feather points */
820 prop = RNA_def_property(srna, "feather_points", PROP_COLLECTION, PROP_NONE);
821 RNA_def_property_struct_type(prop, "MaskSplinePointUW");
822 RNA_def_property_collection_sdna(prop, nullptr, "uw", "tot_uw");
823 RNA_def_property_ui_text(prop, "Feather Points", "Points defining feather");
824}
825
827{
828 StructRNA *srna;
829 FunctionRNA *func;
830 PropertyRNA *prop;
831 PropertyRNA *parm;
832
833 srna = RNA_def_struct(brna, "MaskSplines", nullptr);
834 RNA_def_struct_sdna(srna, "MaskLayer");
835 RNA_def_struct_ui_text(srna, "Mask Splines", "Collection of masking splines");
836
837 /* Create new spline */
838 func = RNA_def_function(srna, "new", "rna_MaskLayer_spline_new");
840 RNA_def_function_ui_description(func, "Add a new spline to the layer");
841 parm = RNA_def_pointer(func, "spline", "MaskSpline", "", "The newly created spline");
843 RNA_def_function_return(func, parm);
844
845 /* Remove the spline */
846 func = RNA_def_function(srna, "remove", "rna_MaskLayer_spline_remove");
848 RNA_def_function_ui_description(func, "Remove a spline from a layer");
850 parm = RNA_def_pointer(func, "spline", "MaskSpline", "", "The spline to remove");
853
854 /* active spline */
855 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
856 RNA_def_property_struct_type(prop, "MaskSpline");
858 "rna_MaskLayer_active_spline_get",
859 "rna_MaskLayer_active_spline_set",
860 nullptr,
861 nullptr);
863 RNA_def_property_ui_text(prop, "Active Spline", "Active spline of masking layer");
864
865 /* active point */
866 prop = RNA_def_property(srna, "active_point", PROP_POINTER, PROP_NONE);
867 RNA_def_property_struct_type(prop, "MaskSplinePoint");
869 "rna_MaskLayer_active_spline_point_get",
870 "rna_MaskLayer_active_spline_point_set",
871 nullptr,
872 nullptr);
874 RNA_def_property_ui_text(prop, "Active Point", "Active point of masking layer");
875}
876
878{
879 StructRNA *srna;
880 FunctionRNA *func;
881 PropertyRNA *parm;
882
883 srna = RNA_def_struct(brna, "MaskSplinePoints", nullptr);
884 RNA_def_struct_sdna(srna, "MaskSpline");
885 RNA_def_struct_ui_text(srna, "Mask Spline Points", "Collection of masking spline points");
886
887 /* Create new point */
888 func = RNA_def_function(srna, "add", "rna_MaskSpline_points_add");
890 RNA_def_function_ui_description(func, "Add a number of point to this spline");
891 parm = RNA_def_int(
892 func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX);
894
895 /* Remove the point */
896 func = RNA_def_function(srna, "remove", "rna_MaskSpline_point_remove");
898 RNA_def_function_ui_description(func, "Remove a point from a spline");
900 parm = RNA_def_pointer(func, "point", "MaskSplinePoint", "", "The point to remove");
903}
904
906{
907 static const EnumPropertyItem spline_interpolation_items[] = {
908 {MASK_SPLINE_INTERP_LINEAR, "LINEAR", 0, "Linear", ""},
909 {MASK_SPLINE_INTERP_EASE, "EASE", 0, "Ease", ""},
910 {0, nullptr, 0, nullptr, nullptr},
911 };
912
913 static const EnumPropertyItem spline_offset_mode_items[] = {
914 {MASK_SPLINE_OFFSET_EVEN, "EVEN", 0, "Even", "Calculate even feather offset"},
916 "SMOOTH",
917 0,
918 "Smooth",
919 "Calculate feather offset as a second curve"},
920 {0, nullptr, 0, nullptr, nullptr},
921 };
922
923 StructRNA *srna;
924 PropertyRNA *prop;
925
927
928 srna = RNA_def_struct(brna, "MaskSpline", nullptr);
929 RNA_def_struct_ui_text(srna, "Mask spline", "Single spline used for defining mask shape");
930
931 /* offset mode */
932 prop = RNA_def_property(srna, "offset_mode", PROP_ENUM, PROP_NONE);
933 RNA_def_property_enum_sdna(prop, nullptr, "offset_mode");
934 RNA_def_property_enum_items(prop, spline_offset_mode_items);
936 prop, "Feather Offset", "The method used for calculating the feather offset");
938 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
939
940 /* weight interpolation */
941 prop = RNA_def_property(srna, "weight_interpolation", PROP_ENUM, PROP_NONE);
942 RNA_def_property_enum_sdna(prop, nullptr, "weight_interp");
943 RNA_def_property_enum_items(prop, spline_interpolation_items);
945 prop, "Weight Interpolation", "The type of weight interpolation for spline");
946 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
947
948 /* cyclic */
949 prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
952 RNA_def_property_ui_text(prop, "Cyclic", "Make this spline a closed loop");
953 RNA_def_property_update(prop, NC_MASK | NA_EDITED, "rna_Mask_update_data");
954
955 /* fill */
956 prop = RNA_def_property(srna, "use_fill", PROP_BOOLEAN, PROP_NONE);
959 RNA_def_property_ui_text(prop, "Fill", "Make this spline filled");
961 RNA_def_property_update(prop, NC_MASK | NA_EDITED, "rna_Mask_update_data");
962
963 /* self-intersection check */
964 prop = RNA_def_property(srna, "use_self_intersection_check", PROP_BOOLEAN, PROP_NONE);
968 prop, "Self Intersection Check", "Prevent feather from self-intersections");
969 RNA_def_property_update(prop, NC_MASK | NA_EDITED, "rna_Mask_update_data");
970
971 prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
972 RNA_def_property_struct_type(prop, "MaskSplinePoint");
973 RNA_def_property_collection_sdna(prop, nullptr, "points", "tot_point");
974 RNA_def_property_ui_text(prop, "Points", "Collection of points");
975 RNA_def_property_srna(prop, "MaskSplinePoints");
976}
977
979{
980 static const EnumPropertyItem masklay_blend_mode_items[] = {
981 {MASK_BLEND_MERGE_ADD, "MERGE_ADD", 0, "Merge Add", ""},
982 {MASK_BLEND_MERGE_SUBTRACT, "MERGE_SUBTRACT", 0, "Merge Subtract", ""},
983 {MASK_BLEND_ADD, "ADD", 0, "Add", ""},
984 {MASK_BLEND_SUBTRACT, "SUBTRACT", 0, "Subtract", ""},
985 {MASK_BLEND_LIGHTEN, "LIGHTEN", 0, "Lighten", ""},
986 {MASK_BLEND_DARKEN, "DARKEN", 0, "Darken", ""},
987 {MASK_BLEND_MUL, "MUL", 0, "Multiply", ""},
988 {MASK_BLEND_REPLACE, "REPLACE", 0, "Replace", ""},
989 {MASK_BLEND_DIFFERENCE, "DIFFERENCE", 0, "Difference", ""},
990 {0, nullptr, 0, nullptr, nullptr},
991 };
992
993 static const EnumPropertyItem fill_solver_items[] = {
995 "SWEEP_LINE",
996 0,
997 "Sweep Line",
998 "Fast without support for self-intersection"},
1000 "CDT",
1001 0,
1002 "Delaunay",
1003 "Constrained Delaunay Triangulation (CDT), robust with support for self-intersections"},
1004 {0, nullptr, 0, nullptr, nullptr},
1005 };
1006
1007 StructRNA *srna;
1008 PropertyRNA *prop;
1009
1010 rna_def_maskSpline(brna);
1013
1014 srna = RNA_def_struct(brna, "MaskLayer", nullptr);
1015 RNA_def_struct_ui_text(srna, "Mask Layer", "Single layer used for masking pixels");
1016 RNA_def_struct_path_func(srna, "rna_MaskLayer_path");
1017
1018 /* name */
1019 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1020 RNA_def_property_ui_text(prop, "Name", "Unique name of layer");
1021 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_MaskLayer_name_set");
1023 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
1024 RNA_def_struct_name_property(srna, prop);
1025
1026 /* splines */
1027 prop = RNA_def_property(srna, "splines", PROP_COLLECTION, PROP_NONE);
1029 "rna_MaskLayer_splines_begin",
1030 "rna_iterator_listbase_next",
1031 "rna_iterator_listbase_end",
1032 "rna_iterator_listbase_get",
1033 nullptr,
1034 nullptr,
1035 nullptr,
1036 nullptr);
1037 RNA_def_property_struct_type(prop, "MaskSpline");
1038 RNA_def_property_ui_text(prop, "Splines", "Collection of splines which defines this layer");
1039 RNA_def_property_srna(prop, "MaskSplines");
1040
1041 /* restrict */
1042 prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
1043 RNA_def_property_boolean_sdna(prop, nullptr, "visibility_flag", MASK_HIDE_VIEW);
1044 RNA_def_property_ui_text(prop, "Restrict View", "Restrict visibility in the viewport");
1045 RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, -1);
1046 RNA_def_property_update(prop, NC_MASK | ND_DRAW, nullptr);
1047
1048 prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
1049 RNA_def_property_boolean_sdna(prop, nullptr, "visibility_flag", MASK_HIDE_SELECT);
1050 RNA_def_property_ui_text(prop, "Restrict Select", "Restrict selection in the viewport");
1051 RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, -1);
1052 RNA_def_property_update(prop, NC_MASK | ND_DRAW, nullptr);
1053
1054 prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
1055 RNA_def_property_boolean_sdna(prop, nullptr, "visibility_flag", MASK_HIDE_RENDER);
1056 RNA_def_property_ui_text(prop, "Restrict Render", "Restrict renderability");
1057 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, -1);
1058 RNA_def_property_update(prop, NC_MASK | NA_EDITED, nullptr);
1059
1060 /* Select (for dope-sheet). */
1061 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
1063 RNA_def_property_ui_text(prop, "Select", "Layer is selected for editing in the Dope Sheet");
1064 // RNA_def_property_update(prop, NC_SCREEN | ND_MASK, nullptr);
1065
1066 /* render settings */
1067 prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE);
1068 RNA_def_property_float_sdna(prop, nullptr, "alpha");
1069 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
1070 RNA_def_property_ui_text(prop, "Opacity", "Render Opacity");
1071 RNA_def_property_update(prop, NC_MASK | NA_EDITED, nullptr);
1072
1073 /* weight interpolation */
1074 prop = RNA_def_property(srna, "blend", PROP_ENUM, PROP_NONE);
1075 RNA_def_property_enum_sdna(prop, nullptr, "blend");
1076 RNA_def_property_enum_items(prop, masklay_blend_mode_items);
1077 RNA_def_property_ui_text(prop, "Blend", "Method of blending mask layers");
1078 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
1079 RNA_def_property_update(prop, NC_MASK | NA_EDITED, nullptr);
1080
1081 prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
1082 RNA_def_property_boolean_sdna(prop, nullptr, "blend_flag", MASK_BLENDFLAG_INVERT);
1083 RNA_def_property_ui_text(prop, "Invert", "Invert the mask black/white");
1084 RNA_def_property_update(prop, NC_MASK | NA_EDITED, nullptr);
1085
1086 prop = RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
1087 RNA_def_property_enum_sdna(prop, nullptr, "falloff");
1089 RNA_def_property_ui_text(prop, "Falloff", "Falloff type of the feather");
1091 BLT_I18NCONTEXT_ID_CURVE_LEGACY); /* Abusing id_curve :/ */
1092 RNA_def_property_update(prop, NC_MASK | NA_EDITED, nullptr);
1093
1094 /* filling options */
1095 prop = RNA_def_property(srna, "fill_solver", PROP_ENUM, PROP_NONE);
1096 RNA_def_property_enum_sdna(prop, nullptr, "fill_solver");
1098 RNA_def_property_ui_text(prop, "Fill Solver", "Triangulation solver for filling 2D curves");
1099 RNA_def_property_update(prop, NC_MASK | ND_DRAW, nullptr);
1100
1101 prop = RNA_def_property(srna, "use_fill_holes", PROP_BOOLEAN, PROP_NONE);
1104 prop, "Calculate Holes", "Calculate holes when filling overlapping curves");
1105 RNA_def_property_update(prop, NC_MASK | NA_EDITED, nullptr);
1106
1107 prop = RNA_def_property(srna, "use_fill_overlap", PROP_BOOLEAN, PROP_NONE);
1110 "Calculate Overlap",
1111 "Calculate self intersections and overlap before filling "
1112 "(only for the sweep-line solver)");
1113 RNA_def_property_update(prop, NC_MASK | NA_EDITED, nullptr);
1114}
1115
1117{
1118 StructRNA *srna;
1119 PropertyRNA *prop;
1120
1121 FunctionRNA *func;
1122 PropertyRNA *parm;
1123
1124 RNA_def_property_srna(cprop, "MaskLayers");
1125 srna = RNA_def_struct(brna, "MaskLayers", nullptr);
1126 RNA_def_struct_sdna(srna, "Mask");
1127 RNA_def_struct_ui_text(srna, "Mask Layers", "Collection of layers used by mask");
1128
1129 func = RNA_def_function(srna, "new", "rna_Mask_layers_new");
1130 RNA_def_function_ui_description(func, "Add layer to this mask");
1131 RNA_def_string(func, "name", nullptr, 0, "Name", "Name of new layer");
1132 parm = RNA_def_pointer(func, "layer", "MaskLayer", "", "New mask layer");
1134 RNA_def_function_return(func, parm);
1135
1136 func = RNA_def_function(srna, "remove", "rna_Mask_layers_remove");
1138 RNA_def_function_ui_description(func, "Remove layer from this mask");
1139 parm = RNA_def_pointer(func, "layer", "MaskLayer", "", "Shape to be removed");
1142
1143 /* clear all layers */
1144 func = RNA_def_function(srna, "clear", "rna_Mask_layers_clear");
1145 RNA_def_function_ui_description(func, "Remove all mask layers");
1146
1147 /* active layer */
1148 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
1149 RNA_def_property_struct_type(prop, "MaskLayer");
1151 prop, "rna_Mask_layer_active_get", "rna_Mask_layer_active_set", nullptr, nullptr);
1153 RNA_def_property_ui_text(prop, "Active Shape", "Active layer in this mask");
1154}
1155
1156static void rna_def_mask(BlenderRNA *brna)
1157{
1158 StructRNA *srna;
1159 PropertyRNA *prop;
1160
1161 rna_def_mask_layer(brna);
1162
1163 srna = RNA_def_struct(brna, "Mask", "ID");
1164 RNA_def_struct_ui_text(srna, "Mask", "Mask data-block defining mask for compositing");
1165 RNA_def_struct_ui_icon(srna, ICON_MOD_MASK);
1166
1167 /* mask layers */
1168 prop = RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
1170 "rna_Mask_layers_begin",
1171 "rna_iterator_listbase_next",
1172 "rna_iterator_listbase_end",
1173 "rna_iterator_listbase_get",
1174 nullptr,
1175 nullptr,
1176 nullptr,
1177 nullptr);
1178 RNA_def_property_struct_type(prop, "MaskLayer");
1179 RNA_def_property_ui_text(prop, "Layers", "Collection of layers which defines this mask");
1180 rna_def_masklayers(brna, prop);
1181
1182 /* active masklay index */
1183 prop = RNA_def_property(srna, "active_layer_index", PROP_INT, PROP_NONE);
1184 RNA_def_property_int_sdna(prop, nullptr, "masklay_act");
1187 "rna_Mask_layer_active_index_get",
1188 "rna_Mask_layer_active_index_set",
1189 "rna_Mask_layer_active_index_range");
1191 prop, "Active Shape Index", "Index of active layer in list of all mask's layers");
1192 RNA_def_property_update(prop, NC_MASK | ND_DRAW, nullptr);
1193
1194 /* frame range */
1195 prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
1197 RNA_def_property_int_sdna(prop, nullptr, "sfra");
1198 RNA_def_property_int_funcs(prop, nullptr, "rna_Mask_start_frame_set", nullptr);
1200 RNA_def_property_ui_text(prop, "Start Frame", "First frame of the mask (used for sequencer)");
1201 RNA_def_property_update(prop, NC_MASK | ND_DRAW, nullptr);
1202
1203 prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
1205 RNA_def_property_int_sdna(prop, nullptr, "efra");
1206 RNA_def_property_int_funcs(prop, nullptr, "rna_Mask_end_frame_set", nullptr);
1208 RNA_def_property_ui_text(prop, "End Frame", "Final frame of the mask (used for sequencer)");
1209 RNA_def_property_update(prop, NC_MASK | ND_DRAW, nullptr);
1210
1211 /* pointers */
1213}
1214
1216{
1217 rna_def_maskParent(brna);
1218 rna_def_mask(brna);
1219}
1220
1221} // namespace blender
1222
1223#endif
#define G_MAIN
#define SELECT
Definition BKE_mask.hh:19
#define STRNCPY_UTF8(dst, src)
#define BLT_I18NCONTEXT_ID_CURVE_LEGACY
#define BLT_I18NCONTEXT_ID_MASK
#define MAX_ID_NAME
Definition DNA_ID.h:367
Object is a sort of wrapper for general info.
#define MINFRAME
#define MAXFRAME
#define ND_DRAW
Definition WM_types.hh:502
#define ND_DATA
Definition WM_types.hh:552
#define NA_EDITED
Definition WM_types.hh:634
#define NC_MASK
Definition WM_types.hh:411
#define NA_SELECTED
Definition WM_types.hh:639
#define CLAMP(a, b, c)
#define BLI_assert_msg(a, msg)
#define MEM_realloc_zeroed(vmemh, len)
btScalar max
#define INT_MAX
#define layer
BMesh Iterators.
void WM_main_add_notifier(uint type, void *reference)
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
static void rna_def_maskSplinePointUW(BlenderRNA *brna)
Definition rna_mask.cc:674
@ MASK_WHICH_HANDLE_STICK
Definition BKE_mask.hh:46
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void BKE_mask_point_select_set_handle(MaskSplinePoint *point, eMaskWhichHandle which_handle, bool do_select)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
char * STRNCPY(char(&dst)[N], const char *src)
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_enum_default(PropertyRNA *prop, int value)
static void rna_def_mask_layer(BlenderRNA *brna)
Definition rna_mask.cc:978
void BKE_mask_layer_shape_changed_remove(MaskLayer *masklay, int index, int count)
MINLINE void add_v2_v2v2(float r[2], const float a[2], const float b[2])
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
MINLINE void copy_v2_v2(float r[2], const float a[2])
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
StructRNA * ID_code_to_RNA_type(short idcode)
MaskLayer * BKE_mask_layer_new(Mask *mask, const char *name)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
static void rna_def_maskParent(BlenderRNA *brna)
Definition rna_mask.cc:612
@ FUNC_USE_REPORTS
@ FUNC_USE_SELF_ID
Definition RNA_types.hh:980
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
MINLINE int max_ii(int a, int b)
bool BKE_mask_spline_remove(MaskLayer *mask_layer, MaskSpline *spline)
void RNA_def_property_string_maxlength(PropertyRNA *prop, int maxlength)
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void rna_def_animdata_common(StructRNA *srna)
void BKE_mask_layer_active_set(Mask *mask, MaskLayer *masklay)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier_c_str, int type, int subtype)
static const EnumPropertyItem fill_solver_items[]
Definition rna_curve.cc:140
static void rna_def_masklayers(BlenderRNA *brna, PropertyRNA *cprop)
Definition rna_mask.cc:1116
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:593
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
MovieTrackingPlaneTrack * BKE_tracking_object_find_plane_track_with_name(MovieTrackingObject *tracking_object, const char *name)
Definition tracking.cc:2010
@ PROP_BOOLEAN
Definition RNA_types.hh:210
@ PROP_POINTER
Definition RNA_types.hh:215
@ PROP_STRING
Definition RNA_types.hh:213
@ PROP_COLLECTION
Definition RNA_types.hh:216
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
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_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void DEG_id_tag_update(ID *id, unsigned int flags)
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:162
BMesh const char void * data
@ MASK_PARENT_POINT_TRACK
@ MASK_PARENT_PLANE_TRACK
MovieTrackingTrack * BKE_tracking_object_find_track_with_name(MovieTrackingObject *tracking_object, const char *name)
Definition tracking.cc:1998
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
char char size_t BLI_str_escape(char *__restrict dst, StringRef src, size_t dst_maxncpy) ATTR_NONNULL(1)
MaskSpline * BKE_mask_spline_add(MaskLayer *masklay)
void BKE_mask_coord_from_movieclip(MovieClip *clip, MovieClipUser *user, float r_co[2], const float co[2])
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
@ MASK_BLEND_DIFFERENCE
@ MASK_BLEND_REPLACE
@ MASK_BLEND_MERGE_ADD
@ MASK_BLEND_LIGHTEN
@ MASK_BLEND_MERGE_SUBTRACT
@ MASK_BLEND_SUBTRACT
@ MASK_BLEND_DARKEN
MaskLayer * BKE_mask_layer_active(Mask *mask)
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
@ MASK_SPLINE_CYCLIC
@ MASK_SPLINE_NOFILL
@ MASK_SPLINE_NOINTERSECT
bool BKE_mask_point_is_handle_selected(const MaskSplinePoint *point, eMaskWhichHandle handle)
Definition BKE_mask.hh:165
const EnumPropertyItem rna_enum_proportional_falloff_curve_only_items[]
Definition rna_scene.cc:119
@ MASK_FILL_SOLVER_SWEEP_LINE
@ MASK_FILL_SOLVER_CDT
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier_c_str, const char *call)
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void BKE_movieclip_user_set_frame(MovieClipUser *user, int framenr)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
float BKE_movieclip_remap_scene_to_clip_frame(const MovieClip *clip, float framenr)
void RNA_def_function_flag(FunctionRNA *func, FunctionFlag flag)
void RNA_def_mask(BlenderRNA *brna)
Definition rna_mask.cc:1215
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag 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)
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
Definition report.cc:191
static void rna_def_maskSpline(BlenderRNA *brna)
Definition rna_mask.cc:905
void BKE_mask_calc_handle_point(MaskSpline *spline, MaskSplinePoint *point)
int BKE_mask_layer_shape_spline_to_index(MaskLayer *masklay, MaskSpline *spline)
void BKE_mask_layer_free_list(ListBaseT< MaskLayer > *masklayers)
void BKE_mask_parent_init(MaskParent *parent)
@ MASK_BLENDFLAG_INVERT
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
MovieTrackingPlaneMarker * BKE_tracking_plane_marker_get(MovieTrackingPlaneTrack *plane_track, int framenr)
Definition tracking.cc:1796
@ ID_RECALC_SELECT
Definition DNA_ID.h:1101
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1074
ID_Type GS(const char *name)
Definition DNA_ID.h:410
@ PROP_EDITABLE
Definition RNA_types.hh:376
@ PROP_THICK_WRAP
Definition RNA_types.hh:493
@ PROP_NEVER_UNLINK
Definition RNA_types.hh:454
@ PROP_ID_REFCOUNT
Definition RNA_types.hh:434
@ PROP_NEVER_NULL
Definition RNA_types.hh:447
@ PROP_ANIMATABLE
Definition RNA_types.hh:389
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
static void rna_def_maskSplinePoints(BlenderRNA *brna)
Definition rna_mask.cc:877
@ MASK_LAYERFLAG_FILL_DISCRETE
@ MASK_LAYERFLAG_FILL_OVERLAP
@ MASK_LAYERFLAG_SELECT
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
PointerRNA RNA_pointer_create_with_parent(const PointerRNA &parent, StructRNA *type, void *data)
MovieTrackingObject * BKE_tracking_object_get_named(MovieTracking *tracking, const char *name)
Definition tracking.cc:1971
static void rna_def_mask_splines(BlenderRNA *brna)
Definition rna_mask.cc:826
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
@ PROP_TRANSLATION
Definition RNA_types.hh:318
@ MASK_SPLINE_INTERP_EASE
@ MASK_SPLINE_INTERP_LINEAR
@ PARM_REQUIRED
Definition RNA_types.hh:631
@ PARM_RNAPTR
Definition RNA_types.hh:633
void rna_iterator_listbase_begin(CollectionPropertyIterator *iter, PointerRNA *ptr, ListBase *lb, IteratorSkipFunc skip)
void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop, const bool allow_replace)
static void rna_def_mask(BlenderRNA *brna)
Definition rna_mask.cc:1156
void RNA_def_property_array(PropertyRNA *prop, int length)
MINLINE void zero_v2(float r[2])
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
void BKE_mask_layer_remove(Mask *mask, MaskLayer *masklay)
@ MASK_SPLINE_OFFSET_EVEN
@ MASK_SPLINE_OFFSET_SMOOTH
void BKE_mask_layer_shape_changed_add(MaskLayer *masklay, int index, bool do_init, bool do_init_interpolate)
static void rna_def_maskSplinePoint(BlenderRNA *brna)
Definition rna_mask.cc:704
void BKE_mask_layer_rename(Main &bmain, Mask *mask, MaskLayer *masklay, const char *oldname, const char *newname)
void BKE_mask_calc_handle_point_auto(MaskSpline *spline, MaskSplinePoint *point, bool do_recalc_length)
Resets auto handles even for non-auto bezier points.
MovieTrackingMarker * BKE_tracking_marker_get(MovieTrackingTrack *track, int framenr)
Definition tracking.cc:1363
#define min(a, b)
Definition sort.cc:38
eBezTriple_Handle h2
eBezTriple_Handle h1