59 mask->runtime.last_update = 0;
63 std::optional<Library *> ,
68 Mask *mask_dst = id_cast<Mask *>(id_dst);
69 const Mask *mask_src = id_cast<const Mask *>(id_src);
95 for (
int i = 0; i < mask_spline.
tot_point; i++) {
156 spline.
runtime = MEM_new<bke::MaskSplineRuntime>(__func__);
160 for (
int i = 0; i < spline.
tot_point; i++) {
169 if ((act_point_search ==
nullptr) && (masklay.
act_point >= points_old) &&
196 .id_code = Mask::id_type,
200 .struct_size =
sizeof(
Mask),
202 .name_plural =
N_(
"masks"),
205 .asset_type_info =
nullptr,
207 .init_data =
nullptr,
210 .make_local =
nullptr,
212 .foreach_cache =
nullptr,
213 .foreach_path =
nullptr,
214 .foreach_working_space_color =
nullptr,
215 .foreach_asset_weak_reference =
nullptr,
216 .owner_pointer_get =
nullptr,
220 .blend_read_after_liblink =
nullptr,
222 .blend_read_undo_preserve =
nullptr,
224 .lib_override_apply_post =
nullptr,
235 return mask_clipboard;
242 if (point == &points_array[spline->
tot_point - 1]) {
244 return &points_array[0];
257 if (point == points_array) {
259 return &points_array[spline->
tot_point - 1];
272 if (point == &points_array[spline->
tot_point - 1]) {
274 return &(points_array[0].
bezt);
280 return &(point + 1)->bezt;
292 if ((point_ref >= spline->
points) && (point_ref < &spline->points[spline->
tot_point])) {
297 if ((point_ref >= points_deform) &&
298 (point_ref < points_deform + spline->runtime->points_deform.size()))
300 return points_deform;
311 MaskLayer *masklay = MEM_new<MaskLayer>(__func__);
322 masklay->
alpha = 1.0f;
337 if (
STREQ(mask_layer.
name, layer_name)) {
356 if (
mask->masklay_act >=
mask->masklay_tot) {
357 mask->masklay_act =
mask->masklay_tot - 1;
368 sizeof(masklay->
name));
389 MaskLayer *masklay_new = MEM_new<MaskLayer>(
"new mask layer");
421 MaskLayerShape *masklay_shape_new = MEM_new<MaskLayerShape>(
"new mask layer shape");
423 masklay_shape_new->
data = MEM_dupalloc(masklay_shape.
data);
425 masklay_shape_new->
flag = masklay_shape.
flag;
426 masklay_shape_new->
frame = masklay_shape.
frame;
436 const ListBaseT<MaskLayer> *masklayers)
449 MaskSpline *spline = MEM_new<MaskSpline>(
"new mask spline");
450 spline->
runtime = MEM_new<bke::MaskSplineRuntime>(__func__);
455 spline->
points = MEM_new_array<MaskSplinePoint>(1,
"new mask spline point");
475 if (src_mask_layer != dst_mask_layer) {
494 const int tot_uw = point->
tot_uw;
495 const int tot_uw_half = tot_uw / 2;
510 for (
int i = 0; i < tot_uw_half; i++) {
513 std::swap(*uw_a, *uw_b);
517 for (
int i = 0; i < tot_uw; i++) {
519 uw->
u = 1.0f - uw->
u;
526 const int tot_point_half = tot_point / 2;
534 for (i = 0; i < tot_point_half; i++) {
537 std::swap(*point_a, *point_b);
541 i_prev = tot_point - 1;
542 for (i = 0; i < tot_point; i++) {
559 for (i = 0; i < tot_point_half; i++) {
562 std::swap(*fp_a, *fp_b);
574 const float proj_eps = 1
e-3;
575 const float proj_eps_sq = proj_eps * proj_eps;
577 float u = -1.0f, du = 1.0f /
N, u1 = start_u, u2 = start_u;
582 while (u1 > 0.0f || u2 < 1.0f) {
583 float n1[2], n2[2], co1[2], co2[2];
598 if (ang1 >
float(
M_PI_2)) {
602 if (ang < 0.0f || ang1 < ang) {
625 if (ang2 >
float(
M_PI_2)) {
672 r_handle[0] = (bezt->
vec[1][0] + vec[1]);
673 r_handle[1] = (bezt->
vec[1][1] - vec[0]);
682 BLI_assert_msg(0,
"Unknown handle passed to BKE_mask_point_handle");
690 float orig_handle[2],
691 float orig_vec[3][3])
696 float v1[2],
v2[2], vec[2];
697 if (keep_direction) {
735 BLI_assert_msg(0,
"unknown handle passed to BKE_mask_point_set_handle");
753 co, bezt->
vec[1], bezt->
vec[2], bezt_next->vec[0], bezt_next->vec[1], u);
772 const float du = 0.05f;
776 if (u - du < 0.0f && point_prev ==
nullptr) {
782 else if (u + du > 1.0f && point_next ==
nullptr) {
789 float prev_co[2], next_co[2], co[2];
790 float dir1[2], dir2[2], dir[2];
821 return (bezt->
weight * (1.0f - u)) + (bezt_next->
weight * u);
838 return bezt_next->weight;
858 return bezt_next->weight;
861 float cur_u = 0.0f, cur_w = 0.0f, next_u = 0.0f, next_w = 0.0f, fac;
863 for (
int i = 0; i <= point->
tot_uw; i++) {
869 cur_u = point->
uw[i - 1].
u;
870 cur_w = point->
uw[i - 1].
w;
878 next_u = point->
uw[i].
u;
879 next_w = point->
uw[i].
w;
882 if (u >= cur_u && u <= next_u) {
887 fac = (u - cur_u) / (next_u - cur_u);
893 return cur_w + (next_w - cur_w) * (3.0f * fac * fac - 2.0f * fac * fac * fac);
896 return (1.0f - fac) * cur_w + fac * next_w;
902 int idx = uw - point->
uw;
904 if (idx > 0 && point->
uw[idx - 1].
u > uw->
u) {
905 while (idx > 0 && point->
uw[idx - 1].
u > point->
uw[idx].
u) {
906 std::swap(point->
uw[idx - 1], point->
uw[idx]);
911 if (idx < point->tot_uw - 1 && point->
uw[idx + 1].
u < uw->
u) {
912 while (idx < point->tot_uw - 1 && point->
uw[idx + 1].
u < point->
uw[idx].
u) {
913 std::swap(point->
uw[idx + 1], point->
uw[idx]);
918 return &point->
uw[idx];
927 point->
uw = MEM_new_array<MaskSplinePointUW>(point->
tot_uw + 1,
"mask point uw");
952 for (
int i = 0; i < point->
tot_uw; i++) {
964 const bool do_select)
978 BLI_assert_msg(0,
"Wrong which_handle passed to BKE_mask_point_select_set_handle");
993 BLI_assert_msg(0,
"Wrong which_handle passed to BKE_mask_point_select_set_handle");
1029 MEM_delete(point->
uw);
1035 for (
int i = 0; i < spline->
tot_point; i++) {
1042 MEM_delete(spline->
points);
1058 spline = next_spline;
1066 for (
int i = 0; i < tot_point; i++) {
1070 point->
uw = MEM_dupalloc(point->
uw);
1079 MaskSpline *nspline = MEM_new<MaskSpline>(
"new spline");
1083 nspline->
runtime = MEM_new<bke::MaskSplineRuntime>(__func__);
1090 point.
uw = MEM_dupalloc(point.
uw);
1103 masklay_shape = MEM_new<MaskLayerShape>(__func__);
1104 masklay_shape->
frame = frame;
1105 masklay_shape->
tot_vert = tot_vert;
1106 masklay_shape->
data =
reinterpret_cast<float *
>(
1109 return masklay_shape;
1114 if (masklay_shape->
data) {
1115 MEM_delete(masklay_shape->
data);
1118 MEM_delete(masklay_shape);
1127 while (masklay_shape) {
1133 masklay_shape = next_masklay_shape;
1145 MEM_delete(masklay);
1150 MaskLayer *masklay = masklayers->first();
1158 masklay = masklay_next;
1164 if (frame_size[0] == frame_size[1]) {
1168 else if (frame_size[0] < frame_size[1]) {
1169 r_co[0] = ((co[0] - 0.5f) * (frame_size[0] / frame_size[1])) + 0.5f;
1174 r_co[1] = ((co[1] - 0.5f) * (frame_size[1] / frame_size[0])) + 0.5f;
1184 float frame_size[2];
1190 frame_size[1] *= (aspy / aspx);
1198 float frame_size[2];
1203 frame_size[1] *= (aspy / aspx);
1210 if (frame_size[0] == frame_size[1]) {
1214 else if (frame_size[0] < frame_size[1]) {
1215 r_co[0] = ((co[0] - 0.5f) / (frame_size[0] / frame_size[1])) + 0.5f;
1220 r_co[1] = ((co[1] - 0.5f) / (frame_size[1] / frame_size[0])) + 0.5f;
1230 float frame_size[2];
1236 frame_size[1] *= (aspy / aspx);
1244 float frame_size[2];
1250 frame_size[1] *= (aspy / aspx);
1257 float parent_matrix[3][3])
1269 MovieClip *clip = id_cast<MovieClip *>(parent->
id);
1283 float marker_position[2], parent_co[2];
1294 float corners[4][2];
1296 float frame_size[2],
H[3][3], mask_from_clip_matrix[3][3], mask_to_clip_matrix[3][3];
1301 unit_m3(mask_from_clip_matrix);
1306 frame_size[1] *= (aspy / aspx);
1307 if (frame_size[0] == frame_size[1]) {
1310 else if (frame_size[0] < frame_size[1]) {
1311 mask_from_clip_matrix[0][0] = frame_size[1] / frame_size[0];
1312 mask_from_clip_matrix[2][0] = -0.5f * (frame_size[1] / frame_size[0]) + 0.5f;
1315 mask_from_clip_matrix[1][1] = frame_size[1] / frame_size[0];
1316 mask_from_clip_matrix[2][1] = -0.5f * (frame_size[1] / frame_size[0]) + 0.5f;
1319 invert_m3_m3(mask_to_clip_matrix, mask_from_clip_matrix);
1320 mul_m3_series(parent_matrix, mask_from_clip_matrix,
H, mask_to_clip_matrix);
1333 BezTriple *bezt_prev =
nullptr, *bezt_next =
nullptr;
1337 bezt_prev = &point_prev->
bezt;
1341 bezt_next = &point_next->
bezt;
1345 if (bezt_prev || bezt_next) {
1352 else if (handle_type ==
HD_AUTO) {
1392 float tvec_a[2], tvec_b[2];
1433 float length_average = 0.0f;
1434 float weight_average = 0.0f;
1442 if (point_prev && point_next) {
1464 length_average /=
float(length_tot);
1465 weight_average /=
float(length_tot);
1475 const bool do_recalc_length)
1479 const float length_average = (do_recalc_length) ?
1491 point->
bezt.
h1 = h_back[0];
1492 point->
bezt.
h2 = h_back[1];
1495 if (do_recalc_length ==
false) {
1504 for (
int i = 0; i < spline.
tot_point; i++) {
1595 if (masklay_shape->
tot_vert == tot) {
1599 for (
int i = 0; i < spline.
tot_point; i++) {
1607 "vert mismatch %d != %d (frame %d)",
1610 masklay_shape->
frame);
1618 if (masklay_shape->
tot_vert == tot) {
1622 for (
int i = 0; i < spline.
tot_point; i++) {
1630 "vert mismatch %d != %d (frame %d)",
1633 masklay_shape->
frame);
1638 float target[2],
const float a[2],
const float b[2],
const float t,
const float s)
1640 target[0] = s * a[0] + t *
b[0];
1641 target[1] = s * a[1] + t *
b[1];
1650 if (masklay_shape_a->
tot_vert == tot && masklay_shape_b->
tot_vert == tot) {
1653 const float ifac = 1.0f - fac;
1656 for (
int i = 0; i < spline.
tot_point; i++) {
1670 "vert mismatch %d != %d != %d (frame %d - %d)",
1674 masklay_shape_a->
frame,
1675 masklay_shape_b->
frame);
1682 if (frame == masklay_shape.
frame) {
1683 return &masklay_shape;
1685 if (frame < masklay_shape.
frame) {
1700 for (masklay_shape = masklay->
splines_shapes.first(); masklay_shape;
1701 masklay_shape = masklay_shape->
next)
1703 if (frame == masklay_shape->
frame) {
1704 *r_masklay_shape_a = masklay_shape;
1705 *r_masklay_shape_b =
nullptr;
1708 if (frame < masklay_shape->frame) {
1709 if (masklay_shape->
prev) {
1710 *r_masklay_shape_a = masklay_shape->
prev;
1711 *r_masklay_shape_b = masklay_shape;
1715 *r_masklay_shape_a = masklay_shape;
1716 *r_masklay_shape_b =
nullptr;
1722 if (masklay_shape) {
1723 *r_masklay_shape_a = masklay_shape;
1724 *r_masklay_shape_b =
nullptr;
1728 *r_masklay_shape_a =
nullptr;
1729 *r_masklay_shape_b =
nullptr;
1740 if (masklay_shape ==
nullptr) {
1746 return masklay_shape;
1751 MaskLayerShape *masklay_shape_copy = MEM_dupalloc(masklay_shape);
1753 if (masklay_shape_copy->
data) [[likely]] {
1754 masklay_shape_copy->
data = MEM_dupalloc(masklay_shape_copy->
data);
1757 return masklay_shape_copy;
1768 const void *masklay_shape_b_ptr)
1773 if (masklay_shape_a->
frame < masklay_shape_b->
frame) {
1776 if (masklay_shape_a->
frame > masklay_shape_b->
frame) {
1795 *r_masklay_shape = &spline;
1809 for (spline_iter = masklay->
splines.first(); spline_iter && spline_iter != spline;
1810 i_abs += spline_iter->
tot_point, spline_iter = spline_iter->
next)
1821 const float pt_a[2],
1822 const float pt_b[2])
1824 const float segment_len =
len_v2v2(pt_a, pt_b);
1825 if (segment_len == 0.0f) {
1831 float pt_on_line[2];
1834 r_uv[1] = (
len_v2v2(pt_on_line, pt) / segment_len) *
1841 const float pt_a[2],
1842 const float pt_b[2])
1844 const float dvec[2] = {pt_b[0] - pt_a[0], pt_b[1] - pt_a[1]};
1850 r_pt[0] += -dvec[1] * uv[1];
1851 r_pt[1] += dvec[0] * uv[1];
1857 bool do_init_interpolate)
1861 int spline_point_index;
1872 const int pi_curr = spline_point_index;
1873 const int pi_prev = ((spline_point_index - 1) + spline->
tot_point) % spline->
tot_point;
1874 const int pi_next = (spline_point_index + 1) % spline->
tot_point;
1876 const int index_offset =
index - spline_point_index;
1878 const int pi_prev_abs = pi_prev + index_offset;
1879 const int pi_next_abs = pi_next + index_offset;
1881 if (do_init_interpolate) {
1882 for (
int i = 0; i < 3; i++) {
1891 if (tot == masklay_shape.
tot_vert) {
1896 masklay_shape.
data);
1898 std::copy_n(data_source,
index, data_resized);
1910 if (do_init_interpolate && spline->
tot_point > 2) {
1911 for (
int i = 0; i < 3; i++) {
1914 data_resized[pi_prev_abs].
point[i],
1915 data_resized[pi_next_abs].
point[i]);
1923 MEM_delete(masklay_shape.
data);
1924 masklay_shape.
data =
reinterpret_cast<float *
>(data_resized);
1928 "vert mismatch %d != %d (frame %d)",
1931 masklay_shape.
frame);
1943 if (tot == masklay_shape.
tot_vert - count) {
1948 masklay_shape.
data);
1950 std::copy_n(data_source,
index, data_resized);
1956 MEM_delete(masklay_shape.
data);
1957 masklay_shape.
data =
reinterpret_cast<float *
>(data_resized);
1961 "vert mismatch %d != %d (frame %d)",
1964 masklay_shape.
frame);
1980 mask_clipboard.
splines.clear_no_delete();
2002 for (
int i = 0; i < spline_new->
tot_point; i++) {
2025 for (
int i = 0; i < spline_new->
tot_point; i++) {
#define BKE_LIB_FOREACHID_PROCESS_ID(data_, id_, cb_flag_)
#define mul_m3_series(...)
#define STRNCPY_UTF8(dst, src)
#define BLO_read_struct_list(reader, struct_name, list)
#define BLO_read_struct(reader, struct_name, ptr_p)
#define BLT_I18NCONTEXT_ID_MASK
#define CLOG_ERROR(clg_ref,...)
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define BLI_assert_msg(a, msg)
#define MEM_realloc_uninitialized(vmemh, len)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
bool add(const Key &key, const Value &value)
const Value & lookup(const Key &key) const
constexpr const char * c_str() const
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
@ MASK_WHICH_HANDLE_RIGHT
@ MASK_WHICH_HANDLE_STICK
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
static MaskSplinePoint * mask_spline_points_copy(const MaskSplinePoint *points, int tot_point)
bool BKE_mask_clipboard_is_empty()
void BKE_mask_point_select_set_handle(MaskSplinePoint *point, eMaskWhichHandle which_handle, bool do_select)
void BKE_mask_spline_free(MaskSpline *spline)
static void mask_blend_write(BlendWriter *writer, ID *id, const void *id_address)
void BKE_tracking_marker_get_subframe_position(MovieTrackingTrack *track, float framenr, float pos[2])
MINLINE void copy_v3_v3(float r[3], const float a[3])
void BKE_mask_layer_shape_changed_remove(MaskLayer *masklay, int index, int count)
MINLINE void add_v2_v2v2(float r[2], const float a[2], const float b[2])
void BKE_mask_layer_evaluate_deform(MaskLayer *masklay, float ctime)
MaskLayerShape * BKE_mask_layer_shape_duplicate(MaskLayerShape *masklay_shape)
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
void BKE_mask_point_handle(const MaskSplinePoint *point, eMaskWhichHandle which_handle, float r_handle[2])
void BKE_mask_clipboard_copy_from_layer(MaskLayer *mask_layer)
MINLINE void mul_v2_fl(float r[2], float f)
BLI_INLINE void orthogonal_direction_get(const float vec[2], float result[2])
Mask * BKE_mask_new(Main *bmain, const char *name)
bool invert_m3_m3(float inverse[3][3], const float mat[3][3])
MINLINE void copy_v2_v2(float r[2], const float a[2])
void BKE_mask_get_handle_point_adjacent(MaskSpline *spline, MaskSplinePoint *point, MaskSplinePoint **r_point_prev, MaskSplinePoint **r_point_next)
MaskLayer * BKE_mask_layer_new(Mask *mask, const char *name)
void BKE_mask_layer_unique_name(Mask *mask, MaskLayer *masklay)
MaskLayerShape * BKE_mask_layer_shape_alloc(MaskLayer *masklay, int frame)
void BKE_mask_spline_free_list(ListBaseT< MaskSpline > *splines)
MaskSplinePoint * BKE_mask_spline_point_array_from_point(MaskSpline *spline, const MaskSplinePoint *point_ref)
MaskSpline * BKE_mask_spline_copy(const MaskSpline *spline)
std::string RNA_path_name_to_infix(const StringRefNull string)
static MaskSplinePoint * mask_spline_point_prev(MaskSpline *spline, MaskSplinePoint *points_array, MaskSplinePoint *point)
void * BLI_findstring(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
void BKE_mask_point_parent_matrix_get(MaskSplinePoint *point, float ctime, float parent_matrix[3][3])
MINLINE float normalize_v2(float n[2])
void BKE_mask_clipboard_free()
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
MINLINE int max_ii(int a, int b)
bool BKE_mask_spline_remove(MaskLayer *mask_layer, MaskSpline *spline)
void BKE_mask_layer_shape_to_mask(MaskLayer *masklay, MaskLayerShape *masklay_shape)
static void interp_weights_uv_v2_calc(float r_uv[2], const float pt[2], const float pt_a[2], const float pt_b[2])
int BKE_mask_get_duration(Mask *mask)
void BKE_image_get_aspect(Image *image, float *r_aspx, float *r_aspy)
void BKE_mask_calc_handle_adjacent_interp(MaskSpline *spline, MaskSplinePoint *point, float u)
void id_fake_user_set(ID *id)
void BKE_mask_evaluate(Mask *mask, float ctime, bool do_newframe)
void BKE_id_blend_write(BlendWriter *writer, ID *id)
static MaskClipboard & get_mask_clipboard()
static void mask_layer_shape_from_mask_point(const BezTriple *bezt, MaskLayerShapeElem *shape)
void BKE_nurb_handle_calc(BezTriple *bezt, BezTriple *prev, BezTriple *next, bool is_fcurve, char smoothing)
void BKE_movieclip_get_size_fl(MovieClip *clip, const MovieClipUser *user, float r_size[2])
static void mask_foreach_id(ID *id, LibraryForeachIDData *data)
static void interp_weights_uv_v2_apply(const float uv[2], float r_pt[2], const float pt_a[2], const float pt_b[2])
void BKE_animdata_fix_paths(ID &id, StringRef prefix, StringRef old_infix, StringRef new_infix, bool verify_paths, const DriverMap &driver_map)
void BKE_tracking_plane_marker_get_subframe_corners(MovieTrackingPlaneTrack *plane_track, float framenr, float corners[4][2])
int BKE_mask_layer_shape_find_frame_range(MaskLayer *masklay, float frame, MaskLayerShape **r_masklay_shape_a, MaskLayerShape **r_masklay_shape_b)
void BKE_mask_layer_evaluate(MaskLayer *masklay, float ctime, bool do_newframe)
void BKE_mask_layer_active_set(Mask *mask, MaskLayer *masklay)
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_uniquename(const ListBase *list, void *vlink, const char *defname, char delim, int name_offset, size_t name_maxncpy) ATTR_NONNULL(1
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
bool BKE_mask_layer_is_animated(MaskLayer &mask_layer)
static void mask_blend_read_data(BlendDataReader *reader, ID *id)
void BKE_movieclip_get_aspect(MovieClip *clip, float *aspx, float *aspy)
void BKE_mask_coord_to_movieclip(MovieClip *clip, MovieClipUser *user, float r_co[2], const float co[2])
static void mask_clipboard_clear()
static void mask_copy_data(Main *, std::optional< Library * >, ID *id_dst, const ID *id_src, const int)
void BKE_mask_coord_from_image(Image *image, ImageUser *iuser, float r_co[2], const float co[2])
MovieTrackingPlaneTrack * BKE_tracking_object_find_plane_track_with_name(MovieTrackingObject *tracking_object, const char *name)
void BKE_mask_layer_shape_from_mask(MaskLayer *masklay, MaskLayerShape *masklay_shape)
void BKE_mask_layer_shape_unlink(MaskLayer *masklay, MaskLayerShape *masklay_shape)
static void mask_layer_shape_to_mask_point(BezTriple *bezt, const MaskLayerShapeElem *shape)
BezTriple * BKE_mask_spline_point_next_bezt(MaskSpline *spline, MaskSplinePoint *points_array, MaskSplinePoint *point)
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
float BKE_mask_point_weight_scalar(MaskSpline *spline, MaskSplinePoint *point, float u)
BMesh const char void * data
@ MASK_PARENT_POINT_TRACK
MovieTrackingTrack * BKE_tracking_object_find_track_with_name(MovieTrackingObject *tracking_object, const char *name)
MaskSplinePointUW * BKE_mask_point_sort_uw(MaskSplinePoint *point, MaskSplinePointUW *uw)
void BKE_mask_coord_to_frame(float r_co[2], const float co[2], const float frame_size[2])
void BKE_mask_point_set_handle(MaskSplinePoint *point, eMaskWhichHandle which_handle, float loc[2], bool keep_direction, float orig_handle[2], float orig_vec[3][3])
MaskLayer * BKE_mask_layer_by_name(Mask *mask, const char *layer_name)
MaskSpline * BKE_mask_spline_add(MaskLayer *masklay)
void BKE_mask_coord_from_movieclip(MovieClip *clip, MovieClipUser *user, float r_co[2], const float co[2])
void BKE_mask_point_deselect_handles(MaskSplinePoint *p)
void BKE_mask_coord_from_frame(float r_co[2], const float co[2], const float frame_size[2])
void BKE_mask_spline_ensure_deform(MaskSpline *spline)
MaskLayer * BKE_mask_layer_active(Mask *mask)
void BKE_mask_calc_tangent_polyline(MaskSpline *spline, MaskSplinePoint *point, float t[2])
void BKE_mask_layer_calc_handles(MaskLayer *masklay)
void project_v2_v2v2(float out[2], const float p[2], const float v_proj[2])
void BKE_mask_point_select_set(MaskSplinePoint *point, bool do_select)
void BKE_mask_spline_move_to_layer(MaskSpline *spline, MaskLayer *src_mask_layer, MaskLayer *dst_mask_layer)
void BKE_mask_point_normal(MaskSpline *spline, MaskSplinePoint *point, float u, float n[2])
static MaskSplinePoint * mask_spline_point_next(MaskSpline *spline, MaskSplinePoint *points_array, MaskSplinePoint *point)
void BKE_mask_clipboard_paste_to_layer(Main *bmain, MaskLayer *mask_layer)
void BKE_tracking_homography_between_two_quads(float reference_corners[4][2], float corners[4][2], float H[3][3])
bool BKE_mask_is_animated(Mask &mask)
void BKE_mask_layer_free(MaskLayer *masklay)
static float mask_point_interp_weight(BezTriple *bezt, BezTriple *bezt_next, const float u)
void BKE_mask_layer_copy_list(ListBaseT< MaskLayer > *masklayers_new, const ListBaseT< MaskLayer > *masklayers)
void dist_ensure_v2_v2fl(float v1[2], const float v2[2], float dist)
static void mask_runtime_reset(Mask *mask)
MINLINE float dot_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
void BKE_mask_layer_evaluate_animation(MaskLayer *masklay, float ctime)
int BKE_mask_layer_shape_totvert(MaskLayer *masklay)
bool BLO_read_array(BlendDataReader *reader, T **ptr_p, const SizeT array_size, const int elems=1)
void void BLI_listbase_sort(ListBase *listbase, int(*cmp)(const void *, const void *)) ATTR_NONNULL(1
void BKE_movieclip_user_set_frame(MovieClipUser *user, int framenr)
void BLO_read_array_and_validate_size(BlendDataReader *reader, T **ptr_p, SizeT *array_size, const int elems=1)
static void mask_calc_point_handle(MaskSplinePoint *point, MaskSplinePoint *point_prev, MaskSplinePoint *point_next)
float BKE_movieclip_remap_scene_to_clip_frame(const MovieClip *clip, float framenr)
float BKE_mask_point_weight(MaskSpline *spline, MaskSplinePoint *point, float u)
MINLINE float len_squared_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
static int mask_layer_shape_sort_cb(const void *masklay_shape_a_ptr, const void *masklay_shape_b_ptr)
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
void BKE_mask_calc_handle_point(MaskSpline *spline, MaskSplinePoint *point)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BKE_mask_layer_shape_spline_to_index(MaskLayer *masklay, MaskSpline *spline)
void unit_m3(float m[3][3])
MaskLayer * BKE_mask_layer_copy(const MaskLayer *masklay)
void BKE_mask_layer_free_list(ListBaseT< MaskLayer > *masklayers)
void BKE_mask_parent_init(MaskParent *parent)
ATTR_WARN_UNUSED_RESULT const BMVert * v2
MINLINE float len_v2v2(const float v1[2], const float v2[2]) ATTR_WARN_UNUSED_RESULT
MaskLayerShape * BKE_mask_layer_shape_find_frame(MaskLayer *masklay, int frame)
void BKE_mask_point_free(MaskSplinePoint *point)
MaskLayerShape * BKE_mask_layer_shape_verify_frame(MaskLayer *masklay, int frame)
ID_Type GS(const char *name)
MINLINE float len_squared_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
float closest_to_line_v2(float r_close[2], const float p[2], const float l1[2], const float l2[2])
void interp_v2_v2v2v2v2_cubic(float p[2], const float v1[2], const float v2[2], const float v3[2], const float v4[2], float u)
@ MASK_LAYERFLAG_FILL_DISCRETE
@ MASK_LAYERFLAG_FILL_OVERLAP
float angle_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE float line_point_side_v2(const float l1[2], const float l2[2], const float pt[2]) ATTR_WARN_UNUSED_RESULT
void DEG_relations_tag_update(Main *bmain)
void BKE_mask_layer_free_shapes(MaskLayer *masklay)
Free all animation keys for a mask layer.
bool BLI_remlink_safe(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
MovieTrackingObject * BKE_tracking_object_get_named(MovieTracking *tracking, const char *name)
void BKE_mask_coord_to_image(Image *image, ImageUser *iuser, float r_co[2], const float co[2])
static void mask_free_data(ID *id)
MINLINE float len_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
BLI_INLINE void interp_v2_v2v2_flfl(float target[2], const float a[2], const float b[2], const float t, const float s)
void BKE_mask_point_add_uw(MaskSplinePoint *point, float u, float w)
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
@ MASK_SPLINE_INTERP_EASE
void BKE_image_get_size_fl(Image *image, ImageUser *iuser, float r_size[2])
void BKE_mask_layer_shape_free(MaskLayerShape *masklay_shape)
static Mask * mask_alloc(Main *bmain, const char *name)
MaskSplinePoint * BKE_mask_spline_point_array(MaskSpline *spline)
void BKE_mask_layer_shape_to_mask_interp(MaskLayer *masklay, MaskLayerShape *masklay_shape_a, MaskLayerShape *masklay_shape_b, float fac)
void BKE_mask_point_direction_switch(MaskSplinePoint *point)
void BKE_mask_spline_direction_switch(MaskLayer *masklay, MaskSpline *spline)
eMaskhandleMode BKE_mask_point_handles_mode_get(const MaskSplinePoint *point)
MINLINE void zero_v2(float r[2])
void BKE_mask_layer_remove(Mask *mask, MaskLayer *masklay)
void * BKE_libblock_alloc(Main *bmain, short type, const char *name, int flag) ATTR_WARN_UNUSED_RESULT
void BKE_mask_point_segment_co(MaskSpline *spline, MaskSplinePoint *point, float u, float co[2])
void BKE_mask_layer_shape_changed_add(MaskLayer *masklay, int index, bool do_init, bool do_init_interpolate)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
@ MASK_HANDLE_MODE_INDIVIDUAL_HANDLES
void BKE_mask_point_select_handles(MaskSplinePoint *p)
bool BKE_mask_layer_shape_spline_from_index(MaskLayer *masklay, int index, MaskSpline **r_masklay_shape, int *r_index)
float BKE_mask_spline_project_co(MaskSpline *spline, MaskSplinePoint *point, float start_u, const float co[2], eMaskSign sign)
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
void BKE_mask_layer_shape_sort(MaskLayer *masklay)
void BKE_mask_layer_rename(Main &bmain, Mask *mask, MaskLayer *masklay, const char *oldname, const char *newname)
MINLINE void madd_v2_v2v2fl(float r[2], const float a[2], const float b[2], float f)
ListBaseT< ID > * which_libbase(Main *bmain, short type)
void BKE_mask_calc_handle_point_auto(MaskSpline *spline, MaskSplinePoint *point, bool do_recalc_length)
Resets auto handles even for non-auto bezier points.
@ IDTYPE_FLAGS_APPEND_IS_REUSABLE
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
void write_float_array(int64_t num, const float *data)
void write_id_struct(const void *id_address, const T *id, BlendStructWriterTypedFn< T > fn=nullptr)
void write_struct(const T *data, BlendStructWriterTypedFn< T > fn=nullptr)
void write_struct_array(const int64_t array_size, const T *data, BlendStructWriterTypedFn< T > fn=nullptr)
ListBaseT< MaskSpline > splines
Map< ID *, std::string > id_hash
struct MaskLayerShape * prev
struct MaskLayerShape * next
MaskLayerBlendFlag blend_flag
struct MaskSplinePoint * act_point
struct MaskSpline * act_spline
ListBaseT< MaskLayerShape > splines_shapes
MaskLayerVisibility visibility_flag
ListBaseT< MaskSpline > splines
MaskLayerFillSolverType fill_solver
float parent_corners_orig[4][2]
MaskSplineInterp weight_interp
MaskSplineRuntime * runtime
ListBaseT< struct MaskLayer > masklayers
struct MovieTracking tracking
Array< MaskSplinePoint > points_deform