35 struct Mask *mask_orig,
36 const float normal_co[2],
40 const bool use_deform,
41 const bool use_project,
56 float dist_best_sq = FLT_MAX, co[2];
67 co[0] = normal_co[0] * scalex;
68 co[1] = normal_co[1] * scaley;
72 mask_layer_orig !=
NULL;
73 mask_layer_orig = mask_layer_orig->next, mask_layer_eval = mask_layer_eval->next) {
78 for (
MaskSpline *spline_orig = mask_layer_orig->splines.first,
79 *spline_eval = mask_layer_eval->splines.first;
81 spline_orig = spline_orig->next, spline_eval = spline_eval->next) {
85 for (i = 0, cur_point_eval = use_deform ? spline_eval->points_deform : spline_eval->points;
86 i < spline_eval->tot_point;
87 i++, cur_point_eval++) {
90 spline_eval, cur_point_eval,
width,
height, &tot_diff_point);
94 uint tot_feather_point;
95 float *feather_points =
NULL, *points;
99 spline_eval, cur_point_eval,
width,
height, &tot_feather_point);
101 points = feather_points;
102 tot_point = tot_feather_point;
105 points = diff_points;
106 tot_point = tot_diff_point;
109 for (j = 0; j < tot_point - 1; j++) {
110 float dist_sq,
a[2],
b[2];
112 a[0] = points[2 * j] * scalex;
113 a[1] = points[2 * j + 1] * scaley;
115 b[0] = points[2 * j + 2] * scalex;
116 b[1] = points[2 * j + 3] * scaley;
120 if (dist_sq < dist_best_sq) {
122 sub_v2_v2v2(tangent, &diff_points[2 * j + 2], &diff_points[2 * j]);
125 point_mask_layer = mask_layer_orig;
126 point_spline = spline_orig;
128 &spline_orig->points[(cur_point_eval - spline_eval->points_deform)] :
129 &spline_orig->points[(cur_point_eval - spline_eval->points)];
130 dist_best_sq = dist_sq;
131 u = (
float)j / tot_point;
135 if (feather_points !=
NULL) {
144 if (
point && dist_best_sq < threshold_sq) {
146 *r_mask_layer = point_mask_layer;
150 *r_spline = point_spline;
167 *r_score = dist_best_sq;
174 *r_mask_layer =
NULL;
201 const float normal_co[2],
216 float len_sq = FLT_MAX, scalex, scaley;
226 co[0] = normal_co[0] * scalex;
227 co[1] = normal_co[1] * scaley;
231 mask_layer_orig !=
NULL;
232 mask_layer_orig = mask_layer_orig->next, mask_layer_eval = mask_layer_eval->next) {
238 for (
MaskSpline *spline_orig = mask_layer_orig->splines.first,
239 *spline_eval = mask_layer_eval->splines.first;
241 spline_orig = spline_orig->next, spline_eval = spline_eval->next) {
244 for (
int i = 0; i < spline_orig->tot_point; i++) {
249 float cur_len_sq, vec[2];
251 vec[0] = bezt->
vec[1][0] * scalex;
252 vec[1] = bezt->
vec[1][1] * scaley;
256 if (cur_len_sq < len_sq) {
257 point_spline = spline_orig;
258 point_mask_layer = mask_layer_orig;
259 point = cur_point_orig;
272 float handle_left[2], handle_right[2];
273 float len_left_sq, len_right_sq;
282 if (len_left_sq <= len_right_sq) {
285 cur_len_sq = len_left_sq;
290 cur_len_sq = len_right_sq;
294 if (len_right_sq <= len_left_sq) {
297 cur_len_sq = len_right_sq;
302 cur_len_sq = len_left_sq;
308 point_mask_layer = mask_layer_orig;
309 point_spline = spline_orig;
310 point = cur_point_orig;
312 which_handle = cur_which_handle;
318 if (len_sq < threshold_sq) {
320 *r_mask_layer = point_mask_layer;
324 *r_spline = point_spline;
327 if (r_which_handle) {
328 *r_which_handle = which_handle;
332 *r_score =
sqrtf(len_sq);
339 *r_mask_layer =
NULL;
346 if (r_which_handle) {
355 const float normal_co[2],
371 float len = FLT_MAX, co[2];
372 float scalex, scaley;
381 co[0] = normal_co[0] * scalex;
382 co[1] = normal_co[1] * scaley;
386 mask_layer_orig !=
NULL;
387 mask_layer_orig = mask_layer_orig->next, mask_layer_eval = mask_layer_eval->next) {
389 for (
MaskSpline *spline_orig = mask_layer_orig->splines.first,
390 *spline_eval = mask_layer_eval->splines.first;
392 spline_orig = spline_orig->next, spline_eval = spline_eval->next) {
395 int i, tot_feather_point;
396 float(*feather_points)[2], (*fp)[2];
404 for (i = 0; i < spline_orig->tot_point; i++) {
409 for (j = 0; j <= cur_point_eval->
tot_uw; j++) {
410 float cur_len_sq, vec[2];
412 vec[0] = (*fp)[0] * scalex;
413 vec[1] = (*fp)[1] * scaley;
422 uw = &cur_point_orig->
uw[j - 1];
425 point_mask_layer = mask_layer_orig;
426 point_spline = spline_orig;
427 point = cur_point_orig;
439 if (
len < threshold_sq) {
441 *r_mask_layer = point_mask_layer;
445 *r_spline = point_spline;
464 *r_mask_layer =
NULL;
481 switch (
area->spacetype) {
516 switch (
area->spacetype) {
554 switch (
area->spacetype) {
592 bool handles_as_control_point,
595 if (handles_as_control_point) {
605 bool handles_as_control_point)
623 mask_layer = mask_layer->next) {
627 for (
MaskSpline *spline = mask_layer->splines.first; spline !=
NULL; spline = spline->next) {
629 for (
int i = 0; i < spline->tot_point; i++) {
676 if (
area &&
area->spacedata.first) {
677 switch (
area->spacetype) {
710 if (
area &&
area->spacedata.first) {
711 switch (
area->spacetype) {
718 *zoomx = *zoomy = 1.0f;
729 *zoomx = *zoomy = 1.0f;
735 *zoomx = *zoomy = 1.0f;
741 if (
area &&
area->spacedata.first) {
742 switch (
area->spacetype) {
749 *aspx = *aspy = 1.0f;
760 *aspx = *aspy = 1.0f;
766 *aspx = *aspy = 1.0f;
772 if (
area &&
area->spacedata.first) {
773 switch (
area->spacetype) {
786 *scalex = *scaley = 1.0f;
803 *scalex = *scaley = 1.0f;
809 *scalex = *scaley = 1.0f;
816 switch (
area->spacetype) {
typedef float(TangentPoint)[2]
struct ScrArea * CTX_wm_area(const bContext *C)
struct Mask * CTX_data_edit_mask(const bContext *C)
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
struct ARegion * CTX_wm_region(const bContext *C)
struct Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
#define MASKPOINT_ISSEL_ANY(p)
float * BKE_mask_point_segment_feather_diff(struct MaskSpline *spline, struct MaskSplinePoint *point, int width, int height, unsigned int *tot_feather_point)
void BKE_mask_coord_from_image(struct Image *image, struct ImageUser *iuser, float r_co[2], const float co[2])
@ MASK_WHICH_HANDLE_RIGHT
@ MASK_WHICH_HANDLE_STICK
void BKE_mask_coord_to_image(struct Image *image, struct ImageUser *iuser, float r_co[2], const float co[2])
void BKE_mask_coord_to_movieclip(struct MovieClip *clip, struct MovieClipUser *user, float r_co[2], const float co[2])
void BKE_mask_point_handle(const struct MaskSplinePoint *point, eMaskWhichHandle which_handle, float r_handle[2])
float(* BKE_mask_spline_feather_points(struct MaskSpline *spline, int *tot_feather_point))[2]
eMaskhandleMode BKE_mask_point_handles_mode_get(const struct MaskSplinePoint *point)
struct MaskSplinePoint * BKE_mask_spline_point_array(struct MaskSpline *spline)
void BKE_mask_coord_from_movieclip(struct MovieClip *clip, struct MovieClipUser *user, float r_co[2], const float co[2])
float BKE_mask_spline_project_co(struct MaskSpline *spline, struct MaskSplinePoint *point, float start_u, const float co[2], eMaskSign sign)
float * BKE_mask_point_segment_diff(struct MaskSpline *spline, struct MaskSplinePoint *point, int width, int height, unsigned int *r_tot_diff_point)
float dist_squared_to_line_segment_v2(const float p[2], const float l1[2], const float l2[2])
MINLINE float len_squared_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void copy_v2_v2(float r[2], const float a[2])
void minmax_v2v2_v2(float min[2], float max[2], const float vec[2])
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE void zero_v2(float r[2])
#define INIT_MINMAX2(min, max)
struct Depsgraph Depsgraph
struct ID * DEG_get_evaluated_id(const struct Depsgraph *depsgraph, struct ID *id)
void ED_clip_point_stable_pos__reverse(struct SpaceClip *sc, struct ARegion *region, const float co[2], float r_co[2])
the reverse of ED_clip_point_stable_pos(), gets the marker region coords. better name here?...
void ED_space_clip_get_aspect(struct SpaceClip *sc, float *aspx, float *aspy)
void ED_space_clip_get_zoom(struct SpaceClip *sc, struct ARegion *region, float *zoomx, float *zoomy)
void ED_space_clip_get_size(struct SpaceClip *sc, int *width, int *height)
void ED_clip_mouse_pos(struct SpaceClip *sc, struct ARegion *region, const int mval[2], float co[2])
void ED_clip_point_stable_pos(struct SpaceClip *sc, struct ARegion *region, float x, float y, float *xr, float *yr)
void ED_image_point_pos(struct SpaceImage *sima, const struct ARegion *region, float x, float y, float *r_x, float *r_y)
void ED_space_image_get_zoom(struct SpaceImage *sima, const struct ARegion *region, float *r_zoomx, float *r_zoomy)
void ED_image_point_pos__reverse(struct SpaceImage *sima, const struct ARegion *region, const float co[2], float r_co[2])
void ED_image_mouse_pos(struct SpaceImage *sima, const struct ARegion *region, const int mval[2], float co[2])
void ED_space_image_get_size(struct SpaceImage *sima, int *r_width, int *r_height)
void ED_space_image_get_aspect(struct SpaceImage *sima, float *r_aspx, float *r_aspy)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
Read Guarded memory(de)allocation.
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
void UI_view2d_scale_get(const struct View2D *v2d, float *r_x, float *r_y)
void UI_view2d_region_to_view(const struct View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
const Depsgraph * depsgraph
ccl_gpu_kernel_postfix ccl_global float int int int int float threshold
void(* MEM_freeN)(void *vmemh)
MaskSplinePoint * ED_mask_point_find_nearest(const bContext *C, Mask *mask_orig, const float normal_co[2], const float threshold, MaskLayer **r_mask_layer, MaskSpline **r_spline, eMaskWhichHandle *r_which_handle, float *r_score)
bool ED_mask_feather_find_nearest(const bContext *C, Mask *mask_orig, const float normal_co[2], const float threshold, MaskLayer **r_mask_layer, MaskSpline **r_spline, MaskSplinePoint **r_point, MaskSplinePointUW **r_uw, float *r_score)
void ED_mask_zoom(ScrArea *area, ARegion *region, float *zoomx, float *zoomy)
void ED_mask_get_aspect(ScrArea *area, ARegion *UNUSED(region), float *aspx, float *aspy)
void ED_mask_point_pos(ScrArea *area, ARegion *region, float x, float y, float *xr, float *yr)
static void mask_point_scaled_handle(const MaskSplinePoint *point, const eMaskWhichHandle which_handle, const float scalex, const float scaley, float handle[2])
void ED_mask_cursor_location_get(ScrArea *area, float cursor[2])
bool ED_mask_find_nearest_diff_point(const bContext *C, struct Mask *mask_orig, const float normal_co[2], int threshold, bool feather, float tangent[2], const bool use_deform, const bool use_project, MaskLayer **r_mask_layer, MaskSpline **r_spline, MaskSplinePoint **r_point, float *r_u, float *r_score)
bool ED_mask_selected_minmax(const bContext *C, float min[2], float max[2], bool handles_as_control_point)
static void handle_position_for_minmax(const MaskSplinePoint *point, eMaskWhichHandle which_handle, bool handles_as_control_point, float r_handle[2])
void ED_mask_get_size(ScrArea *area, int *width, int *height)
void ED_mask_mouse_pos(ScrArea *area, ARegion *region, const int mval[2], float co[2])
void ED_mask_point_pos__reverse(ScrArea *area, ARegion *region, float x, float y, float *xr, float *yr)
void ED_mask_pixelspace_factor(ScrArea *area, ARegion *region, float *scalex, float *scaley)
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
static void area(int d1, int d2, int e1, int e2, float weights[2])
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
struct MovieClipUser user