Blender V5.0
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
105static StructRNA *rna_MaskParent_id_typef(PointerRNA *ptr)
106{
107 MaskParent *mpar = (MaskParent *)ptr->data;
108
109 return ID_code_to_RNA_type(mpar->id_type);
110}
111
112static void rna_MaskParent_id_type_set(PointerRNA *ptr, int value)
113{
114 MaskParent *mpar = (MaskParent *)ptr->data;
115
116 /* change ID-type to the new type */
117 mpar->id_type = value;
118
119 /* clear the id-block if the type is invalid */
120 if ((mpar->id) && (GS(mpar->id->name) != mpar->id_type)) {
121 mpar->id = nullptr;
122 }
123}
124
125static void rna_Mask_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
126{
127 Mask *mask = (Mask *)ptr->owner_id;
128
129 rna_iterator_listbase_begin(iter, ptr, &mask->masklayers, nullptr);
130}
131
132static int rna_Mask_layer_active_index_get(PointerRNA *ptr)
133{
134 Mask *mask = (Mask *)ptr->owner_id;
135
136 return mask->masklay_act;
137}
138
139static void rna_Mask_layer_active_index_set(PointerRNA *ptr, int value)
140{
141 Mask *mask = (Mask *)ptr->owner_id;
142
143 mask->masklay_act = value;
144}
145
146static void rna_Mask_layer_active_index_range(
147 PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
148{
149 Mask *mask = (Mask *)ptr->owner_id;
150
151 *min = 0;
152 *max = max_ii(0, mask->masklay_tot - 1);
153
154 *softmin = *min;
155 *softmax = *max;
156}
157
158static std::optional<std::string> rna_MaskLayer_path(const PointerRNA *ptr)
159{
160 const MaskLayer *masklay = (MaskLayer *)ptr->data;
161 char name_esc[sizeof(masklay->name) * 2];
162 BLI_str_escape(name_esc, masklay->name, sizeof(name_esc));
163 return fmt::format("layers[\"{}\"]", name_esc);
164}
165
166static PointerRNA rna_Mask_layer_active_get(PointerRNA *ptr)
167{
168 Mask *mask = (Mask *)ptr->owner_id;
170
171 return RNA_pointer_create_with_parent(*ptr, &RNA_MaskLayer, masklay);
172}
173
174static void rna_Mask_layer_active_set(PointerRNA *ptr, PointerRNA value, ReportList * /*reports*/)
175{
176 Mask *mask = (Mask *)ptr->owner_id;
177 MaskLayer *masklay = (MaskLayer *)value.data;
178
180}
181
182static void rna_MaskLayer_splines_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
183{
184 MaskLayer *masklay = (MaskLayer *)ptr->data;
185
186 rna_iterator_listbase_begin(iter, ptr, &masklay->splines, nullptr);
187}
188
189static void rna_MaskLayer_name_set(PointerRNA *ptr, const char *value)
190{
191 Mask *mask = (Mask *)ptr->owner_id;
192 MaskLayer *masklay = (MaskLayer *)ptr->data;
193 char oldname[sizeof(masklay->name)], newname[sizeof(masklay->name)];
194
195 /* need to be on the stack */
196 STRNCPY(oldname, masklay->name);
197 STRNCPY_UTF8(newname, value);
198
199 BKE_mask_layer_rename(mask, masklay, oldname, newname);
200}
201
202static PointerRNA rna_MaskLayer_active_spline_get(PointerRNA *ptr)
203{
204 MaskLayer *masklay = (MaskLayer *)ptr->data;
205
206 return RNA_pointer_create_with_parent(*ptr, &RNA_MaskSpline, masklay->act_spline);
207}
208
209static void rna_MaskLayer_active_spline_set(PointerRNA *ptr,
210 PointerRNA value,
211 ReportList * /*reports*/)
212{
213 MaskLayer *masklay = (MaskLayer *)ptr->data;
214 MaskSpline *spline = (MaskSpline *)value.data;
215 int index = BLI_findindex(&masklay->splines, spline);
216
217 if (index != -1) {
218 masklay->act_spline = spline;
219 }
220 else {
221 masklay->act_spline = nullptr;
222 }
223}
224
225static PointerRNA rna_MaskLayer_active_spline_point_get(PointerRNA *ptr)
226{
227 MaskLayer *masklay = (MaskLayer *)ptr->data;
228
229 return RNA_pointer_create_with_parent(*ptr, &RNA_MaskSplinePoint, masklay->act_point);
230}
231
232static void rna_MaskLayer_active_spline_point_set(PointerRNA *ptr,
233 PointerRNA value,
234 ReportList * /*reports*/)
235{
236 MaskLayer *masklay = (MaskLayer *)ptr->data;
237 MaskSpline *spline;
238 MaskSplinePoint *point = (MaskSplinePoint *)value.data;
239
240 masklay->act_point = nullptr;
241
242 for (spline = static_cast<MaskSpline *>(masklay->splines.first); spline; spline = spline->next) {
243 if (point >= spline->points && point < spline->points + spline->tot_point) {
244 masklay->act_point = point;
245
246 break;
247 }
248 }
249}
250
251static void rna_MaskSplinePoint_handle1_get(PointerRNA *ptr, float *values)
252{
253 MaskSplinePoint *point = (MaskSplinePoint *)ptr->data;
254 BezTriple *bezt = &point->bezt;
255 copy_v2_v2(values, bezt->vec[0]);
256}
257
258static void rna_MaskSplinePoint_handle1_set(PointerRNA *ptr, const float *values)
259{
260 MaskSplinePoint *point = (MaskSplinePoint *)ptr->data;
261 BezTriple *bezt = &point->bezt;
262 copy_v2_v2(bezt->vec[0], values);
263}
264
265static void rna_MaskSplinePoint_handle2_get(PointerRNA *ptr, float *values)
266{
267 MaskSplinePoint *point = (MaskSplinePoint *)ptr->data;
268 BezTriple *bezt = &point->bezt;
269 copy_v2_v2(values, bezt->vec[2]);
270}
271
272static void rna_MaskSplinePoint_handle2_set(PointerRNA *ptr, const float *values)
273{
274 MaskSplinePoint *point = (MaskSplinePoint *)ptr->data;
275 BezTriple *bezt = &point->bezt;
276 copy_v2_v2(bezt->vec[2], values);
277}
278
279static void rna_MaskSplinePoint_ctrlpoint_get(PointerRNA *ptr, float *values)
280{
281 MaskSplinePoint *point = (MaskSplinePoint *)ptr->data;
282 BezTriple *bezt = &point->bezt;
283 copy_v2_v2(values, bezt->vec[1]);
284}
285
286static void rna_MaskSplinePoint_ctrlpoint_set(PointerRNA *ptr, const float *values)
287{
288 MaskSplinePoint *point = (MaskSplinePoint *)ptr->data;
289 BezTriple *bezt = &point->bezt;
290 copy_v2_v2(bezt->vec[1], values);
291}
292
293static int rna_MaskSplinePoint_handle_type_get(PointerRNA *ptr)
294{
295 MaskSplinePoint *point = (MaskSplinePoint *)ptr->data;
296 BezTriple *bezt = &point->bezt;
297
298 return bezt->h1;
299}
300
301static MaskSpline *mask_spline_from_point(Mask *mask, MaskSplinePoint *point)
302{
303 MaskLayer *mask_layer;
304 for (mask_layer = static_cast<MaskLayer *>(mask->masklayers.first); mask_layer;
305 mask_layer = mask_layer->next)
306 {
307 MaskSpline *spline;
308 for (spline = static_cast<MaskSpline *>(mask_layer->splines.first); spline;
309 spline = spline->next)
310 {
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 = (MaskSplinePoint *)ptr->data;
332 BezTriple *bezt = &point->bezt;
333 MaskSpline *spline = mask_spline_from_point((Mask *)ptr->owner_id, point);
334
335 bezt->h1 = bezt->h2 = 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 = (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 = (MaskSplinePoint *)ptr->data;
351 BezTriple *bezt = &point->bezt;
352 MaskSpline *spline = mask_spline_from_point((Mask *)ptr->owner_id, point);
353
354 bezt->h1 = 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 = (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 = (MaskSplinePoint *)ptr->data;
370 BezTriple *bezt = &point->bezt;
371 MaskSpline *spline = mask_spline_from_point((Mask *)ptr->owner_id, point);
372
373 bezt->h2 = 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{
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 = (Mask *)ptr->owner_id;
417 MaskSplinePoint *point = (MaskSplinePoint *)ptr->data;
418
420
423}
424
425static bool rna_MaskSplinePoint_handle_single_select_get(PointerRNA *ptr)
426{
427 MaskSplinePoint *point = (MaskSplinePoint *)ptr->data;
428
430}
431
432static MaskSpline *rna_MaskLayer_spline_new(ID *id, MaskLayer *mask_layer)
433{
434 Mask *mask = (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 = (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 = (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 = (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 = (Mask *)id;
489 MaskLayer *layer;
490 int active_point_index = -1;
491 int i, spline_shape_index;
492
493 if (count <= 0) {
494 return;
495 }
496
497 for (layer = static_cast<MaskLayer *>(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_recallocN(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 = (Mask *)id;
544 MaskSplinePoint *point = static_cast<MaskSplinePoint *>(point_ptr->data);
545 MaskSplinePoint *new_point_array;
546 MaskLayer *layer;
547 int active_point_index = -1;
548 int point_index;
549
550 for (layer = static_cast<MaskLayer *>(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_malloc_arrayN<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_freeN(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#else
608{
609 StructRNA *srna;
610 PropertyRNA *prop;
611
612 static const EnumPropertyItem mask_id_type_items[] = {
613 {ID_MC, "MOVIECLIP", ICON_SEQUENCE, "Movie Clip", ""},
614 {0, nullptr, 0, nullptr, nullptr},
615 };
616
617 static const EnumPropertyItem parent_type_items[] = {
618 {MASK_PARENT_POINT_TRACK, "POINT_TRACK", 0, "Point Track", ""},
619 {MASK_PARENT_PLANE_TRACK, "PLANE_TRACK", 0, "Plane Track", ""},
620 {0, nullptr, 0, nullptr, nullptr},
621 };
622
623 srna = RNA_def_struct(brna, "MaskParent", nullptr);
624 RNA_def_struct_ui_text(srna, "Mask Parent", "Parenting settings for masking element");
625
626 /* Target Properties - ID-block to Drive */
627 prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
631 // RNA_def_property_editable_func(prop, "rna_maskSpline_id_editable");
632 RNA_def_property_pointer_funcs(prop, nullptr, nullptr, "rna_MaskParent_id_typef", nullptr);
634 prop, "ID", "ID-block to which masking element would be parented to or to its property");
635 RNA_def_property_update(prop, 0, "rna_Mask_update_parent");
636
637 prop = RNA_def_property(srna, "id_type", PROP_ENUM, PROP_NONE);
638 RNA_def_property_enum_sdna(prop, nullptr, "id_type");
639 RNA_def_property_enum_items(prop, mask_id_type_items);
641 RNA_def_property_enum_funcs(prop, nullptr, "rna_MaskParent_id_type_set", nullptr);
642 // RNA_def_property_editable_func(prop, "rna_MaskParent_id_type_editable");
643 RNA_def_property_ui_text(prop, "ID Type", "Type of ID-block that can be used");
644 RNA_def_property_update(prop, 0, "rna_Mask_update_parent");
645
646 /* type */
647 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
649 RNA_def_property_ui_text(prop, "Parent Type", "Parent Type");
650 RNA_def_property_update(prop, 0, "rna_Mask_update_parent");
651
652 /* parent */
653 prop = RNA_def_property(srna, "parent", PROP_STRING, PROP_NONE);
655 prop, "Parent", "Name of parent object in specified data-block to which parenting happens");
657 RNA_def_property_update(prop, 0, "rna_Mask_update_parent");
658
659 /* sub_parent */
660 prop = RNA_def_property(srna, "sub_parent", PROP_STRING, PROP_NONE);
662 prop,
663 "Sub Parent",
664 "Name of parent sub-object in specified data-block to which parenting happens");
666 RNA_def_property_update(prop, 0, "rna_Mask_update_parent");
667}
668
670{
671 StructRNA *srna;
672 PropertyRNA *prop;
673
674 srna = RNA_def_struct(brna, "MaskSplinePointUW", nullptr);
676 srna, "Mask Spline UW Point", "Single point in spline segment defining feather");
677
678 /* u */
679 prop = RNA_def_property(srna, "u", PROP_FLOAT, PROP_NONE);
680 RNA_def_property_float_sdna(prop, nullptr, "u");
681 RNA_def_property_range(prop, 0.0, 1.0);
682 RNA_def_property_ui_text(prop, "U", "U coordinate of point along spline segment");
683 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
684
685 /* weight */
686 prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
687 RNA_def_property_float_sdna(prop, nullptr, "w");
688 RNA_def_property_range(prop, 0.0, 1.0);
689 RNA_def_property_ui_text(prop, "Weight", "Weight of feather point");
690 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
691
692 /* select */
693 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
694 RNA_def_property_boolean_sdna(prop, nullptr, "flag", SELECT);
695 RNA_def_property_ui_text(prop, "Select", "Selection status");
696 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
697}
698
700{
701 StructRNA *srna;
702 PropertyRNA *prop;
703
704 static const EnumPropertyItem handle_type_items[] = {
705 {HD_AUTO, "AUTO", 0, "Auto", ""},
706 {HD_VECT, "VECTOR", 0, "Vector", ""},
707 {HD_ALIGN, "ALIGNED", 0, "Aligned Single", ""},
708 {HD_ALIGN_DOUBLESIDE, "ALIGNED_DOUBLESIDE", 0, "Aligned", ""},
709 {HD_FREE, "FREE", 0, "Free", ""},
710 {0, nullptr, 0, nullptr, nullptr},
711 };
712
714
715 srna = RNA_def_struct(brna, "MaskSplinePoint", nullptr);
717 srna, "Mask Spline Point", "Single point in spline used for defining mask");
718
719 /* Vector values */
720 prop = RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_TRANSLATION);
721 RNA_def_property_array(prop, 2);
723 prop, "rna_MaskSplinePoint_handle1_get", "rna_MaskSplinePoint_handle1_set", nullptr);
724 RNA_def_property_ui_text(prop, "Handle 1", "Coordinates of the first handle");
725 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
726
727 prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
728 RNA_def_property_array(prop, 2);
730 prop, "rna_MaskSplinePoint_ctrlpoint_get", "rna_MaskSplinePoint_ctrlpoint_set", nullptr);
731 RNA_def_property_ui_text(prop, "Control Point", "Coordinates of the control point");
732 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
733
734 prop = RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_TRANSLATION);
735 RNA_def_property_array(prop, 2);
737 prop, "rna_MaskSplinePoint_handle2_get", "rna_MaskSplinePoint_handle2_set", nullptr);
738 RNA_def_property_ui_text(prop, "Handle 2", "Coordinates of the second handle");
739 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
740
741 /* handle_type */
742 prop = RNA_def_property(srna, "handle_type", PROP_ENUM, PROP_NONE);
744 prop, "rna_MaskSplinePoint_handle_type_get", "rna_MaskSplinePoint_handle_type_set", nullptr);
745 RNA_def_property_enum_items(prop, handle_type_items);
746 RNA_def_property_ui_text(prop, "Handle Type", "Handle type");
747 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
748
749 /* handle_type */
750 prop = RNA_def_property(srna, "handle_left_type", PROP_ENUM, PROP_NONE);
752 "rna_MaskSplinePoint_handle_left_type_get",
753 "rna_MaskSplinePoint_handle_left_type_set",
754 nullptr);
755 RNA_def_property_enum_items(prop, handle_type_items);
756 RNA_def_property_ui_text(prop, "Handle 1 Type", "Handle type");
757 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
758
759 /* handle_right */
760 prop = RNA_def_property(srna, "handle_right_type", PROP_ENUM, PROP_NONE);
762 "rna_MaskSplinePoint_handle_right_type_get",
763 "rna_MaskSplinePoint_handle_right_type_set",
764 nullptr);
765 RNA_def_property_enum_items(prop, handle_type_items);
766 RNA_def_property_ui_text(prop, "Handle 2 Type", "Handle type");
767 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
768
769 /* weight */
770 prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
771 RNA_def_property_float_sdna(prop, nullptr, "bezt.weight");
772 RNA_def_property_range(prop, 0.0, 1.0);
773 RNA_def_property_ui_text(prop, "Weight", "Weight of the point");
774 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
775
776 /* select */
777
778 /* DEPRECATED */
779 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
780 RNA_def_property_boolean_sdna(prop, nullptr, "bezt.f2", SELECT);
782 prop,
783 "Select",
784 "Selection status of the control point. (Deprecated: use Select Control Point instead)");
785 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
786
787 prop = RNA_def_property(srna, "select_left_handle", PROP_BOOLEAN, PROP_NONE);
788 RNA_def_property_boolean_sdna(prop, nullptr, "bezt.f1", SELECT);
789 RNA_def_property_ui_text(prop, "Select Left Handle", "Selection status of the left handle");
790 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
791
792 prop = RNA_def_property(srna, "select_control_point", PROP_BOOLEAN, PROP_NONE);
793 RNA_def_property_boolean_sdna(prop, nullptr, "bezt.f2", SELECT);
794 RNA_def_property_ui_text(prop, "Select Control Point", "Selection status of the control point");
795 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
796
797 prop = RNA_def_property(srna, "select_right_handle", PROP_BOOLEAN, PROP_NONE);
798 RNA_def_property_boolean_sdna(prop, nullptr, "bezt.f3", SELECT);
799 RNA_def_property_ui_text(prop, "Select Right Handle", "Selection status of the right handle");
800 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
801
802 prop = RNA_def_property(srna, "select_single_handle", PROP_BOOLEAN, PROP_NONE);
804 "rna_MaskSplinePoint_handle_single_select_get",
805 "rna_MaskSplinePoint_handle_single_select_set");
807 prop, "Select Aligned Single Handle", "Selection status of the Aligned Single handle");
808 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
809
810 /* parent */
811 prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
812 RNA_def_property_struct_type(prop, "MaskParent");
813
814 /* feather points */
815 prop = RNA_def_property(srna, "feather_points", PROP_COLLECTION, PROP_NONE);
816 RNA_def_property_struct_type(prop, "MaskSplinePointUW");
817 RNA_def_property_collection_sdna(prop, nullptr, "uw", "tot_uw");
818 RNA_def_property_ui_text(prop, "Feather Points", "Points defining feather");
819}
820
822{
823 StructRNA *srna;
824 FunctionRNA *func;
825 PropertyRNA *prop;
826 PropertyRNA *parm;
827
828 srna = RNA_def_struct(brna, "MaskSplines", nullptr);
829 RNA_def_struct_sdna(srna, "MaskLayer");
830 RNA_def_struct_ui_text(srna, "Mask Splines", "Collection of masking splines");
831
832 /* Create new spline */
833 func = RNA_def_function(srna, "new", "rna_MaskLayer_spline_new");
835 RNA_def_function_ui_description(func, "Add a new spline to the layer");
836 parm = RNA_def_pointer(func, "spline", "MaskSpline", "", "The newly created spline");
837 RNA_def_function_return(func, parm);
838
839 /* Remove the spline */
840 func = RNA_def_function(srna, "remove", "rna_MaskLayer_spline_remove");
842 RNA_def_function_ui_description(func, "Remove a spline from a layer");
844 parm = RNA_def_pointer(func, "spline", "MaskSpline", "", "The spline to remove");
847
848 /* active spline */
849 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
850 RNA_def_property_struct_type(prop, "MaskSpline");
852 "rna_MaskLayer_active_spline_get",
853 "rna_MaskLayer_active_spline_set",
854 nullptr,
855 nullptr);
857 RNA_def_property_ui_text(prop, "Active Spline", "Active spline of masking layer");
858
859 /* active point */
860 prop = RNA_def_property(srna, "active_point", PROP_POINTER, PROP_NONE);
861 RNA_def_property_struct_type(prop, "MaskSplinePoint");
863 "rna_MaskLayer_active_spline_point_get",
864 "rna_MaskLayer_active_spline_point_set",
865 nullptr,
866 nullptr);
868 RNA_def_property_ui_text(prop, "Active Point", "Active point of masking layer");
869}
870
872{
873 StructRNA *srna;
874 FunctionRNA *func;
875 PropertyRNA *parm;
876
877 srna = RNA_def_struct(brna, "MaskSplinePoints", nullptr);
878 RNA_def_struct_sdna(srna, "MaskSpline");
879 RNA_def_struct_ui_text(srna, "Mask Spline Points", "Collection of masking spline points");
880
881 /* Create new point */
882 func = RNA_def_function(srna, "add", "rna_MaskSpline_points_add");
884 RNA_def_function_ui_description(func, "Add a number of point to this spline");
885 parm = RNA_def_int(
886 func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX);
888
889 /* Remove the point */
890 func = RNA_def_function(srna, "remove", "rna_MaskSpline_point_remove");
892 RNA_def_function_ui_description(func, "Remove a point from a spline");
894 parm = RNA_def_pointer(func, "point", "MaskSplinePoint", "", "The point to remove");
897}
898
900{
901 static const EnumPropertyItem spline_interpolation_items[] = {
902 {MASK_SPLINE_INTERP_LINEAR, "LINEAR", 0, "Linear", ""},
903 {MASK_SPLINE_INTERP_EASE, "EASE", 0, "Ease", ""},
904 {0, nullptr, 0, nullptr, nullptr},
905 };
906
907 static const EnumPropertyItem spline_offset_mode_items[] = {
908 {MASK_SPLINE_OFFSET_EVEN, "EVEN", 0, "Even", "Calculate even feather offset"},
910 "SMOOTH",
911 0,
912 "Smooth",
913 "Calculate feather offset as a second curve"},
914 {0, nullptr, 0, nullptr, nullptr},
915 };
916
917 StructRNA *srna;
918 PropertyRNA *prop;
919
921
922 srna = RNA_def_struct(brna, "MaskSpline", nullptr);
923 RNA_def_struct_ui_text(srna, "Mask spline", "Single spline used for defining mask shape");
924
925 /* offset mode */
926 prop = RNA_def_property(srna, "offset_mode", PROP_ENUM, PROP_NONE);
927 RNA_def_property_enum_sdna(prop, nullptr, "offset_mode");
928 RNA_def_property_enum_items(prop, spline_offset_mode_items);
930 prop, "Feather Offset", "The method used for calculating the feather offset");
932 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
933
934 /* weight interpolation */
935 prop = RNA_def_property(srna, "weight_interpolation", PROP_ENUM, PROP_NONE);
936 RNA_def_property_enum_sdna(prop, nullptr, "weight_interp");
937 RNA_def_property_enum_items(prop, spline_interpolation_items);
939 prop, "Weight Interpolation", "The type of weight interpolation for spline");
940 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
941
942 /* cyclic */
943 prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
946 RNA_def_property_ui_text(prop, "Cyclic", "Make this spline a closed loop");
947 RNA_def_property_update(prop, NC_MASK | NA_EDITED, "rna_Mask_update_data");
948
949 /* fill */
950 prop = RNA_def_property(srna, "use_fill", PROP_BOOLEAN, PROP_NONE);
953 RNA_def_property_ui_text(prop, "Fill", "Make this spline filled");
955 RNA_def_property_update(prop, NC_MASK | NA_EDITED, "rna_Mask_update_data");
956
957 /* self-intersection check */
958 prop = RNA_def_property(srna, "use_self_intersection_check", PROP_BOOLEAN, PROP_NONE);
962 prop, "Self Intersection Check", "Prevent feather from self-intersections");
963 RNA_def_property_update(prop, NC_MASK | NA_EDITED, "rna_Mask_update_data");
964
965 prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
966 RNA_def_property_struct_type(prop, "MaskSplinePoint");
967 RNA_def_property_collection_sdna(prop, nullptr, "points", "tot_point");
968 RNA_def_property_ui_text(prop, "Points", "Collection of points");
969 RNA_def_property_srna(prop, "MaskSplinePoints");
970}
971
973{
974 static const EnumPropertyItem masklay_blend_mode_items[] = {
975 {MASK_BLEND_MERGE_ADD, "MERGE_ADD", 0, "Merge Add", ""},
976 {MASK_BLEND_MERGE_SUBTRACT, "MERGE_SUBTRACT", 0, "Merge Subtract", ""},
977 {MASK_BLEND_ADD, "ADD", 0, "Add", ""},
978 {MASK_BLEND_SUBTRACT, "SUBTRACT", 0, "Subtract", ""},
979 {MASK_BLEND_LIGHTEN, "LIGHTEN", 0, "Lighten", ""},
980 {MASK_BLEND_DARKEN, "DARKEN", 0, "Darken", ""},
981 {MASK_BLEND_MUL, "MUL", 0, "Multiply", ""},
982 {MASK_BLEND_REPLACE, "REPLACE", 0, "Replace", ""},
983 {MASK_BLEND_DIFFERENCE, "DIFFERENCE", 0, "Difference", ""},
984 {0, nullptr, 0, nullptr, nullptr},
985 };
986
987 StructRNA *srna;
988 PropertyRNA *prop;
989
990 rna_def_maskSpline(brna);
993
994 srna = RNA_def_struct(brna, "MaskLayer", nullptr);
995 RNA_def_struct_ui_text(srna, "Mask Layer", "Single layer used for masking pixels");
996 RNA_def_struct_path_func(srna, "rna_MaskLayer_path");
997
998 /* name */
999 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1000 RNA_def_property_ui_text(prop, "Name", "Unique name of layer");
1001 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_MaskLayer_name_set");
1003 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
1004 RNA_def_struct_name_property(srna, prop);
1005
1006 /* splines */
1007 prop = RNA_def_property(srna, "splines", PROP_COLLECTION, PROP_NONE);
1009 "rna_MaskLayer_splines_begin",
1010 "rna_iterator_listbase_next",
1011 "rna_iterator_listbase_end",
1012 "rna_iterator_listbase_get",
1013 nullptr,
1014 nullptr,
1015 nullptr,
1016 nullptr);
1017 RNA_def_property_struct_type(prop, "MaskSpline");
1018 RNA_def_property_ui_text(prop, "Splines", "Collection of splines which defines this layer");
1019 RNA_def_property_srna(prop, "MaskSplines");
1020
1021 /* restrict */
1022 prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
1023 RNA_def_property_boolean_sdna(prop, nullptr, "visibility_flag", MASK_HIDE_VIEW);
1024 RNA_def_property_ui_text(prop, "Restrict View", "Restrict visibility in the viewport");
1025 RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, -1);
1026 RNA_def_property_update(prop, NC_MASK | ND_DRAW, nullptr);
1027
1028 prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
1029 RNA_def_property_boolean_sdna(prop, nullptr, "visibility_flag", MASK_HIDE_SELECT);
1030 RNA_def_property_ui_text(prop, "Restrict Select", "Restrict selection in the viewport");
1031 RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, -1);
1032 RNA_def_property_update(prop, NC_MASK | ND_DRAW, nullptr);
1033
1034 prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
1035 RNA_def_property_boolean_sdna(prop, nullptr, "visibility_flag", MASK_HIDE_RENDER);
1036 RNA_def_property_ui_text(prop, "Restrict Render", "Restrict renderability");
1037 RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, -1);
1038 RNA_def_property_update(prop, NC_MASK | NA_EDITED, nullptr);
1039
1040 /* Select (for dope-sheet). */
1041 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
1043 RNA_def_property_ui_text(prop, "Select", "Layer is selected for editing in the Dope Sheet");
1044 // RNA_def_property_update(prop, NC_SCREEN | ND_MASK, nullptr);
1045
1046 /* render settings */
1047 prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE);
1048 RNA_def_property_float_sdna(prop, nullptr, "alpha");
1049 RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
1050 RNA_def_property_ui_text(prop, "Opacity", "Render Opacity");
1051 RNA_def_property_update(prop, NC_MASK | NA_EDITED, nullptr);
1052
1053 /* weight interpolation */
1054 prop = RNA_def_property(srna, "blend", PROP_ENUM, PROP_NONE);
1055 RNA_def_property_enum_sdna(prop, nullptr, "blend");
1056 RNA_def_property_enum_items(prop, masklay_blend_mode_items);
1057 RNA_def_property_ui_text(prop, "Blend", "Method of blending mask layers");
1058 RNA_def_property_update(prop, 0, "rna_Mask_update_data");
1059 RNA_def_property_update(prop, NC_MASK | NA_EDITED, nullptr);
1060
1061 prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
1062 RNA_def_property_boolean_sdna(prop, nullptr, "blend_flag", MASK_BLENDFLAG_INVERT);
1063 RNA_def_property_ui_text(prop, "Invert", "Invert the mask black/white");
1064 RNA_def_property_update(prop, NC_MASK | NA_EDITED, nullptr);
1065
1066 prop = RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
1067 RNA_def_property_enum_sdna(prop, nullptr, "falloff");
1069 RNA_def_property_ui_text(prop, "Falloff", "Falloff type of the feather");
1071 BLT_I18NCONTEXT_ID_CURVE_LEGACY); /* Abusing id_curve :/ */
1072 RNA_def_property_update(prop, NC_MASK | NA_EDITED, nullptr);
1073
1074 /* filling options */
1075 prop = RNA_def_property(srna, "use_fill_holes", PROP_BOOLEAN, PROP_NONE);
1078 prop, "Calculate Holes", "Calculate holes when filling overlapping curves");
1079 RNA_def_property_update(prop, NC_MASK | NA_EDITED, nullptr);
1080
1081 prop = RNA_def_property(srna, "use_fill_overlap", PROP_BOOLEAN, PROP_NONE);
1084 prop, "Calculate Overlap", "Calculate self intersections and overlap before filling");
1085 RNA_def_property_update(prop, NC_MASK | NA_EDITED, nullptr);
1086}
1087
1089{
1090 StructRNA *srna;
1091 PropertyRNA *prop;
1092
1093 FunctionRNA *func;
1094 PropertyRNA *parm;
1095
1096 RNA_def_property_srna(cprop, "MaskLayers");
1097 srna = RNA_def_struct(brna, "MaskLayers", nullptr);
1098 RNA_def_struct_sdna(srna, "Mask");
1099 RNA_def_struct_ui_text(srna, "Mask Layers", "Collection of layers used by mask");
1100
1101 func = RNA_def_function(srna, "new", "rna_Mask_layers_new");
1102 RNA_def_function_ui_description(func, "Add layer to this mask");
1103 RNA_def_string(func, "name", nullptr, 0, "Name", "Name of new layer");
1104 parm = RNA_def_pointer(func, "layer", "MaskLayer", "", "New mask layer");
1105 RNA_def_function_return(func, parm);
1106
1107 func = RNA_def_function(srna, "remove", "rna_Mask_layers_remove");
1109 RNA_def_function_ui_description(func, "Remove layer from this mask");
1110 parm = RNA_def_pointer(func, "layer", "MaskLayer", "", "Shape to be removed");
1113
1114 /* clear all layers */
1115 func = RNA_def_function(srna, "clear", "rna_Mask_layers_clear");
1116 RNA_def_function_ui_description(func, "Remove all mask layers");
1117
1118 /* active layer */
1119 prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
1120 RNA_def_property_struct_type(prop, "MaskLayer");
1122 prop, "rna_Mask_layer_active_get", "rna_Mask_layer_active_set", nullptr, nullptr);
1124 RNA_def_property_ui_text(prop, "Active Shape", "Active layer in this mask");
1125}
1126
1127static void rna_def_mask(BlenderRNA *brna)
1128{
1129 StructRNA *srna;
1130 PropertyRNA *prop;
1131
1132 rna_def_mask_layer(brna);
1133
1134 srna = RNA_def_struct(brna, "Mask", "ID");
1135 RNA_def_struct_ui_text(srna, "Mask", "Mask data-block defining mask for compositing");
1136 RNA_def_struct_ui_icon(srna, ICON_MOD_MASK);
1137
1138 /* mask layers */
1139 prop = RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
1141 "rna_Mask_layers_begin",
1142 "rna_iterator_listbase_next",
1143 "rna_iterator_listbase_end",
1144 "rna_iterator_listbase_get",
1145 nullptr,
1146 nullptr,
1147 nullptr,
1148 nullptr);
1149 RNA_def_property_struct_type(prop, "MaskLayer");
1150 RNA_def_property_ui_text(prop, "Layers", "Collection of layers which defines this mask");
1151 rna_def_masklayers(brna, prop);
1152
1153 /* active masklay index */
1154 prop = RNA_def_property(srna, "active_layer_index", PROP_INT, PROP_NONE);
1155 RNA_def_property_int_sdna(prop, nullptr, "masklay_act");
1158 "rna_Mask_layer_active_index_get",
1159 "rna_Mask_layer_active_index_set",
1160 "rna_Mask_layer_active_index_range");
1162 prop, "Active Shape Index", "Index of active layer in list of all mask's layers");
1163 RNA_def_property_update(prop, NC_MASK | ND_DRAW, nullptr);
1164
1165 /* frame range */
1166 prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
1168 RNA_def_property_int_sdna(prop, nullptr, "sfra");
1169 RNA_def_property_int_funcs(prop, nullptr, "rna_Mask_start_frame_set", nullptr);
1171 RNA_def_property_ui_text(prop, "Start Frame", "First frame of the mask (used for sequencer)");
1172 RNA_def_property_update(prop, NC_MASK | ND_DRAW, nullptr);
1173
1174 prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
1176 RNA_def_property_int_sdna(prop, nullptr, "efra");
1177 RNA_def_property_int_funcs(prop, nullptr, "rna_Mask_end_frame_set", nullptr);
1179 RNA_def_property_ui_text(prop, "End Frame", "Final frame of the mask (used for sequencer)");
1180 RNA_def_property_update(prop, NC_MASK | ND_DRAW, nullptr);
1181
1182 /* pointers */
1184}
1185
1187{
1188 rna_def_maskParent(brna);
1189 rna_def_mask(brna);
1190}
1191
1192#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
@ RPT_ERROR
Definition BKE_report.hh:39
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:153
struct MovieTrackingPlaneTrack * BKE_tracking_object_find_plane_track_with_name(struct MovieTrackingObject *tracking_object, const char *name)
Definition tracking.cc:2005
struct MovieTrackingObject * BKE_tracking_object_get_named(struct MovieTracking *tracking, const char *name)
Definition tracking.cc:1966
struct MovieTrackingMarker * BKE_tracking_marker_get(struct MovieTrackingTrack *track, int framenr)
Definition tracking.cc:1358
struct MovieTrackingPlaneMarker * BKE_tracking_plane_marker_get(struct MovieTrackingPlaneTrack *plane_track, int framenr)
Definition tracking.cc:1791
struct MovieTrackingTrack * BKE_tracking_object_find_track_with_name(struct MovieTrackingObject *tracking_object, const char *name)
Definition tracking.cc:1993
#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:693
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:1101
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1074
#define MAX_ID_NAME
Definition DNA_ID.h:373
@ ID_MC
@ HD_VECT
@ HD_FREE
@ HD_AUTO
@ HD_ALIGN_DOUBLESIDE
@ HD_ALIGN
#define DNA_struct_default_get(struct_name)
@ MASK_BLENDFLAG_INVERT
@ MASK_PARENT_PLANE_TRACK
@ MASK_PARENT_POINT_TRACK
@ 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_HIDE_SELECT
@ MASK_HIDE_RENDER
@ MASK_HIDE_VIEW
@ MASK_LAYERFLAG_FILL_OVERLAP
@ MASK_LAYERFLAG_FILL_DISCRETE
@ MASK_LAYERFLAG_SELECT
@ MASK_SPLINE_CYCLIC
@ MASK_SPLINE_NOINTERSECT
@ MASK_SPLINE_NOFILL
@ MASK_SPLINE_INTERP_EASE
@ MASK_SPLINE_INTERP_LINEAR
@ MASK_SPLINE_OFFSET_SMOOTH
@ MASK_SPLINE_OFFSET_EVEN
Object is a sort of wrapper for general info.
#define MINFRAME
#define MAXFRAME
#define MEM_recallocN(vmemh, len)
StructRNA * ID_code_to_RNA_type(short idcode)
ParameterFlag
Definition RNA_types.hh:544
@ PARM_RNAPTR
Definition RNA_types.hh:547
@ PARM_REQUIRED
Definition RNA_types.hh:545
@ FUNC_USE_REPORTS
Definition RNA_types.hh:914
@ FUNC_USE_SELF_ID
Definition RNA_types.hh:889
@ PROP_FLOAT
Definition RNA_types.hh:164
@ PROP_BOOLEAN
Definition RNA_types.hh:162
@ PROP_ENUM
Definition RNA_types.hh:166
@ PROP_INT
Definition RNA_types.hh:163
@ PROP_STRING
Definition RNA_types.hh:165
@ PROP_POINTER
Definition RNA_types.hh:167
@ PROP_COLLECTION
Definition RNA_types.hh:168
PropertyFlag
Definition RNA_types.hh:300
@ PROP_THICK_WRAP
Definition RNA_types.hh:423
@ PROP_ANIMATABLE
Definition RNA_types.hh:319
@ PROP_NEVER_UNLINK
Definition RNA_types.hh:384
@ PROP_EDITABLE
Definition RNA_types.hh:306
@ PROP_NEVER_NULL
Definition RNA_types.hh:377
@ PROP_ID_REFCOUNT
Definition RNA_types.hh:364
@ PROP_TIME
Definition RNA_types.hh:253
@ PROP_NONE
Definition RNA_types.hh:233
@ PROP_TRANSLATION
Definition RNA_types.hh:261
#define ND_DRAW
Definition WM_types.hh:461
#define ND_DATA
Definition WM_types.hh:509
#define NA_EDITED
Definition WM_types.hh:584
#define NC_MASK
Definition WM_types.hh:398
#define NA_SELECTED
Definition WM_types.hh:589
BMesh const char void * data
#define SELECT
#define GS(x)
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)
const char * name
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:1127
static void rna_def_maskSplinePoints(BlenderRNA *brna)
Definition rna_mask.cc:871
static void rna_def_mask_layer(BlenderRNA *brna)
Definition rna_mask.cc:972
static void rna_def_masklayers(BlenderRNA *brna, PropertyRNA *cprop)
Definition rna_mask.cc:1088
static void rna_def_mask_splines(BlenderRNA *brna)
Definition rna_mask.cc:821
static void rna_def_maskSpline(BlenderRNA *brna)
Definition rna_mask.cc:899
static void rna_def_maskSplinePointUW(BlenderRNA *brna)
Definition rna_mask.cc:669
void RNA_def_mask(BlenderRNA *brna)
Definition rna_mask.cc:1186
static void rna_def_maskSplinePoint(BlenderRNA *brna)
Definition rna_mask.cc:699
static void rna_def_maskParent(BlenderRNA *brna)
Definition rna_mask.cc:607
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:414
char name[258]
Definition DNA_ID.h:432
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:4238