37 #define FOREACH_SELECTED_BEZT_BEGIN(bezt, nurbs) \
38 LISTBASE_FOREACH (Nurb *, nu, nurbs) { \
39 if (nu->type == CU_BEZIER) { \
40 for (int i = 0; i < nu->pntsu; i++) { \
41 BezTriple *bezt = nu->bezt + i; \
42 if (BEZT_ISSEL_ANY(bezt) && !bezt->hide) {
44 #define FOREACH_SELECTED_BEZT_END \
48 BKE_nurb_handles_calc(nu); \
53 #define SEL_DIST_FACTOR 0.2f
124 {
HD_AUTO,
"AUTO", 0,
"Auto",
""},
125 {
HD_VECT,
"VECTOR", 0,
"Vector",
""},
136 {
OFF,
"OFF", 0,
"None",
""},
137 {
ON_PRESS,
"ON_PRESS", 0,
"On Press",
"Move handles after closing the spline"},
138 {
ON_CLICK,
"ON_CLICK", 0,
"On Click",
"Spline closes on release if not dragged"},
146 const float eps = 1e-6f;
165 float location_test[3];
185 const float pos_2d[2],
186 const float depth[3],
196 const float depth[3],
199 const float pos_2d_fl[2] = {
UNPACK2(pos_2d)};
204 const float pos_3d[3],
257 const float disp_2d[2],
259 const bool link_handles,
260 const bool lock_angle)
269 float pos[2], dst[2];
284 const int other_handle = bezt_idx == 2 ? 0 : 2;
313 const bool bezt_only,
320 for (
int i = 0; i < nu->pntsu; i++) {
347 else if (!bezt_only) {
348 for (
int i = 0; i < nu->pntsu; i++) {
349 if (!nu->bp->hide && (nu->bp + i)->f1 &
SELECT) {
370 const bool bezt_only)
372 const float mval[2] = {
UNPACK2(event->
xy)};
383 float mval_3d[3], center_mid[3];
391 for (
int i = 0; i < nu->pntsu; i++) {
404 vc, bezt, 0, disp_2d,
distance, link_handles, lock_angle);
408 vc, bezt, 2, disp_2d,
distance, link_handles, lock_angle);
414 else if (!bezt_only) {
415 for (
int i = 0; i < nu->pntsu; i++) {
418 float pos[2], dst[2];
438 if (cu->
actnu == nu_index) {
460 memmove(nu->
bp + index, nu->
bp + index + 1, (nu->
pntsu - index) *
sizeof(
BPoint));
470 const float point[2],
480 float min_dist_bezt = FLT_MAX;
481 int closest_handle = 0;
485 float min_dist_bp = FLT_MAX;
491 for (
int i = 0; i < nu->pntsu; i++) {
494 int start = 0, end = 3;
504 for (
int j = start; j < end; j++) {
507 if (dist < min_dist_bezt) {
508 min_dist_bezt = dist;
510 closest_bezt_nu = nu;
518 for (
int i = 0; i < nu->pntsu; i++) {
525 if (dist < min_dist_bp) {
537 if (min_dist_bezt < threshold_dist || min_dist_bp < threshold_dist) {
538 if (min_dist_bp < min_dist_bezt) {
540 *r_nu = closest_bp_nu;
543 *r_bezt = closest_bezt;
544 *r_bezt_idx = closest_handle;
545 *r_nu = closest_bezt_nu;
557 const float parameter,
560 float tmp1[3], tmp2[3], tmp3[3];
573 float handle_prev[3],
574 float new_left_handle[3],
575 float new_right_handle[3],
576 float handle_next[3],
577 const float point_next[3],
578 const float parameter)
580 float center_point[3];
581 interp_v3_v3v3(center_point, handle_prev, handle_next, parameter);
584 interp_v3_v3v3(new_left_handle, handle_prev, center_point, parameter);
585 interp_v3_v3v3(new_right_handle, center_point, handle_next, parameter);
602 const int index =
data->bezt_index + 1;
605 BezTriple *new_bezt = new_bezt_array + index;
611 if (index < nu->pntsu) {
621 next_bezt = new_bezt_array;
624 next_bezt = new_bezt + 1;
635 (new_bezt - 1)->vec[2],
643 nu->
bezt = new_bezt_array;
657 const int index =
data->bp_index + 1;
660 BPoint *new_bp = new_bp_array + index;
666 if (index < nu->pntsu) {
676 next_bp = new_bp_array;
679 next_bp = new_bp + 1;
688 nu->
bp = new_bp_array;
706 const float point1[2],
707 const float point2[2],
709 const int resolu_idx,
714 float edge[2], vec1[2], vec2[2];
718 const float len_vec1 =
len_v2(vec1);
719 const float len_vec2 =
len_v2(vec2);
720 const float dot1 =
dot_v2v2(edge, vec1);
721 const float dot2 =
dot_v2v2(edge, vec2);
726 if ((dot1 > 0) == (dot2 > 0)) {
728 if (*r_min_dist > perp_dist) {
729 *r_min_dist = perp_dist;
730 *r_min_i = point_idx;
735 if (*r_min_dist > len_vec2) {
736 *r_min_dist = len_vec2;
737 *r_min_i = point_idx;
738 *r_param = resolu_idx;
749 float min_dist = cd->
min_dist, param = 0.0f;
754 for (
int i = 0; i < end; i++) {
755 float *points =
MEM_mallocN(
sizeof(
float[3]) * (resolu + 1), __func__);
761 for (
int j = 0; j < 3; j++) {
771 float point1[2], point2[2];
775 if (min_dist > len_vec1) {
781 for (
int j = 0; j < resolu; j++) {
797 float point1[2], point2[2];
799 for (
int i = 0; i < end; i++) {
817 const float point[2],
818 const float sel_dist,
837 .mval[0] =
event->mval[0],
838 .mval[1] =
event->mval[1]};
851 if (near_spline && !cd.
nurb->
hide) {
900 if (*r_bezt || *r_bp) {
913 a = nu->pntsu * nu->pntsv;
916 if (*r_bezt || *r_bp) {
933 const float disp_3d[3])
938 BezTriple *last_bezt = nu1->bezt + nu1->pntsu - 1;
940 const bool last_sel =
BEZT_ISSEL_ANY(last_bezt) && nu1->pntsu > 1;
954 nu1->bezt = new_bezt;
965 nu1->bezt = new_bezt;
968 cu->
actnu = nu_index;
979 nu1->bezt = new_bezt;
981 cu->
actnu = nu_index;
986 BPoint *last_bp = nu1->bp + nu1->pntsu - 1;
987 const bool first_sel = nu1->bp->
f1 &
SELECT;
988 const bool last_sel = last_bp->
f1 &
SELECT && nu1->pntsu > 1;
998 add_v3_v3((new_bp + nu1->pntsu + 1)->vec, disp_3d);
1014 cu->
actnu = nu_index;
1017 else if (last_sel) {
1023 add_v3_v3((new_bp + nu1->pntsu)->vec, disp_3d);
1028 cu->
actnu = nu_index;
1043 if (nu1->pntsu > 1) {
1051 end = nu1->pntsu - 1;
1053 for (
int i = start; i < end; i++) {
1058 (nu1->bp + i)->f1 &= ~
SELECT;
1075 const int extrude_handle)
1079 float center[3] = {0.0f, 0.0f, 0.0f};
1107 if (old_last_nu != new_last_nu) {
1110 new_last_nu->
bezt ? (
const void *)new_last_nu->
bezt :
1111 (
const void *)new_last_nu->
bp);
1118 bezt->h1 = extrude_handle;
1119 bezt->h2 = extrude_handle;
1131 const float sel_dist)
1176 const float t_sq =
t *
t;
1177 const float t_cu = t_sq *
t;
1178 const float one_minus_t = 1 -
t;
1179 const float one_minus_t_sq = one_minus_t * one_minus_t;
1180 const float one_minus_t_cu = one_minus_t_sq * one_minus_t;
1204 const float denom = 3.0f * one_minus_t * t_sq;
1205 k1[0] = (mouse_3d[0] - one_minus_t_cu * bezt1->
vec[1][0] - t_cu * bezt2->
vec[1][0]) / denom;
1206 k1[1] = (mouse_3d[1] - one_minus_t_cu * bezt1->
vec[1][1] - t_cu * bezt2->
vec[1][1]) / denom;
1207 k1[2] = (mouse_3d[2] - one_minus_t_cu * bezt1->
vec[1][2] - t_cu * bezt2->
vec[1][2]) / denom;
1221 float handle_vec[3];
1236 float handle_vec[3];
1280 const float mouse_point[2] = {
UNPACK2(event->
mval)};
1283 const bool found_point = nu !=
NULL;
1285 bool deleted =
false;
1292 if (next_bezt && prev_bezt) {
1294 const uint span_step[2] = {bez_index, bez_index};
1303 if (nu->
pntsu == 0) {
1324 if (nu->pntsu == 1) {
1327 if (nu->bezt == bezt) {
1331 else if (nu->bezt + nu->pntsu - 1 == bezt) {
1350 int displacement[2];
1352 const float disp_fl[2] = {
UNPACK2(displacement)};
1354 vc, adj_bezt, bezt_idx, disp_fl, 0.0f,
false,
false);
1368 if (sel_bezt || (sel_bp && sel_nu->
pntsu > 2)) {
1370 (sel_bezt == sel_nu->
bezt ||
1371 sel_bezt == sel_nu->
bezt + sel_nu->
pntsu - 1));
1373 (sel_bp == sel_nu->
bp ||
1374 sel_bp == sel_nu->
bp + sel_nu->
pntsu - 1));
1375 if (!(is_bezt_endpoint || is_bp_endpoint)) {
1387 vc, &(cu->
editnurb->
nurbs), mval_fl, &nu, &bezt, &bp, &bezt_idx);
1391 (bezt == nu->
bezt || bezt == nu->
bezt + nu->
pntsu - 1) && bezt_idx == 1) ||
1393 (bp == nu->
bp || bp == nu->
bp + nu->
pntsu - 1)))) {
1417 if (bezt_idx == 1) {
1452 if (bezt_idx == 0) {
1464 else if (bezt_idx == 2) {
1506 "FREE_ALIGN_TOGGLE",
1508 "Free-Align Toggle",
1509 "Move handle of newly added point freely"},
1513 "Move Adjacent Handle",
1514 "Move the closer handle of the adjacent vertex"},
1518 "Move Entire Point",
1519 "Move the entire point using its handles"},
1524 "Mirror the movement of one handle onto the other"},
1529 "Move the handle along its current angle"},
1564 .deselect_all =
false,
1581 const int close_spline_method =
RNA_enum_get(op->
ptr,
"close_spline_method");
1678 else if (extrude_point) {
1684 if (!cpd->
acted && toggle_vector) {
1688 if (bezt_idx == 1 && cycle_handle_type) {
1716 else if (select_point) {
1759 const int close_spline_method =
RNA_enum_get(op->
ptr,
"close_spline_method");
1777 &vc, nurbs, mval_fl, &nu1, &bezt1, &bp1, &bezt_idx);
1779 if (move_point && nu1 && !nu1->
hide &&
1784 if (bezt_idx == 1) {
1807 else if (!cpd->
acted) {
1813 if (insert_point && !move_seg) {
1818 else if (extrude_point) {
1851 "Add a point connected to the last selected point");
1856 "Extrude Handle Type",
1857 "Type of the extruded handle");
1860 ot->
srna,
"insert_point",
false,
"Insert Point",
"Insert Point into a curve segment");
1863 ot->
srna,
"select_point",
false,
"Select Point",
"Select a point or its handles");
1869 "Make a spline cyclic by clicking endpoints");
1871 "close_spline_method",
1874 "Close Spline Method",
1875 "The condition for close spline to activate");
1877 ot->
srna,
"toggle_vector",
false,
"Toggle Vector",
"Toggle between Vector and Auto handles");
1879 "cycle_handle_type",
1881 "Cycle Handle Type",
1882 "Cycle between all four handle types");
struct Object * CTX_data_edit_object(const bContext *C)
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
void BKE_nurb_handles_calc(struct Nurb *nu)
struct BezTriple * BKE_nurb_bezt_get_next(struct Nurb *nu, struct BezTriple *bezt)
void BKE_nurb_free(struct Nurb *nu)
struct ListBase * BKE_curve_editNurbs_get(struct Curve *cu)
void BKE_curve_nurb_vert_active_set(struct Curve *cu, const struct Nurb *nu, const void *vert)
int BKE_curve_nurb_vert_index_get(const struct Nurb *nu, const void *vert)
struct BezTriple * BKE_nurb_bezt_get_prev(struct Nurb *nu, struct BezTriple *bezt)
void BKE_curve_nurb_vert_active_validate(struct Curve *cu)
void BKE_curve_editNurb_keyIndex_delCV(struct GHash *keyindex, const void *cv)
void BKE_curve_forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride)
void BKE_nurb_knot_calc_u(struct Nurb *nu)
General operations, lookup, etc. for blender objects.
#define LISTBASE_FOREACH(type, var, list)
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE float max_ff(float a, float b)
MINLINE float min_ff(float a, float b)
MINLINE float interpf(float a, float b, float t)
bool isect_ray_plane_v3(const float ray_origin[3], const float ray_direction[3], const float plane[4], float *r_lambda, bool clip)
bool invert_m4_m4(float R[4][4], const float A[4][4])
void mul_m4_v3(const float M[4][4], float r[3])
void mul_v3_m4v3(float r[3], const float M[4][4], const float v[3])
MINLINE void sub_v2_v2v2_int(int r[2], const int a[2], const int b[2])
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
float angle_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
void interp_v2_v2v2(float r[2], const float a[2], const float b[2], float t)
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
MINLINE void copy_v3_v3(float r[3], const float a[3])
float cos_v2v2v2(const float p1[2], const float p2[2], const float p3[2]) ATTR_WARN_UNUSED_RESULT
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], float t)
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE float normalize_v3_v3(float r[3], const float a[3])
MINLINE float normalize_v3_length(float r[3], float unit_scale)
MINLINE float len_manhattan_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void add_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE float mul_project_m4_v3_zfac(const float mat[4][4], const float co[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float dot_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
MINLINE float len_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE float len_v2(const float a[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void zero_v3(float r[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
struct Depsgraph Depsgraph
void DEG_id_tag_update(struct ID *id, int flag)
#define BEZT_DESEL_IDX(bezt, i)
#define BEZT_ISSEL_IDX(bezt, i)
#define BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt)
#define BEZT_SEL_ALL(bezt)
#define BEZT_ISSEL_ANY(bezt)
#define BEZT_DESEL_ALL(bezt)
struct BezTriple BezTriple
#define BEZT_SEL_IDX(bezt, i)
bool ED_operator_view3d_active(struct bContext *C)
void ED_view3d_win_to_3d_int(const struct View3D *v3d, const struct ARegion *region, const float depth_pt[3], const int mval[2], float r_out[3])
void ED_view3d_viewcontext_init(struct bContext *C, struct ViewContext *vc, struct Depsgraph *depsgraph)
void ED_view3d_global_to_vector(const struct RegionView3D *rv3d, const float coord[3], float vec[3])
eV3DProjStatus ED_view3d_project_float_object(const struct ARegion *region, const float co[3], float r_co[2], eV3DProjTest flag)
void ED_view3d_win_to_3d(const struct View3D *v3d, const struct ARegion *region, const float depth_pt[3], const float mval[2], float r_out[3])
float ED_view3d_select_dist_px(void)
NSNotificationCenter * center
_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 GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
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 ed_dissolve_bez_segment(BezTriple *bezt_prev, BezTriple *bezt_next, const Nurb *nu, const Curve *cu, const uint span_len, const uint span_step[2])
bool curve_toggle_cyclic(View3D *v3d, ListBase *editnurb, int direction)
int ed_editcurve_addvert(Curve *cu, EditNurb *editnurb, View3D *v3d, const float location_init[3])
const Depsgraph * depsgraph
ListBase * object_editcurve_get(Object *ob)
void ED_curve_beztcpy(EditNurb *editnurb, BezTriple *dst, BezTriple *src, int count)
bool ED_curve_editnurb_select_pick(bContext *C, const int mval[2], const int dist_px, const bool vert_without_handles, const struct SelectPick_Params *params)
void ED_curve_bpcpy(EditNurb *editnurb, BPoint *dst, BPoint *src, int count)
static void insert_bp_to_nurb(Nurb *nu, const CutData *data, Curve *cu)
static bool update_cut_data_for_all_nurbs(const ViewContext *vc, const ListBase *nurbs, const float point[2], const float sel_dist, CutData *cd)
static void toggle_handle_types(BezTriple *bezt, int bezt_idx, CurvePenData *cpd)
static void move_bezt_by_displacement(BezTriple *bezt, const float disp_3d[3])
static bool insert_point_to_segment(const ViewContext *vc, const wmEvent *event)
static void delete_bp_from_nurb(const BPoint *bp, Nurb *nu, EditNurb *editnurb)
static void extrude_vertices_from_selected_endpoints(EditNurb *editnurb, ListBase *nurbs, Curve *cu, const float disp_3d[3])
static void delete_bezt_from_nurb(const BezTriple *bezt, Nurb *nu, EditNurb *editnurb)
static bool is_cyclic(const Nurb *nu)
static void extrude_points_from_selected_vertices(const ViewContext *vc, const wmEvent *event, const int extrude_handle)
static void move_adjacent_handle(ViewContext *vc, const wmEvent *event, ListBase *nurbs)
static void move_segment(ViewContext *vc, MoveSegmentData *seg_data, const wmEvent *event)
static void delete_nurb(Curve *cu, Nurb *nu)
static void toggle_select_bezt(BezTriple *bezt, const int bezt_idx, Curve *cu, Nurb *nu)
struct MoveSegmentData MoveSegmentData
static void screenspace_to_worldspace(const ViewContext *vc, const float pos_2d[2], const float depth[3], float r_pos_3d[3])
static void move_bezt_to_location(BezTriple *bezt, const float location[3])
static void move_all_selected_points(const ViewContext *vc, const wmEvent *event, CurvePenData *cpd, ListBase *nurbs, const bool bezt_only)
static bool worldspace_to_screenspace(const ViewContext *vc, const float pos_3d[3], float r_pos_2d[2])
static void get_updated_data_for_edge(const float point[2], const float point1[2], const float point2[2], const int point_idx, const int resolu_idx, float *r_min_dist, int *r_min_i, float *r_param)
static CutData init_cut_data(const wmEvent *event)
static void toggle_bezt_free_align_handles(BezTriple *bezt)
static void toggle_sel_bezt_free_align_handles(ListBase *nurbs)
static void get_first_selected_point(Curve *cu, View3D *v3d, Nurb **r_nu, BezTriple **r_bezt, BPoint **r_bp)
static void deselect_all_center_vertices(ListBase *nurbs)
static void remove_handle_movement_constraints(BezTriple *bezt, const bool f1, const bool f3)
static void screenspace_to_worldspace_int(const ViewContext *vc, const int pos_2d[2], const float depth[3], float r_pos_3d[3])
struct CurvePenData CurvePenData
static int curve_pen_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void init_selected_bezt_handles(ListBase *nurbs)
static void move_bp_to_location(const ViewContext *vc, BPoint *bp, const float mval[2])
static bool is_last_bezt(const Nurb *nu, const BezTriple *bezt)
static int get_nurb_index(const ListBase *nurbs, const Nurb *nurb)
void CURVE_OT_pen(wmOperatorType *ot)
static void get_bezier_interpolated_point(const BezTriple *bezt1, const BezTriple *bezt2, const float parameter, float r_point[3])
#define FOREACH_SELECTED_BEZT_END
static void toggle_select_bp(BPoint *bp, Curve *cu, Nurb *nu)
static const EnumPropertyItem prop_close_spline_method[]
static void move_bezt_handle_or_vertex_by_displacement(const ViewContext *vc, BezTriple *bezt, const int bezt_idx, const float disp_2d[2], const float distance, const bool link_handles, const bool lock_angle)
static const EnumPropertyItem prop_handle_types[]
static int curve_pen_modal(bContext *C, wmOperator *op, const wmEvent *event)
static bool get_closest_vertex_to_point_in_nurbs(const ViewContext *vc, const ListBase *nurbs, const float point[2], Nurb **r_nu, BezTriple **r_bezt, BPoint **r_bp, int *r_bezt_idx)
static bool delete_point_under_mouse(ViewContext *vc, const wmEvent *event)
static bool is_spline_nearby(ViewContext *vc, struct wmOperator *op, const wmEvent *event, const float sel_dist)
static bool get_selected_center(const ListBase *nurbs, const bool mid_only, const bool bezt_only, float r_center[3])
static bool make_cyclic_if_endpoints(ViewContext *vc, Nurb *sel_nu, BezTriple *sel_bezt, BPoint *sel_bp)
#define FOREACH_SELECTED_BEZT_BEGIN(bezt, nurbs)
static void update_location_for_2d_curve(const ViewContext *vc, float location[3])
@ PEN_MODAL_MOVE_ADJACENT
@ PEN_MODAL_FREE_ALIGN_TOGGLE
static void cycle_handles(BezTriple *bezt)
static void insert_bezt_to_nurb(Nurb *nu, const CutData *data, Curve *cu)
static void update_cut_data_for_nurb(const ViewContext *vc, CutData *cd, Nurb *nu, const int resolu, const float point[2])
wmKeyMap * curve_pen_modal_keymap(wmKeyConfig *keyconf)
static void calculate_new_bezier_point(const float point_prev[3], float handle_prev[3], float new_left_handle[3], float new_right_handle[3], float handle_next[3], const float point_next[3], const float parameter)
bool ED_curve_deselect_all(EditNurb *editnurb)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
T distance(const T &a, const T &b)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
struct RegionView3D * rv3d
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
bool WM_event_drag_test(const wmEvent *event, const int prev_xy[2])
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
#define ISMOUSE_MOTION(event_type)
wmKeyMap * WM_modalkeymap_find(wmKeyConfig *keyconf, const char *idname)
void WM_modalkeymap_assign(wmKeyMap *km, const char *opname)
wmKeyMap * WM_modalkeymap_ensure(wmKeyConfig *keyconf, const char *idname, const EnumPropertyItem *items)
void WM_operator_properties_mouse_select(wmOperatorType *ot)