Blender  V3.3
rna_mask.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #include <limits.h>
8 #include <stdlib.h>
9 
10 #include "MEM_guardedalloc.h"
11 
12 #include "DNA_defaults.h"
13 #include "DNA_mask_types.h"
14 #include "DNA_object_types.h" /* SELECT */
15 #include "DNA_scene_types.h"
16 
17 #include "BLT_translation.h"
18 
19 #include "BKE_movieclip.h"
20 #include "BKE_tracking.h"
21 
22 #include "RNA_define.h"
23 #include "RNA_enum_types.h"
24 
25 #include "rna_internal.h"
26 
27 #include "WM_types.h"
28 
29 #include "IMB_imbuf.h"
30 #include "IMB_imbuf_types.h"
31 
32 #ifdef RNA_RUNTIME
33 
34 # include "BLI_math.h"
35 
36 # include "DNA_movieclip_types.h"
37 
38 # include "BKE_mask.h"
39 
40 # include "DEG_depsgraph.h"
41 
42 # include "RNA_access.h"
43 
44 # include "WM_api.h"
45 
46 static void rna_Mask_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
47 {
48  Mask *mask = (Mask *)ptr->owner_id;
49 
51  DEG_id_tag_update(&mask->id, 0);
52 }
53 
54 static void rna_Mask_update_parent(Main *bmain, Scene *scene, PointerRNA *ptr)
55 {
56  MaskParent *parent = ptr->data;
57 
58  if (parent->id) {
59  if (GS(parent->id->name) == ID_MC) {
60  MovieClip *clip = (MovieClip *)parent->id;
61  MovieTracking *tracking = &clip->tracking;
62  MovieTrackingObject *object = BKE_tracking_object_get_named(tracking, parent->parent);
63 
64  if (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  tracking, object, 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 
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) {
89  MovieTrackingPlaneMarker *plane_marker = BKE_tracking_plane_marker_get(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 refcounting. */
106 static void rna_MaskParent_id_set(PointerRNA *ptr,
107  PointerRNA value,
108  struct ReportList *UNUSED(reports))
109 {
110  MaskParent *mpar = (MaskParent *)ptr->data;
111 
112  mpar->id = value.data;
113 }
114 
115 static StructRNA *rna_MaskParent_id_typef(PointerRNA *ptr)
116 {
117  MaskParent *mpar = (MaskParent *)ptr->data;
118 
119  return ID_code_to_RNA_type(mpar->id_type);
120 }
121 
122 static void rna_MaskParent_id_type_set(PointerRNA *ptr, int value)
123 {
124  MaskParent *mpar = (MaskParent *)ptr->data;
125 
126  /* change ID-type to the new type */
127  mpar->id_type = value;
128 
129  /* clear the id-block if the type is invalid */
130  if ((mpar->id) && (GS(mpar->id->name) != mpar->id_type)) {
131  mpar->id = NULL;
132  }
133 }
134 
135 static void rna_Mask_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
136 {
137  Mask *mask = (Mask *)ptr->owner_id;
138 
139  rna_iterator_listbase_begin(iter, &mask->masklayers, NULL);
140 }
141 
142 static int rna_Mask_layer_active_index_get(PointerRNA *ptr)
143 {
144  Mask *mask = (Mask *)ptr->owner_id;
145 
146  return mask->masklay_act;
147 }
148 
149 static void rna_Mask_layer_active_index_set(PointerRNA *ptr, int value)
150 {
151  Mask *mask = (Mask *)ptr->owner_id;
152 
153  mask->masklay_act = value;
154 }
155 
156 static void rna_Mask_layer_active_index_range(
157  PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
158 {
159  Mask *mask = (Mask *)ptr->owner_id;
160 
161  *min = 0;
162  *max = max_ii(0, mask->masklay_tot - 1);
163 
164  *softmin = *min;
165  *softmax = *max;
166 }
167 
168 static char *rna_MaskLayer_path(const PointerRNA *ptr)
169 {
170  const MaskLayer *masklay = (MaskLayer *)ptr->data;
171  char name_esc[sizeof(masklay->name) * 2];
172  BLI_str_escape(name_esc, masklay->name, sizeof(name_esc));
173  return BLI_sprintfN("layers[\"%s\"]", name_esc);
174 }
175 
176 static PointerRNA rna_Mask_layer_active_get(PointerRNA *ptr)
177 {
178  Mask *mask = (Mask *)ptr->owner_id;
180 
181  return rna_pointer_inherit_refine(ptr, &RNA_MaskLayer, masklay);
182 }
183 
184 static void rna_Mask_layer_active_set(PointerRNA *ptr,
185  PointerRNA value,
186  struct ReportList *UNUSED(reports))
187 {
188  Mask *mask = (Mask *)ptr->owner_id;
189  MaskLayer *masklay = (MaskLayer *)value.data;
190 
192 }
193 
194 static void rna_MaskLayer_splines_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
195 {
196  MaskLayer *masklay = (MaskLayer *)ptr->data;
197 
198  rna_iterator_listbase_begin(iter, &masklay->splines, NULL);
199 }
200 
201 static void rna_MaskLayer_name_set(PointerRNA *ptr, const char *value)
202 {
203  Mask *mask = (Mask *)ptr->owner_id;
204  MaskLayer *masklay = (MaskLayer *)ptr->data;
205  char oldname[sizeof(masklay->name)], newname[sizeof(masklay->name)];
206 
207  /* need to be on the stack */
208  BLI_strncpy(oldname, masklay->name, sizeof(masklay->name));
209  BLI_strncpy_utf8(newname, value, sizeof(masklay->name));
210 
211  BKE_mask_layer_rename(mask, masklay, oldname, newname);
212 }
213 
214 static PointerRNA rna_MaskLayer_active_spline_get(PointerRNA *ptr)
215 {
216  MaskLayer *masklay = (MaskLayer *)ptr->data;
217 
218  return rna_pointer_inherit_refine(ptr, &RNA_MaskSpline, masklay->act_spline);
219 }
220 
221 static void rna_MaskLayer_active_spline_set(PointerRNA *ptr,
222  PointerRNA value,
223  struct ReportList *UNUSED(reports))
224 {
225  MaskLayer *masklay = (MaskLayer *)ptr->data;
226  MaskSpline *spline = (MaskSpline *)value.data;
227  int index = BLI_findindex(&masklay->splines, spline);
228 
229  if (index != -1) {
230  masklay->act_spline = spline;
231  }
232  else {
233  masklay->act_spline = NULL;
234  }
235 }
236 
237 static PointerRNA rna_MaskLayer_active_spline_point_get(PointerRNA *ptr)
238 {
239  MaskLayer *masklay = (MaskLayer *)ptr->data;
240 
241  return rna_pointer_inherit_refine(ptr, &RNA_MaskSplinePoint, masklay->act_point);
242 }
243 
244 static void rna_MaskLayer_active_spline_point_set(PointerRNA *ptr,
245  PointerRNA value,
246  struct ReportList *UNUSED(reports))
247 {
248  MaskLayer *masklay = (MaskLayer *)ptr->data;
249  MaskSpline *spline;
251 
252  masklay->act_point = NULL;
253 
254  for (spline = masklay->splines.first; spline; spline = spline->next) {
255  if (point >= spline->points && point < spline->points + spline->tot_point) {
256  masklay->act_point = point;
257 
258  break;
259  }
260  }
261 }
262 
263 static void rna_MaskSplinePoint_handle1_get(PointerRNA *ptr, float *values)
264 {
266  BezTriple *bezt = &point->bezt;
267  copy_v2_v2(values, bezt->vec[0]);
268 }
269 
270 static void rna_MaskSplinePoint_handle1_set(PointerRNA *ptr, const float *values)
271 {
273  BezTriple *bezt = &point->bezt;
274  copy_v2_v2(bezt->vec[0], values);
275 }
276 
277 static void rna_MaskSplinePoint_handle2_get(PointerRNA *ptr, float *values)
278 {
280  BezTriple *bezt = &point->bezt;
281  copy_v2_v2(values, bezt->vec[2]);
282 }
283 
284 static void rna_MaskSplinePoint_handle2_set(PointerRNA *ptr, const float *values)
285 {
287  BezTriple *bezt = &point->bezt;
288  copy_v2_v2(bezt->vec[2], values);
289 }
290 
291 static void rna_MaskSplinePoint_ctrlpoint_get(PointerRNA *ptr, float *values)
292 {
294  BezTriple *bezt = &point->bezt;
295  copy_v2_v2(values, bezt->vec[1]);
296 }
297 
298 static void rna_MaskSplinePoint_ctrlpoint_set(PointerRNA *ptr, const float *values)
299 {
301  BezTriple *bezt = &point->bezt;
302  copy_v2_v2(bezt->vec[1], values);
303 }
304 
305 static int rna_MaskSplinePoint_handle_type_get(PointerRNA *ptr)
306 {
308  BezTriple *bezt = &point->bezt;
309 
310  return bezt->h1;
311 }
312 
313 static MaskSpline *mask_spline_from_point(Mask *mask, MaskSplinePoint *point)
314 {
315  MaskLayer *mask_layer;
316  for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
317  MaskSpline *spline;
318  for (spline = mask_layer->splines.first; spline; spline = spline->next) {
319  if (point >= spline->points && point < spline->points + spline->tot_point) {
320  return spline;
321  }
322  }
323  }
324  return NULL;
325 }
326 
327 static 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 
337 static void rna_MaskSplinePoint_handle_type_set(PointerRNA *ptr, int value)
338 {
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);
346 }
347 
348 static int rna_MaskSplinePoint_handle_left_type_get(PointerRNA *ptr)
349 {
351  BezTriple *bezt = &point->bezt;
352 
353  return bezt->h1;
354 }
355 
356 static void rna_MaskSplinePoint_handle_left_type_set(PointerRNA *ptr, int value)
357 {
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);
365 }
366 
367 static int rna_MaskSplinePoint_handle_right_type_get(PointerRNA *ptr)
368 {
370  BezTriple *bezt = &point->bezt;
371 
372  return bezt->h2;
373 }
374 
375 static void rna_MaskSplinePoint_handle_right_type_set(PointerRNA *ptr, int value)
376 {
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);
384 }
385 
386 /* ** API ** */
387 
388 static 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 
397 static void rna_Mask_layers_remove(Mask *mask, ReportList *reports, PointerRNA *masklay_ptr)
398 {
399  MaskLayer *masklay = masklay_ptr->data;
400  if (BLI_findindex(&mask->masklayers, masklay) == -1) {
401  BKE_reportf(reports,
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  RNA_POINTER_INVALIDATE(masklay_ptr);
411 
413 }
414 
415 static void rna_Mask_layers_clear(Mask *mask)
416 {
417  BKE_mask_layer_free_list(&mask->masklayers);
418 
420 }
421 
422 static MaskSpline *rna_MaskLayer_spline_new(ID *id, MaskLayer *mask_layer)
423 {
424  Mask *mask = (Mask *)id;
425  MaskSpline *new_spline;
426 
427  new_spline = BKE_mask_spline_add(mask_layer);
428 
430 
431  return new_spline;
432 }
433 
434 static void rna_MaskLayer_spline_remove(ID *id,
435  MaskLayer *mask_layer,
436  ReportList *reports,
437  PointerRNA *spline_ptr)
438 {
439  Mask *mask = (Mask *)id;
440  MaskSpline *spline = spline_ptr->data;
441 
442  if (BKE_mask_spline_remove(mask_layer, spline) == false) {
443  BKE_reportf(
444  reports, RPT_ERROR, "Mask layer '%s' does not contain spline given", mask_layer->name);
445  return;
446  }
447 
448  RNA_POINTER_INVALIDATE(spline_ptr);
449 
451 }
452 
453 static void rna_Mask_start_frame_set(PointerRNA *ptr, int value)
454 {
455  Mask *data = (Mask *)ptr->data;
456  /* MINFRAME not MINAFRAME, since some output formats can't taken negative frames */
457  CLAMP(value, MINFRAME, MAXFRAME);
458  data->sfra = value;
459 
460  if (data->sfra >= data->efra) {
461  data->efra = MIN2(data->sfra, MAXFRAME);
462  }
463 }
464 
465 static void rna_Mask_end_frame_set(PointerRNA *ptr, int value)
466 {
467  Mask *data = (Mask *)ptr->data;
468  CLAMP(value, MINFRAME, MAXFRAME);
469  data->efra = value;
470 
471  if (data->sfra >= data->efra) {
472  data->sfra = MAX2(data->efra, MINFRAME);
473  }
474 }
475 
476 static void rna_MaskSpline_points_add(ID *id, MaskSpline *spline, int count)
477 {
478  Mask *mask = (Mask *)id;
479  MaskLayer *layer;
480  int active_point_index = -1;
481  int i, spline_shape_index;
482 
483  if (count <= 0) {
484  return;
485  }
486 
487  for (layer = mask->masklayers.first; layer; layer = layer->next) {
488  if (BLI_findindex(&layer->splines, spline) != -1) {
489  break;
490  }
491  }
492 
493  if (!layer) {
494  /* Shall not happen actually */
495  BLI_assert_msg(0, "No layer found for the spline");
496  return;
497  }
498 
499  if (layer->act_spline == spline) {
500  active_point_index = layer->act_point - spline->points;
501  }
502 
503  spline->points = MEM_recallocN(spline->points,
504  sizeof(MaskSplinePoint) * (spline->tot_point + count));
505  spline->tot_point += count;
506 
507  if (active_point_index >= 0) {
508  layer->act_point = spline->points + active_point_index;
509  }
510 
511  spline_shape_index = BKE_mask_layer_shape_spline_to_index(layer, spline);
512 
513  for (i = 0; i < count; i++) {
514  int point_index = spline->tot_point - count + i;
515  MaskSplinePoint *new_point = spline->points + point_index;
516  new_point->bezt.h1 = new_point->bezt.h2 = HD_ALIGN;
517  BKE_mask_calc_handle_point_auto(spline, new_point, true);
518  BKE_mask_parent_init(&new_point->parent);
519 
520  /* Not efficient, but there's no other way for now */
521  BKE_mask_layer_shape_changed_add(layer, spline_shape_index + point_index, true, true);
522  }
523 
525  DEG_id_tag_update(&mask->id, 0);
526 }
527 
528 static void rna_MaskSpline_point_remove(ID *id,
529  MaskSpline *spline,
530  ReportList *reports,
531  PointerRNA *point_ptr)
532 {
533  Mask *mask = (Mask *)id;
534  MaskSplinePoint *point = point_ptr->data;
535  MaskSplinePoint *new_point_array;
536  MaskLayer *layer;
537  int active_point_index = -1;
538  int point_index;
539 
540  for (layer = mask->masklayers.first; layer; layer = layer->next) {
541  if (BLI_findindex(&layer->splines, spline) != -1) {
542  break;
543  }
544  }
545 
546  if (!layer) {
547  /* Shall not happen actually */
548  BKE_report(reports, RPT_ERROR, "Mask layer not found for given spline");
549  return;
550  }
551 
552  if (point < spline->points || point >= spline->points + spline->tot_point) {
553  BKE_report(reports, RPT_ERROR, "Point is not found in given spline");
554  return;
555  }
556 
557  if (layer->act_spline == spline) {
558  active_point_index = layer->act_point - spline->points;
559  }
560 
561  point_index = point - spline->points;
562 
563  new_point_array = MEM_mallocN(sizeof(MaskSplinePoint) * (spline->tot_point - 1),
564  "remove mask point");
565 
566  memcpy(new_point_array, spline->points, sizeof(MaskSplinePoint) * point_index);
567  memcpy(new_point_array + point_index,
568  spline->points + point_index + 1,
569  sizeof(MaskSplinePoint) * (spline->tot_point - point_index - 1));
570 
571  MEM_freeN(spline->points);
572  spline->points = new_point_array;
573  spline->tot_point--;
574 
575  if (active_point_index >= 0) {
576  if (active_point_index == point_index) {
577  layer->act_point = NULL;
578  }
579  else if (active_point_index < point_index) {
580  layer->act_point = spline->points + active_point_index;
581  }
582  else {
583  layer->act_point = spline->points + active_point_index - 1;
584  }
585  }
586 
588  layer, BKE_mask_layer_shape_spline_to_index(layer, spline) + point_index, 1);
589 
591  DEG_id_tag_update(&mask->id, 0);
592 
593  RNA_POINTER_INVALIDATE(point_ptr);
594 }
595 
596 #else
597 static void rna_def_maskParent(BlenderRNA *brna)
598 {
599  StructRNA *srna;
600  PropertyRNA *prop;
601 
602  static const EnumPropertyItem mask_id_type_items[] = {
603  {ID_MC, "MOVIECLIP", ICON_SEQUENCE, "Movie Clip", ""},
604  {0, NULL, 0, NULL, NULL},
605  };
606 
607  static const EnumPropertyItem parent_type_items[] = {
608  {MASK_PARENT_POINT_TRACK, "POINT_TRACK", 0, "Point Track", ""},
609  {MASK_PARENT_PLANE_TRACK, "PLANE_TRACK", 0, "Plane Track", ""},
610  {0, NULL, 0, NULL, NULL},
611  };
612 
613  srna = RNA_def_struct(brna, "MaskParent", NULL);
614  RNA_def_struct_ui_text(srna, "Mask Parent", "Parenting settings for masking element");
615 
616  /* Target Properties - ID-block to Drive */
617  prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
618  RNA_def_property_struct_type(prop, "ID");
620  // RNA_def_property_editable_func(prop, "rna_maskSpline_id_editable");
621  /* NOTE: custom set function is ONLY to avoid rna setting a user for this. */
623  prop, NULL, "rna_MaskParent_id_set", "rna_MaskParent_id_typef", NULL);
625  prop, "ID", "ID-block to which masking element would be parented to or to its property");
626  RNA_def_property_update(prop, 0, "rna_Mask_update_parent");
627 
628  prop = RNA_def_property(srna, "id_type", PROP_ENUM, PROP_NONE);
629  RNA_def_property_enum_sdna(prop, NULL, "id_type");
630  RNA_def_property_enum_items(prop, mask_id_type_items);
632  RNA_def_property_enum_funcs(prop, NULL, "rna_MaskParent_id_type_set", NULL);
633  // RNA_def_property_editable_func(prop, "rna_MaskParent_id_type_editable");
634  RNA_def_property_ui_text(prop, "ID Type", "Type of ID-block that can be used");
635  RNA_def_property_update(prop, 0, "rna_Mask_update_parent");
636 
637  /* type */
638  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
640  RNA_def_property_ui_text(prop, "Parent Type", "Parent Type");
641  RNA_def_property_update(prop, 0, "rna_Mask_update_parent");
642 
643  /* parent */
644  prop = RNA_def_property(srna, "parent", PROP_STRING, PROP_NONE);
646  prop, "Parent", "Name of parent object in specified data-block to which parenting happens");
648  RNA_def_property_update(prop, 0, "rna_Mask_update_parent");
649 
650  /* sub_parent */
651  prop = RNA_def_property(srna, "sub_parent", PROP_STRING, PROP_NONE);
653  prop,
654  "Sub Parent",
655  "Name of parent sub-object in specified data-block to which parenting happens");
657  RNA_def_property_update(prop, 0, "rna_Mask_update_parent");
658 }
659 
661 {
662  StructRNA *srna;
663  PropertyRNA *prop;
664 
665  srna = RNA_def_struct(brna, "MaskSplinePointUW", NULL);
667  srna, "Mask Spline UW Point", "Single point in spline segment defining feather");
668 
669  /* u */
670  prop = RNA_def_property(srna, "u", PROP_FLOAT, PROP_NONE);
671  RNA_def_property_float_sdna(prop, NULL, "u");
672  RNA_def_property_range(prop, 0.0, 1.0);
673  RNA_def_property_ui_text(prop, "U", "U coordinate of point along spline segment");
674  RNA_def_property_update(prop, 0, "rna_Mask_update_data");
675 
676  /* weight */
677  prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
678  RNA_def_property_float_sdna(prop, NULL, "w");
679  RNA_def_property_range(prop, 0.0, 1.0);
680  RNA_def_property_ui_text(prop, "Weight", "Weight of feather point");
681  RNA_def_property_update(prop, 0, "rna_Mask_update_data");
682 
683  /* select */
684  prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
685  RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
686  RNA_def_property_ui_text(prop, "Select", "Selection status");
687  RNA_def_property_update(prop, 0, "rna_Mask_update_data");
688 }
689 
691 {
692  StructRNA *srna;
693  PropertyRNA *prop;
694 
695  static const EnumPropertyItem handle_type_items[] = {
696  {HD_AUTO, "AUTO", 0, "Auto", ""},
697  {HD_VECT, "VECTOR", 0, "Vector", ""},
698  {HD_ALIGN, "ALIGNED", 0, "Aligned Single", ""},
699  {HD_ALIGN_DOUBLESIDE, "ALIGNED_DOUBLESIDE", 0, "Aligned", ""},
700  {HD_FREE, "FREE", 0, "Free", ""},
701  {0, NULL, 0, NULL, NULL},
702  };
703 
705 
706  srna = RNA_def_struct(brna, "MaskSplinePoint", NULL);
708  srna, "Mask Spline Point", "Single point in spline used for defining mask");
709 
710  /* Vector values */
711  prop = RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_TRANSLATION);
712  RNA_def_property_array(prop, 2);
714  prop, "rna_MaskSplinePoint_handle1_get", "rna_MaskSplinePoint_handle1_set", NULL);
715  RNA_def_property_ui_text(prop, "Handle 1", "Coordinates of the first handle");
716  RNA_def_property_update(prop, 0, "rna_Mask_update_data");
717 
718  prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
719  RNA_def_property_array(prop, 2);
721  prop, "rna_MaskSplinePoint_ctrlpoint_get", "rna_MaskSplinePoint_ctrlpoint_set", NULL);
722  RNA_def_property_ui_text(prop, "Control Point", "Coordinates of the control point");
723  RNA_def_property_update(prop, 0, "rna_Mask_update_data");
724 
725  prop = RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_TRANSLATION);
726  RNA_def_property_array(prop, 2);
728  prop, "rna_MaskSplinePoint_handle2_get", "rna_MaskSplinePoint_handle2_set", NULL);
729  RNA_def_property_ui_text(prop, "Handle 2", "Coordinates of the second handle");
730  RNA_def_property_update(prop, 0, "rna_Mask_update_data");
731 
732  /* handle_type */
733  prop = RNA_def_property(srna, "handle_type", PROP_ENUM, PROP_NONE);
735  prop, "rna_MaskSplinePoint_handle_type_get", "rna_MaskSplinePoint_handle_type_set", NULL);
736  RNA_def_property_enum_items(prop, handle_type_items);
737  RNA_def_property_ui_text(prop, "Handle Type", "Handle type");
738  RNA_def_property_update(prop, 0, "rna_Mask_update_data");
739 
740  /* handle_type */
741  prop = RNA_def_property(srna, "handle_left_type", PROP_ENUM, PROP_NONE);
743  "rna_MaskSplinePoint_handle_left_type_get",
744  "rna_MaskSplinePoint_handle_left_type_set",
745  NULL);
746  RNA_def_property_enum_items(prop, handle_type_items);
747  RNA_def_property_ui_text(prop, "Handle 1 Type", "Handle type");
748  RNA_def_property_update(prop, 0, "rna_Mask_update_data");
749 
750  /* handle_right */
751  prop = RNA_def_property(srna, "handle_right_type", PROP_ENUM, PROP_NONE);
753  "rna_MaskSplinePoint_handle_right_type_get",
754  "rna_MaskSplinePoint_handle_right_type_set",
755  NULL);
756  RNA_def_property_enum_items(prop, handle_type_items);
757  RNA_def_property_ui_text(prop, "Handle 2 Type", "Handle type");
758  RNA_def_property_update(prop, 0, "rna_Mask_update_data");
759 
760  /* weight */
761  prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
762  RNA_def_property_float_sdna(prop, NULL, "bezt.weight");
763  RNA_def_property_range(prop, 0.0, 1.0);
764  RNA_def_property_ui_text(prop, "Weight", "Weight of the point");
765  RNA_def_property_update(prop, 0, "rna_Mask_update_data");
766 
767  /* select */
768  prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
769  RNA_def_property_boolean_sdna(prop, NULL, "bezt.f1", SELECT);
770  RNA_def_property_ui_text(prop, "Select", "Selection status");
771  RNA_def_property_update(prop, 0, "rna_Mask_update_data");
772 
773  /* parent */
774  prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
775  RNA_def_property_struct_type(prop, "MaskParent");
776 
777  /* feather points */
778  prop = RNA_def_property(srna, "feather_points", PROP_COLLECTION, PROP_NONE);
779  RNA_def_property_struct_type(prop, "MaskSplinePointUW");
780  RNA_def_property_collection_sdna(prop, NULL, "uw", "tot_uw");
781  RNA_def_property_ui_text(prop, "Feather Points", "Points defining feather");
782 }
783 
785 {
786  StructRNA *srna;
787  FunctionRNA *func;
788  PropertyRNA *prop;
789  PropertyRNA *parm;
790 
791  srna = RNA_def_struct(brna, "MaskSplines", NULL);
792  RNA_def_struct_sdna(srna, "MaskLayer");
793  RNA_def_struct_ui_text(srna, "Mask Splines", "Collection of masking splines");
794 
795  /* Create new spline */
796  func = RNA_def_function(srna, "new", "rna_MaskLayer_spline_new");
798  RNA_def_function_ui_description(func, "Add a new spline to the layer");
799  parm = RNA_def_pointer(func, "spline", "MaskSpline", "", "The newly created spline");
800  RNA_def_function_return(func, parm);
801 
802  /* Remove the spline */
803  func = RNA_def_function(srna, "remove", "rna_MaskLayer_spline_remove");
805  RNA_def_function_ui_description(func, "Remove a spline from a layer");
807  parm = RNA_def_pointer(func, "spline", "MaskSpline", "", "The spline to remove");
810 
811  /* active spline */
812  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
813  RNA_def_property_struct_type(prop, "MaskSpline");
815  prop, "rna_MaskLayer_active_spline_get", "rna_MaskLayer_active_spline_set", NULL, NULL);
817  RNA_def_property_ui_text(prop, "Active Spline", "Active spline of masking layer");
818 
819  /* active point */
820  prop = RNA_def_property(srna, "active_point", PROP_POINTER, PROP_NONE);
821  RNA_def_property_struct_type(prop, "MaskSplinePoint");
823  "rna_MaskLayer_active_spline_point_get",
824  "rna_MaskLayer_active_spline_point_set",
825  NULL,
826  NULL);
828  RNA_def_property_ui_text(prop, "Active Spline", "Active spline of masking layer");
829 }
830 
832 {
833  StructRNA *srna;
834  FunctionRNA *func;
835  PropertyRNA *parm;
836 
837  srna = RNA_def_struct(brna, "MaskSplinePoints", NULL);
838  RNA_def_struct_sdna(srna, "MaskSpline");
839  RNA_def_struct_ui_text(srna, "Mask Spline Points", "Collection of masking spline points");
840 
841  /* Create new point */
842  func = RNA_def_function(srna, "add", "rna_MaskSpline_points_add");
844  RNA_def_function_ui_description(func, "Add a number of point to this spline");
845  parm = RNA_def_int(
846  func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX);
848 
849  /* Remove the point */
850  func = RNA_def_function(srna, "remove", "rna_MaskSpline_point_remove");
852  RNA_def_function_ui_description(func, "Remove a point from a spline");
854  parm = RNA_def_pointer(func, "point", "MaskSplinePoint", "", "The point to remove");
857 }
858 
859 static void rna_def_maskSpline(BlenderRNA *brna)
860 {
861  static const EnumPropertyItem spline_interpolation_items[] = {
862  {MASK_SPLINE_INTERP_LINEAR, "LINEAR", 0, "Linear", ""},
863  {MASK_SPLINE_INTERP_EASE, "EASE", 0, "Ease", ""},
864  {0, NULL, 0, NULL, NULL},
865  };
866 
867  static const EnumPropertyItem spline_offset_mode_items[] = {
868  {MASK_SPLINE_OFFSET_EVEN, "EVEN", 0, "Even", "Calculate even feather offset"},
870  "SMOOTH",
871  0,
872  "Smooth",
873  "Calculate feather offset as a second curve"},
874  {0, NULL, 0, NULL, NULL},
875  };
876 
877  StructRNA *srna;
878  PropertyRNA *prop;
879 
881 
882  srna = RNA_def_struct(brna, "MaskSpline", NULL);
883  RNA_def_struct_ui_text(srna, "Mask spline", "Single spline used for defining mask shape");
884 
885  /* offset mode */
886  prop = RNA_def_property(srna, "offset_mode", PROP_ENUM, PROP_NONE);
887  RNA_def_property_enum_sdna(prop, NULL, "offset_mode");
888  RNA_def_property_enum_items(prop, spline_offset_mode_items);
890  prop, "Feather Offset", "The method used for calculating the feather offset");
891  RNA_def_property_update(prop, 0, "rna_Mask_update_data");
892 
893  /* weight interpolation */
894  prop = RNA_def_property(srna, "weight_interpolation", PROP_ENUM, PROP_NONE);
895  RNA_def_property_enum_sdna(prop, NULL, "weight_interp");
896  RNA_def_property_enum_items(prop, spline_interpolation_items);
898  prop, "Weight Interpolation", "The type of weight interpolation for spline");
899  RNA_def_property_update(prop, 0, "rna_Mask_update_data");
900 
901  /* cyclic */
902  prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
905  RNA_def_property_ui_text(prop, "Cyclic", "Make this spline a closed loop");
906  RNA_def_property_update(prop, NC_MASK | NA_EDITED, "rna_Mask_update_data");
907 
908  /* fill */
909  prop = RNA_def_property(srna, "use_fill", PROP_BOOLEAN, PROP_NONE);
912  RNA_def_property_ui_text(prop, "Fill", "Make this spline filled");
913  RNA_def_property_update(prop, NC_MASK | NA_EDITED, "rna_Mask_update_data");
914 
915  /* self-intersection check */
916  prop = RNA_def_property(srna, "use_self_intersection_check", PROP_BOOLEAN, PROP_NONE);
920  prop, "Self Intersection Check", "Prevent feather from self-intersections");
921  RNA_def_property_update(prop, NC_MASK | NA_EDITED, "rna_Mask_update_data");
922 
923  prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
924  RNA_def_property_struct_type(prop, "MaskSplinePoint");
925  RNA_def_property_collection_sdna(prop, NULL, "points", "tot_point");
926  RNA_def_property_ui_text(prop, "Points", "Collection of points");
927  RNA_def_property_srna(prop, "MaskSplinePoints");
928 }
929 
930 static void rna_def_mask_layer(BlenderRNA *brna)
931 {
932  static const EnumPropertyItem masklay_blend_mode_items[] = {
933  {MASK_BLEND_MERGE_ADD, "MERGE_ADD", 0, "Merge Add", ""},
934  {MASK_BLEND_MERGE_SUBTRACT, "MERGE_SUBTRACT", 0, "Merge Subtract", ""},
935  {MASK_BLEND_ADD, "ADD", 0, "Add", ""},
936  {MASK_BLEND_SUBTRACT, "SUBTRACT", 0, "Subtract", ""},
937  {MASK_BLEND_LIGHTEN, "LIGHTEN", 0, "Lighten", ""},
938  {MASK_BLEND_DARKEN, "DARKEN", 0, "Darken", ""},
939  {MASK_BLEND_MUL, "MUL", 0, "Multiply", ""},
940  {MASK_BLEND_REPLACE, "REPLACE", 0, "Replace", ""},
941  {MASK_BLEND_DIFFERENCE, "DIFFERENCE", 0, "Difference", ""},
942  {0, NULL, 0, NULL, NULL},
943  };
944 
945  StructRNA *srna;
946  PropertyRNA *prop;
947 
948  rna_def_maskSpline(brna);
949  rna_def_mask_splines(brna);
951 
952  srna = RNA_def_struct(brna, "MaskLayer", NULL);
953  RNA_def_struct_ui_text(srna, "Mask Layer", "Single layer used for masking pixels");
954  RNA_def_struct_path_func(srna, "rna_MaskLayer_path");
955 
956  /* name */
957  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
958  RNA_def_property_ui_text(prop, "Name", "Unique name of layer");
959  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MaskLayer_name_set");
961  RNA_def_property_update(prop, 0, "rna_Mask_update_data");
962  RNA_def_struct_name_property(srna, prop);
963 
964  /* splines */
965  prop = RNA_def_property(srna, "splines", PROP_COLLECTION, PROP_NONE);
967  "rna_MaskLayer_splines_begin",
968  "rna_iterator_listbase_next",
969  "rna_iterator_listbase_end",
970  "rna_iterator_listbase_get",
971  NULL,
972  NULL,
973  NULL,
974  NULL);
975  RNA_def_property_struct_type(prop, "MaskSpline");
976  RNA_def_property_ui_text(prop, "Splines", "Collection of splines which defines this layer");
977  RNA_def_property_srna(prop, "MaskSplines");
978 
979  /* restrict */
980  prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
981  RNA_def_property_boolean_sdna(prop, NULL, "visibility_flag", MASK_HIDE_VIEW);
982  RNA_def_property_ui_text(prop, "Restrict View", "Restrict visibility in the viewport");
983  RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, -1);
985 
986  prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
987  RNA_def_property_boolean_sdna(prop, NULL, "visibility_flag", MASK_HIDE_SELECT);
988  RNA_def_property_ui_text(prop, "Restrict Select", "Restrict selection in the viewport");
989  RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, -1);
991 
992  prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
993  RNA_def_property_boolean_sdna(prop, NULL, "visibility_flag", MASK_HIDE_RENDER);
994  RNA_def_property_ui_text(prop, "Restrict Render", "Restrict renderability");
995  RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, -1);
997 
998  /* Select (for dope-sheet). */
999  prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
1001  RNA_def_property_ui_text(prop, "Select", "Layer is selected for editing in the Dope Sheet");
1002  // RNA_def_property_update(prop, NC_SCREEN | ND_MASK, NULL);
1003 
1004  /* render settings */
1005  prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE);
1006  RNA_def_property_float_sdna(prop, NULL, "alpha");
1007  RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
1008  RNA_def_property_ui_text(prop, "Opacity", "Render Opacity");
1010 
1011  /* weight interpolation */
1012  prop = RNA_def_property(srna, "blend", PROP_ENUM, PROP_NONE);
1013  RNA_def_property_enum_sdna(prop, NULL, "blend");
1014  RNA_def_property_enum_items(prop, masklay_blend_mode_items);
1015  RNA_def_property_ui_text(prop, "Blend", "Method of blending mask layers");
1016  RNA_def_property_update(prop, 0, "rna_Mask_update_data");
1018 
1019  prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
1021  RNA_def_property_ui_text(prop, "Restrict View", "Invert the mask black/white");
1023 
1024  prop = RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
1025  RNA_def_property_enum_sdna(prop, NULL, "falloff");
1027  RNA_def_property_ui_text(prop, "Falloff", "Falloff type the feather");
1029  BLT_I18NCONTEXT_ID_CURVE_LEGACY); /* Abusing id_curve :/ */
1031 
1032  /* filling options */
1033  prop = RNA_def_property(srna, "use_fill_holes", PROP_BOOLEAN, PROP_NONE);
1036  prop, "Calculate Holes", "Calculate holes when filling overlapping curves");
1038 
1039  prop = RNA_def_property(srna, "use_fill_overlap", PROP_BOOLEAN, PROP_NONE);
1042  prop, "Calculate Overlap", "Calculate self intersections and overlap before filling");
1044 }
1045 
1046 static void rna_def_masklayers(BlenderRNA *brna, PropertyRNA *cprop)
1047 {
1048  StructRNA *srna;
1049  PropertyRNA *prop;
1050 
1051  FunctionRNA *func;
1052  PropertyRNA *parm;
1053 
1054  RNA_def_property_srna(cprop, "MaskLayers");
1055  srna = RNA_def_struct(brna, "MaskLayers", NULL);
1056  RNA_def_struct_sdna(srna, "Mask");
1057  RNA_def_struct_ui_text(srna, "Mask Layers", "Collection of layers used by mask");
1058 
1059  func = RNA_def_function(srna, "new", "rna_Mask_layers_new");
1060  RNA_def_function_ui_description(func, "Add layer to this mask");
1061  RNA_def_string(func, "name", NULL, 0, "Name", "Name of new layer");
1062  parm = RNA_def_pointer(func, "layer", "MaskLayer", "", "New mask layer");
1063  RNA_def_function_return(func, parm);
1064 
1065  func = RNA_def_function(srna, "remove", "rna_Mask_layers_remove");
1067  RNA_def_function_ui_description(func, "Remove layer from this mask");
1068  parm = RNA_def_pointer(func, "layer", "MaskLayer", "", "Shape to be removed");
1071 
1072  /* clear all layers */
1073  func = RNA_def_function(srna, "clear", "rna_Mask_layers_clear");
1074  RNA_def_function_ui_description(func, "Remove all mask layers");
1075 
1076  /* active layer */
1077  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
1078  RNA_def_property_struct_type(prop, "MaskLayer");
1080  prop, "rna_Mask_layer_active_get", "rna_Mask_layer_active_set", NULL, NULL);
1082  RNA_def_property_ui_text(prop, "Active Shape", "Active layer in this mask");
1083 }
1084 
1085 static void rna_def_mask(BlenderRNA *brna)
1086 {
1087  StructRNA *srna;
1088  PropertyRNA *prop;
1089 
1090  rna_def_mask_layer(brna);
1091 
1092  srna = RNA_def_struct(brna, "Mask", "ID");
1093  RNA_def_struct_ui_text(srna, "Mask", "Mask data-block defining mask for compositing");
1094  RNA_def_struct_ui_icon(srna, ICON_MOD_MASK);
1095 
1096  /* mask layers */
1097  prop = RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
1099  "rna_Mask_layers_begin",
1100  "rna_iterator_listbase_next",
1101  "rna_iterator_listbase_end",
1102  "rna_iterator_listbase_get",
1103  NULL,
1104  NULL,
1105  NULL,
1106  NULL);
1107  RNA_def_property_struct_type(prop, "MaskLayer");
1108  RNA_def_property_ui_text(prop, "Layers", "Collection of layers which defines this mask");
1109  rna_def_masklayers(brna, prop);
1110 
1111  /* active masklay index */
1112  prop = RNA_def_property(srna, "active_layer_index", PROP_INT, PROP_NONE);
1113  RNA_def_property_int_sdna(prop, NULL, "masklay_act");
1116  "rna_Mask_layer_active_index_get",
1117  "rna_Mask_layer_active_index_set",
1118  "rna_Mask_layer_active_index_range");
1120  prop, "Active Shape Index", "Index of active layer in list of all mask's layers");
1122 
1123  /* frame range */
1124  prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
1126  RNA_def_property_int_sdna(prop, NULL, "sfra");
1127  RNA_def_property_int_funcs(prop, NULL, "rna_Mask_start_frame_set", NULL);
1129  RNA_def_property_ui_text(prop, "Start Frame", "First frame of the mask (used for sequencer)");
1131 
1132  prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
1134  RNA_def_property_int_sdna(prop, NULL, "efra");
1135  RNA_def_property_int_funcs(prop, NULL, "rna_Mask_end_frame_set", NULL);
1137  RNA_def_property_ui_text(prop, "End Frame", "Final frame of the mask (used for sequencer)");
1139 
1140  /* pointers */
1142 }
1143 
1145 {
1146  rna_def_maskParent(brna);
1147  rna_def_mask(brna);
1148 }
1149 
1150 #endif
void BKE_mask_layer_shape_changed_add(struct MaskLayer *masklay, int index, bool do_init, bool do_init_interpolate)
Definition: mask.c:1894
void BKE_mask_layer_remove(struct Mask *mask, struct MaskLayer *masklay)
Definition: mask.c:371
bool BKE_mask_spline_remove(struct MaskLayer *mask_layer, struct MaskSpline *spline)
Definition: mask.c:493
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.
Definition: mask.c:1495
void BKE_mask_layer_free_list(struct ListBase *masklayers)
Definition: mask.c:1170
void BKE_mask_calc_handle_point(struct MaskSpline *spline, struct MaskSplinePoint *point)
Definition: mask.c:1440
struct MaskLayer * BKE_mask_layer_new(struct Mask *mask, const char *name)
Definition: mask.c:337
struct MaskLayer * BKE_mask_layer_active(struct Mask *mask)
Definition: mask.c:361
void BKE_mask_layer_active_set(struct Mask *mask, struct MaskLayer *masklay)
Definition: mask.c:366
void BKE_mask_layer_rename(struct Mask *mask, struct MaskLayer *masklay, char *oldname, char *newname)
Definition: mask.c:393
int BKE_mask_layer_shape_spline_to_index(struct MaskLayer *masklay, struct MaskSpline *spline)
Definition: mask.c:1846
void BKE_mask_coord_from_movieclip(struct MovieClip *clip, struct MovieClipUser *user, float r_co[2], const float co[2])
Definition: mask.c:1200
void BKE_mask_layer_shape_changed_remove(struct MaskLayer *masklay, int index, int count)
Definition: mask.c:1988
void BKE_mask_parent_init(struct MaskParent *parent)
Definition: mask.c:1577
struct MaskSpline * BKE_mask_spline_add(struct MaskLayer *masklay)
Definition: mask.c:469
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)
Definition: movieclip.c:1614
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.c:83
struct MovieTrackingTrack * BKE_tracking_track_get_named(struct MovieTracking *tracking, struct MovieTrackingObject *object, const char *name)
Definition: tracking.c:1038
struct MovieTrackingPlaneTrack * BKE_tracking_plane_track_get_named(struct MovieTracking *tracking, struct MovieTrackingObject *object, const char *name)
Definition: tracking.c:1703
struct MovieTrackingPlaneMarker * BKE_tracking_plane_marker_get(struct MovieTrackingPlaneTrack *plane_track, int framenr)
Definition: tracking.c:1890
struct MovieTrackingObject * BKE_tracking_object_get_named(struct MovieTracking *tracking, const char *name)
Definition: tracking.c:2077
struct MovieTrackingMarker * BKE_tracking_marker_get(struct MovieTrackingTrack *track, int framenr)
Definition: tracking.c:1424
#define BLI_assert_msg(a, msg)
Definition: BLI_assert.h:53
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
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])
size_t size_t char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
Definition: string.c:64
size_t size_t char size_t BLI_str_escape(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL()
Definition: string.c:250
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL(1
#define UNUSED(x)
#define MAX2(a, b)
#define MIN2(a, b)
#define BLT_I18NCONTEXT_ID_CURVE_LEGACY
void DEG_id_tag_update(struct ID *id, int flag)
@ ID_RECALC_GEOMETRY
Definition: DNA_ID.h:791
#define MAX_ID_NAME
Definition: DNA_ID.h:337
@ ID_MC
Definition: DNA_ID_enums.h:73
@ HD_VECT
@ HD_FREE
@ HD_AUTO
@ HD_ALIGN_DOUBLESIDE
@ HD_ALIGN
#define DNA_struct_default_get(struct_name)
Definition: DNA_defaults.h:29
#define MASK_HIDE_SELECT
#define MASK_HIDE_VIEW
@ MASK_SPLINE_INTERP_EASE
@ MASK_SPLINE_INTERP_LINEAR
@ MASK_LAYERFLAG_FILL_OVERLAP
@ MASK_LAYERFLAG_FILL_DISCRETE
@ MASK_LAYERFLAG_SELECT
#define MASK_HIDE_RENDER
@ MASK_SPLINE_CYCLIC
@ MASK_SPLINE_NOINTERSECT
@ MASK_SPLINE_NOFILL
@ 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_OFFSET_SMOOTH
@ MASK_SPLINE_OFFSET_EVEN
@ MASK_PARENT_PLANE_TRACK
@ MASK_PARENT_POINT_TRACK
@ MASK_BLENDFLAG_INVERT
Object is a sort of wrapper for general info.
#define MINFRAME
#define MAXFRAME
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
#define MEM_recallocN(vmemh, len)
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
#define RNA_POINTER_INVALIDATE(ptr)
Definition: RNA_access.h:744
StructRNA * ID_code_to_RNA_type(short idcode)
@ PARM_RNAPTR
Definition: RNA_types.h:354
@ PARM_REQUIRED
Definition: RNA_types.h:352
@ FUNC_USE_REPORTS
Definition: RNA_types.h:663
@ FUNC_USE_SELF_ID
Definition: RNA_types.h:650
@ PROP_FLOAT
Definition: RNA_types.h:61
@ PROP_BOOLEAN
Definition: RNA_types.h:59
@ PROP_ENUM
Definition: RNA_types.h:63
@ PROP_INT
Definition: RNA_types.h:60
@ PROP_STRING
Definition: RNA_types.h:62
@ PROP_POINTER
Definition: RNA_types.h:64
@ PROP_COLLECTION
Definition: RNA_types.h:65
@ PROP_THICK_WRAP
Definition: RNA_types.h:285
@ PROP_ANIMATABLE
Definition: RNA_types.h:202
@ PROP_NEVER_UNLINK
Definition: RNA_types.h:246
@ PROP_EDITABLE
Definition: RNA_types.h:189
@ PROP_NEVER_NULL
Definition: RNA_types.h:239
@ PROP_TIME
Definition: RNA_types.h:146
@ PROP_NONE
Definition: RNA_types.h:126
@ PROP_TRANSLATION
Definition: RNA_types.h:154
#define ND_DRAW
Definition: WM_types.h:410
#define ND_DATA
Definition: WM_types.h:456
#define NA_EDITED
Definition: WM_types.h:523
#define NC_MASK
Definition: WM_types.h:348
#define SELECT
Scene scene
int count
#define GS(x)
Definition: iris.c:225
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:33
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
Definition: math_float4.h:513
void rna_iterator_listbase_begin(CollectionPropertyIterator *iter, ListBase *lb, IteratorSkipFunc skip)
Definition: rna_access.c:4729
PointerRNA rna_pointer_inherit_refine(PointerRNA *ptr, StructRNA *type, void *data)
Definition: rna_access.c:186
void rna_def_animdata_common(StructRNA *srna)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
Definition: rna_define.c:1193
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
Definition: rna_define.c:4170
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
Definition: rna_define.c:2236
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1526
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
Definition: rna_define.c:3285
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
Definition: rna_define.c:4312
void RNA_def_property_enum_default(PropertyRNA *prop, int value)
Definition: rna_define.c:2106
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
Definition: rna_define.c:3126
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
Definition: rna_define.c:1645
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
Definition: rna_define.c:1653
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
Definition: rna_define.c:4273
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
Definition: rna_define.c:3474
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)
Definition: rna_define.c:3420
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
Definition: rna_define.c:1237
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
Definition: rna_define.c:1872
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
Definition: rna_define.c:1048
void RNA_def_property_array(PropertyRNA *prop, int length)
Definition: rna_define.c:1539
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
Definition: rna_define.c:1737
void RNA_def_property_string_maxlength(PropertyRNA *prop, int maxlength)
Definition: rna_define.c:1920
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
Definition: rna_define.c:1772
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
Definition: rna_define.c:2769
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
Definition: rna_define.c:4347
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
Definition: rna_define.c:2900
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
Definition: rna_define.c:3224
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
Definition: rna_define.c:1257
void RNA_def_struct_name_property(struct StructRNA *srna, struct PropertyRNA *prop)
Definition: rna_define.c:1103
void RNA_def_function_flag(FunctionRNA *func, int flag)
Definition: rna_define.c:4342
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1495
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
Definition: rna_define.c:3385
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
Definition: rna_define.c:1028
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2601
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
Definition: rna_define.c:3028
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
Definition: rna_define.c:1245
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3687
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
Definition: rna_define.c:2848
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1490
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
Definition: rna_define.c:3597
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2493
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
Definition: rna_define.c:1664
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2343
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
Definition: rna_define.c:2327
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1518
static const EnumPropertyItem parent_type_items[]
Definition: rna_gpencil.c:33
static void rna_def_mask(BlenderRNA *brna)
Definition: rna_mask.c:1085
static void rna_def_maskSplinePoints(BlenderRNA *brna)
Definition: rna_mask.c:831
static void rna_def_mask_layer(BlenderRNA *brna)
Definition: rna_mask.c:930
static void rna_def_masklayers(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_mask.c:1046
static void rna_def_mask_splines(BlenderRNA *brna)
Definition: rna_mask.c:784
static void rna_def_maskSpline(BlenderRNA *brna)
Definition: rna_mask.c:859
static void rna_def_maskSplinePointUW(BlenderRNA *brna)
Definition: rna_mask.c:660
void RNA_def_mask(BlenderRNA *brna)
Definition: rna_mask.c:1144
static void rna_def_maskSplinePoint(BlenderRNA *brna)
Definition: rna_mask.c:690
static void rna_def_maskParent(BlenderRNA *brna)
Definition: rna_mask.c:597
const EnumPropertyItem rna_enum_proportional_falloff_curve_only_items[]
Definition: rna_scene.c:120
#define min(a, b)
Definition: sort.c:35
uint8_t h1
float vec[3][3]
uint8_t h2
Definition: DNA_ID.h:368
char name[66]
Definition: DNA_ID.h:378
void * first
Definition: DNA_listBase.h:31
Definition: BKE_main.h:121
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
struct MovieTracking tracking
void * data
Definition: RNA_types.h:38
struct ID * owner_id
Definition: RNA_types.h:36
struct RenderData r
float max
void WM_main_add_notifier(unsigned int type, void *reference)
PointerRNA * ptr
Definition: wm_files.c:3480