106 if (tc->custom.mode.data) {
110 BLI_assert(!
"Should never happen, at least one EdgeSlideData should be valid");
148 float p[3],
const float v1[3],
const float v2[3],
const float v3[3],
float t)
150 float t_mid, t_delta;
156 if (t_delta < 0.0f) {
166 t_mid = 1.0f - t_mid;
187 float dist = FLT_MAX;
196 if ((fac > -FLT_EPSILON) && (fac < 1.0f + FLT_EPSILON)) {
208 }
while ((l_iter = l_iter->
next) != l_last);
224 float vec_accum[3] = {0.0f, 0.0f, 0.0f};
225 float vec_accum_len = 0.0f;
235 if (
l->
e == e_next) {
246 if (l_tmp->
f->
len == 4) {
320 const bool use_occlude_geometry,
321 const bool use_calc_direction)
328 float projectMat[4][4];
334 float mval_start[2], mval_end[2];
335 float mval_dir[3], dist_best_sq;
339 v3d =
t->area ?
t->area->spacedata.first :
NULL;
340 rv3d =
t->region ?
t->region->regiondata :
NULL;
351 if (use_occlude_geometry) {
361 dist_best_sq = -1.0f;
363 if (use_calc_direction) {
364 loop_dir =
MEM_callocN(
sizeof(
float[3]) * loop_nr,
"sv loop_dir");
365 loop_maxdist =
MEM_mallocN(
sizeof(
float) * loop_nr,
"sv loop_maxdist");
370 for (
int i = 0; i < sld->
totsv; i++, sv++) {
382 float sco_a[3], sco_b[3];
391 bool is_visible = !use_occlude_geometry ||
394 if (!is_visible && !use_calc_direction) {
417 if ((dist_best_sq == -1.0f) ||
420 dist_best_sq = dist_sq;
425 if (use_calc_direction) {
428 if (loop_maxdist[l_nr] == -1.0f || dist_sq < loop_maxdist[l_nr]) {
429 loop_maxdist[l_nr] = dist_sq;
436 if (use_calc_direction) {
439 for (i = 0; i < sld->
totsv; i++, sv++) {
442 if (
dot_v3v3(loop_dir[l_nr], mval_dir) < 0.0f) {
455 mval_dir[1] = 100.0f;
468 sld->
mval_end[0] =
t->mval[0] + mval_end[0];
469 sld->
mval_end[1] =
t->mval[1] + mval_end[1];
483 if (sld->
totsv > 0) {
486 float projectMat[4][4];
492 float dist_min_sq = FLT_MAX;
496 rv3d =
t->region ?
t->region->regiondata :
NULL;
507 for (i = 0; i < sld->
totsv; i++, sv++) {
513 if (dist_sq < dist_min_sq) {
514 dist_min_sq = dist_sq;
535 const float mval[2] = {(
float)
t->mval[0], (
float)
t->mval[1]};
536 int numsel, i, loop_nr;
537 bool use_occlude_geometry =
false;
558 if (numsel == 0 || numsel > 2) {
579 #define INDEX_UNSET -1
580 #define INDEX_INVALID -2
613 float vec_a[3], vec_b[3];
615 BMLoop *l_a_prev, *l_b_prev;
623 #define EDGESLIDE_VERT_IS_INNER(v, e_dir) \
624 ((BM_edge_is_boundary(e_dir) == false) && (BM_vert_edge_count_nonwire(v) == 2))
659 }
while (
e != v_first->
e);
664 l_b =
e->l->radial_next;
706 #define SV_FROM_VERT(v) \
707 ((sv_table[BM_elem_index_get(v)] == INDEX_UNSET) ? \
708 ((void)(sv_table[BM_elem_index_get(v)] = STACK_SIZE(sv_array)), \
709 STACK_PUSH_RET_PTR(sv_array)) : \
710 (&sv_array[sv_table[BM_elem_index_get(v)]]))
729 if (l_a || l_a_prev) {
735 if (
l_b || l_b_prev) {
784 l_a_ok_prev = (l_a !=
NULL);
817 else if (
e->l !=
NULL) {
828 else if (l_b_ok_prev) {
834 if (!l_a_ok_prev && l_a) {
837 if (!l_b_ok_prev &&
l_b) {
844 }
while ((
e != v_first->
e) && (l_a ||
l_b));
852 #undef EDGESLIDE_VERT_IS_INNER
864 v3d =
t->area ?
t->area->spacedata.first :
NULL;
865 rv3d =
t->region ?
t->region->regiondata :
NULL;
895 const float mval[2] = {(
float)
t->mval[0], (
float)
t->mval[1]};
897 bool use_occlude_geometry =
false;
903 v3d =
t->area ?
t->area->spacedata.first :
NULL;
904 rv3d =
t->region ?
t->region->regiondata :
NULL;
915 float len_sq_max = -1.0f;
920 if (len_sq > len_sq_max) {
927 if (len_sq_max != -1.0f) {
977 const int sv_tot_nowire = sv_tot;
980 for (
int i = 0; i < sv_tot_nowire; i++, sv_iter++) {
1014 if ((endpoint == 2) && (sv_tot != j)) {
1023 int sv_tot_prev = sv_tot;
1024 const float *co_src = sv_iter->
v->
co;
1025 const float *co_dst = sv_end->
v->
co;
1026 const float *dir_src = sv_iter->
dir_side[0];
1027 const float *dir_dst = sv_end->
dir_side[0];
1030 while (j-- != sv_tot_prev) {
1033 interp_v3_v3v3(sv_array[j].dir_side[0], dir_src, dir_dst, factor);
1043 sld->
totsv = sv_tot;
1047 v3d =
t->area ?
t->area->spacedata.first :
NULL;
1048 rv3d =
t->region ?
t->region->regiondata :
NULL;
1086 switch (event->
type) {
1111 switch (event->
val) {
1113 sld->curr_sv_index = ((sld->curr_sv_index - 1) + sld->totsv) % sld->totsv;
1116 sld->curr_sv_index = (sld->curr_sv_index + 1) % sld->totsv;
1161 float co_a[3], co_b[3], co_mark[3];
1163 const float fac = (slp->
perc + 1.0f) / 2.0f;
1165 const float guide_size = ctrl_size - 0.5f;
1166 const int alpha_shade = -30;
1174 if (curr_sv->
v_side[0]) {
1178 if (curr_sv->
v_side[1]) {
1185 float *co_test =
NULL;
1187 if (curr_sv->
v_side[1]) {
1192 if (curr_sv->
v_side[0]) {
1197 if (co_test !=
NULL) {
1213 else if (is_clamp ==
false) {
1217 const int alpha_shade = -160;
1225 for (i = 0; i < sld->
totsv; i++, sv++) {
1248 const int alpha_shade = -160;
1276 float snap_point[3], co_orig[3], co_dest[2][3], dvec[3];
1291 float perc = *value;
1297 side_index = perc < 0.0f;
1308 side_index = t_snap >= t_mid;
1313 sub_v3_v3v3(co_dir, co_dest[side_index], co_orig);
1332 perc = (1.0f - perc) * t_mid;
1335 perc = perc * (1.0f - t_mid) + t_mid;
1342 perc = (2 * perc) - 1.0f;
1362 const int side_index = (perc < 0.0f);
1363 const float perc_final =
fabsf(perc);
1372 for (
int i = 0; i < sld->
totsv; i++, sv++) {
1379 const float perc_init =
fabsf(perc) *
1390 for (
int i = 0; i < sld->
totsv; i++, sv++) {
1392 float perc_final = perc_init;
1417 const float curr_length_perc = curr_sv->
edge_len *
1418 (((slp->
flipped ? perc : -perc) + 1.0f) / 2.0f);
1431 for (
int i = 0; i < sld->
totsv; i++, sv++) {
1459 const bool is_constrained = !(is_clamp ==
false ||
hasNumInput(&
t->num));
1461 final =
t->values[0];
1469 if (is_constrained) {
1470 CLAMP(
final, -1.0f, 1.0f);
1475 t->values_final[0] =
final;
1506 TransInfo *
t,
bool use_double_side,
bool use_even,
bool flipped,
bool use_clamp)
1522 if (use_double_side ==
false) {
1531 t->custom.mode.data = slp;
1532 t->custom.mode.use_free =
true;
1539 tc->custom.mode.data = sld;
1557 t->snap[1] =
t->snap[0] * 0.1f;
1560 t->num.unit_sys =
t->scene->unit.system;
typedef float(TangentPoint)[2]
BMEditMesh * BKE_editmesh_from_object(struct Object *ob)
Return the BMEditMesh for a given object.
void BKE_bmbvh_free(BMBVHTree *tree)
BMBVHTree * BKE_bmbvh_new_from_editmesh(struct BMEditMesh *em, int flag, const float(*cos_cage)[3], const bool cos_cage_free)
MINLINE float min_ff(float a, float b)
float line_point_factor_v3(const float p[3], const float l1[3], const float l2[3])
bool isect_line_plane_v3(float r_isect_co[3], const float l1[3], const float l2[3], const float plane_co[3], const float plane_no[3]) ATTR_WARN_UNUSED_RESULT
float dist_squared_to_line_segment_v2(const float p[2], const float l1[2], const float l2[2])
void unit_m4(float m[4][4])
void mul_m4_v3(const float M[4][4], float r[3])
void copy_vn_fl(float *array_tar, const int size, const float val)
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], const float t)
MINLINE float len_squared_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float len_squared_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE float normalize_v3(float r[3])
MINLINE void sub_v3_v3(float r[3], const float a[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v2_fl(float r[2], float f)
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_v3_v3(float r[3], const float a[3])
MINLINE void negate_v3_v3(float r[3], const float a[3])
MINLINE bool is_zero_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void zero_v2(float r[2])
MINLINE void swap_v3_v3(float a[3], float b[3])
MINLINE float normalize_v3_length(float r[3], const float unit_scale)
MINLINE void copy_v3_fl(float r[3], float f)
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
MINLINE void zero_v3(float r[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
size_t BLI_strncpy_rlen(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
#define UNUSED_VARS_NDEBUG(...)
#define STACK_DECLARE(stack)
#define STACK_INIT(stack, tot)
#define STACK_SIZE(stack)
#define SCE_SNAP_MODE_FACE
#define SCE_SNAP_MODE_EDGE
bool BMBVH_EdgeVisible(struct BMBVHTree *tree, struct BMEdge *e, struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, struct Object *obedit)
void ED_area_status_text(ScrArea *area, const char *str)
#define XRAY_ENABLED(v3d)
void ED_view3d_ob_project_mat_get(const struct RegionView3D *v3d, struct Object *ob, float r_pmat[4][4])
void ED_view3d_project_float_v3_m4(const struct ARegion *region, const float co[3], float r_co[3], float mat[4][4])
void ED_view3d_project_float_v2_m4(const struct ARegion *region, const float co[3], float r_co[2], float mat[4][4])
_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
_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 v1
void GPU_matrix_pop(void)
#define GPU_matrix_mul(x)
void GPU_matrix_push(void)
@ GPU_SHADER_3D_UNIFORM_COLOR
void GPU_blend(eGPUBlend blend)
void GPU_line_width(float width)
void GPU_point_size(float size)
void GPU_depth_test(eGPUDepthTest test)
Read Guarded memory(de)allocation.
Group RGB to Bright Vector Camera CLAMP
float UI_GetThemeValuef(int colorid)
#define BM_DISK_EDGE_NEXT(e, v)
#define BM_elem_index_get(ele)
#define BM_elem_flag_disable(ele, hflag)
#define BM_elem_index_set(ele, index)
#define BM_elem_flag_test(ele, hflag)
#define BM_elem_flag_enable(ele, hflag)
#define BM_ITER_ELEM(ele, iter, data, itype)
#define BM_ITER_MESH(ele, iter, bm, itype)
#define BM_ITER_MESH_INDEX(ele, iter, bm, itype, indexvar)
ATTR_WARN_UNUSED_RESULT BMesh * bm
float BM_edge_calc_length_squared(const BMEdge *e)
BMVert * BM_edge_share_vert(BMEdge *e1, BMEdge *e2)
void BM_loop_calc_face_direction(const BMLoop *l, float r_dir[3])
BM_loop_calc_face_direction.
float BM_edge_calc_length(const BMEdge *e)
bool BM_vert_is_edge_pair(const BMVert *v)
BMLoop * BM_loop_other_edge_loop(BMLoop *l, BMVert *v)
BMLoop * BM_face_vert_share_loop(BMFace *f, BMVert *v)
Return the Loop Shared by Face and Vertex.
BLI_INLINE bool BM_edge_is_manifold(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE bool BM_edge_is_boundary(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE BMVert * BM_edge_other_vert(BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE bool BM_vert_in_edge(const BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMLoop * l_b
ATTR_WARN_UNUSED_RESULT const BMVert * v
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
struct BMLoop * radial_next
TransDataEdgeSlideVert * sv
TransCustomDataContainer custom
struct LinkNode ** cd_loop_groups
struct BMVert * v_side[2]
const char * WM_bool_as_string(bool test)