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