41 const float point_co[2],
45 const bool reference_adjacent)
55 bezt = &new_point->
bezt;
59 if (reference_point) {
65 int delta = new_point == spline->
points ? 1 : -1;
66 for (
int i = 0; i < spline->
tot_point - 1; i++) {
95 reference_parent_point = reference_point;
97 else if (reference_adjacent) {
101 const int index = (int)(new_point - spline->
points);
107 prev_point = (index != 0) ? &spline->
points[index - 1] :
NULL;
111 if (prev_point && next_point) {
118 close_point = prev_point ? prev_point : next_point;
122 char handle_type = 0;
124 handle_type = prev_point->
bezt.
h2;
127 handle_type =
MAX2(next_point->
bezt.
h2, handle_type);
129 bezt->
h1 = bezt->
h2 = handle_type;
132 reference_parent_point = close_point;
142 if (reference_parent_point) {
146 float parent_matrix[3][3];
192 for (
int i = 0; i < cur_spline->
tot_point; i++) {
196 if (!
ELEM(*spline,
NULL, cur_spline)) {
205 *spline = cur_spline;
211 cur_spline = cur_spline->
next;
226 "add mask vert points");
234 spline->
points = new_point_array;
306 float tangent_point[2];
308 bool do_cyclic_correct =
false;
327 if (
dot_v2v2(tangent_point, tangent_co) < 0.0f) {
352 do_cyclic_correct =
true;
365 if (do_cyclic_correct) {
368 *ref_point = *new_point;
369 memset(new_point, 0,
sizeof(*new_point));
405 mask->masklay_act =
mask->masklay_tot - 1;
413 new_point = spline->
points;
436 const float point_normalized[2],
437 float point_pixel[2])
442 float scalex, scaley;
445 point_pixel[0] = point_normalized[0] * scalex;
446 point_pixel[1] = point_normalized[1] * scaley;
456 const float tolerance_in_pixels_squared = 4 * 4;
468 float point_pixel[2];
472 if (dist_squared > tolerance_in_pixels_squared) {
494 const bool is_first_point_active = (active_point == first_point);
495 const bool is_last_point_active = (active_point == last_point);
496 if (is_last_point_active) {
499 if (is_first_point_active) {
538 return cyclic_result;
599 "Location of vertex in normalized space",
642 if (weight_scalar != 0.0f) {
643 w =
w / weight_scalar;
675 ot->
name =
"Add Feather Vertex";
677 ot->
idname =
"MASK_OT_add_feather_vertex";
695 "Location of vertex in normalized space",
707 const int num_points,
708 const char handle_type,
710 const float location[2])
713 for (
int i = 0; i < num_points; i++) {
714 copy_v2_v2(bezier_points[i].vec[1], points[i]);
715 mul_v2_fl(bezier_points[i].vec[1], scale);
716 add_v2_v2(bezier_points[i].vec[1], location);
718 bezier_points[i].
h1 = handle_type;
719 bezier_points[i].
h2 = handle_type;
722 for (
int i = 0; i < num_points; i++) {
724 &bezier_points[(i - 1 + num_points) % num_points],
725 &bezier_points[(i + 1) % num_points],
730 return bezier_points;
748 frame_size[0] =
width;
752 location[0] /=
width;
757 location[0] -= 0.5f * scale;
758 location[1] -= 0.5f * scale;
760 bool added_mask =
false;
777 for (
int i = 0; i < num_points; i++) {
783 new_point->
bezt = bezier_points[i];
826 ot->
srna,
"size", 100, -FLT_MAX, FLT_MAX,
"Size",
"Size of new circle", -FLT_MAX, FLT_MAX);
834 "Location of new circle",
847 const float points[4][2] = {{0.0f, 0.5f}, {0.5f, 1.0f}, {1.0f, 0.5f}, {0.5f, 0.0f}};
848 int num_points =
sizeof(points) / (
sizeof(
float[2]));
860 ot->
idname =
"MASK_OT_primitive_circle_add";
882 const float points[4][2] = {{0.0f, 0.0f}, {0.0f, 1.0f}, {1.0f, 1.0f}, {1.0f, 0.0f}};
883 int num_points =
sizeof(points) / (
sizeof(
float[2]));
895 ot->
idname =
"MASK_OT_primitive_square_add";
typedef float(TangentPoint)[2]
struct ScrArea * CTX_wm_area(const bContext *C)
struct Scene * CTX_data_scene(const bContext *C)
struct Mask * CTX_data_edit_mask(const bContext *C)
struct ARegion * CTX_wm_region(const bContext *C)
void BKE_nurb_handle_calc(struct BezTriple *bezt, struct BezTriple *prev, struct BezTriple *next, bool is_fcurve, char smoothing)
#define MASKPOINT_ISSEL_ANY(p)
void BKE_mask_layer_shape_changed_add(struct MaskLayer *masklay, int index, bool do_init, bool do_init_interpolate)
void BKE_mask_calc_tangent_polyline(struct MaskSpline *spline, struct MaskSplinePoint *point, float t[2])
void BKE_mask_point_select_set(struct MaskSplinePoint *point, bool do_select)
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.
struct MaskLayer * BKE_mask_layer_new(struct Mask *mask, const char *name)
#define MASKPOINT_SEL_ALL(p)
struct MaskLayer * BKE_mask_layer_active(struct Mask *mask)
float BKE_mask_point_weight(struct MaskSpline *spline, struct MaskSplinePoint *point, float u)
float BKE_mask_point_weight_scalar(struct MaskSpline *spline, struct MaskSplinePoint *point, float u)
void BKE_mask_calc_handle_adjacent_interp(struct MaskSpline *spline, struct MaskSplinePoint *point, float u)
void BKE_mask_point_parent_matrix_get(struct MaskSplinePoint *point, float ctime, float parent_matrix[3][3])
void BKE_mask_point_add_uw(struct MaskSplinePoint *point, float u, float w)
int BKE_mask_layer_shape_spline_to_index(struct MaskLayer *masklay, struct MaskSpline *spline)
void BKE_mask_parent_init(struct MaskParent *parent)
#define MASKPOINT_DESEL_ALL(p)
void BKE_mask_coord_from_frame(float r_co[2], const float co[2], const float frame_size[2])
struct MaskSpline * BKE_mask_spline_add(struct MaskLayer *masklay)
MINLINE int max_ii(int a, int b)
MINLINE int mod_i(int i, int n)
void mul_m3_v2(const float m[3][3], float r[2])
bool invert_m3(float R[3][3])
MINLINE float len_squared_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void mul_v2_fl(float r[2], float f)
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void add_v2_v2(float r[2], const float a[2])
void print_v2(const char *str, const float v[2])
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE float dot_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
void DEG_id_tag_update(struct ID *id, int flag)
bool ED_maskedit_mask_poll(struct bContext *C)
void ED_mask_mouse_pos(struct ScrArea *area, struct ARegion *region, const int mval[2], float co[2])
void ED_mask_pixelspace_factor(struct ScrArea *area, struct ARegion *region, float *scalex, float *scaley)
bool ED_maskedit_visible_splines_poll(struct bContext *C)
void ED_mask_cursor_location_get(struct ScrArea *area, float cursor[2])
void ED_mask_get_size(struct ScrArea *area, int *width, int *height)
_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 GLsizei width
Read Guarded memory(de)allocation.
#define MEM_recallocN(vmemh, len)
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
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
ccl_gpu_kernel_postfix ccl_global float int int int int float threshold
void(* MEM_freeN)(void *vmemh)
void *(* MEM_calloc_arrayN)(size_t len, size_t size, const char *str)
void *(* MEM_callocN)(size_t len, const char *str)
void MASK_OT_add_feather_vertex(wmOperatorType *ot)
static int create_primitive_from_points(bContext *C, wmOperator *op, const float(*points)[2], int num_points, char handle_type)
static int add_vertex_exec(bContext *C, wmOperator *op)
static int primitive_circle_add_exec(bContext *C, wmOperator *op)
static BezTriple * points_to_bezier(const float(*points)[2], const int num_points, const char handle_type, const float scale, const float location[2])
static int primitive_square_add_exec(bContext *C, wmOperator *op)
static bool add_vertex_extrude(const bContext *C, Mask *mask, MaskLayer *mask_layer, const float co[2])
static void setup_vertex_point(Mask *mask, MaskSpline *spline, MaskSplinePoint *new_point, const float point_co[2], const float u, const float ctime, const MaskSplinePoint *reference_point, const bool reference_adjacent)
void MASK_OT_primitive_square_add(wmOperatorType *ot)
static int add_feather_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static int add_feather_vertex_exec(bContext *C, wmOperator *op)
void MASK_OT_primitive_circle_add(wmOperatorType *ot)
static void define_primitive_add_properties(wmOperatorType *ot)
static int add_vertex_handle_cyclic(bContext *C, Mask *mask, MaskSpline *spline, MaskSplinePoint *active_point, float co[2])
static void mask_point_make_pixel_space(bContext *C, const float point_normalized[2], float point_pixel[2])
static int primitive_add_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
static bool add_vertex_new(const bContext *C, Mask *mask, MaskLayer *mask_layer, const float co[2])
static int add_vertex_handle_cyclic_at_point(bContext *C, Mask *mask, MaskSpline *spline, MaskSplinePoint *active_point, MaskSplinePoint *other_point, float co[2])
static bool add_vertex_subdivide(const bContext *C, Mask *mask, const float co[2])
void MASK_OT_add_vertex(wmOperatorType *ot)
static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void finSelectedSplinePoint(MaskLayer *mask_layer, MaskSpline **spline, MaskSplinePoint **point, bool check_active)
static void mask_spline_add_point_at_index(MaskSpline *spline, int point_index)
void ED_mask_view_lock_state_restore_no_jump(const bContext *C, const MaskViewLockState *state)
void ED_mask_view_lock_state_store(const bContext *C, MaskViewLockState *state)
void ED_mask_select_flush_all(struct Mask *mask)
bool ED_mask_find_nearest_diff_point(const struct bContext *C, struct Mask *mask, const float normal_co[2], int threshold, bool feather, float tangent[2], bool use_deform, bool use_project, struct MaskLayer **r_mask_layer, struct MaskSpline **r_spline, struct MaskSplinePoint **r_point, float *r_u, float *r_score)
struct Mask * ED_mask_new(struct bContext *C, const char *name)
void ED_mask_select_toggle_all(struct Mask *mask, int action)
struct MaskLayer * ED_mask_layer_ensure(struct bContext *C, bool *r_added_mask)
struct MaskSplinePoint * ED_mask_point_find_nearest(const struct bContext *C, struct Mask *mask, const float normal_co[2], float threshold, struct MaskLayer **r_mask_layer, struct MaskSpline **r_spline, eMaskWhichHandle *r_which_handle, float *r_score)
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])
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
float RNA_float_get(PointerRNA *ptr, const char *name)
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
PropertyRNA * RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
struct MaskSplinePoint * act_point
struct MaskSpline * act_spline
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
struct wmOperatorType * type
void WM_event_add_notifier(const bContext *C, uint type, void *reference)