42 #define INSET_DEFAULT 0.00001f
50 float vec1[2], vec2[2], dist_sq;
56 const float dist_2d =
len_v2v2(vec1, vec2);
57 if (dist_2d > FLT_EPSILON) {
58 const float dist = inset / dist_2d;
72 static float edbm_rip_linedist(
73 ARegion *region,
float mat[4][4],
const float co1[3],
const float co2[3],
const float mvalf[2])
75 float vec1[2], vec2[2];
101 float cent[3] = {0, 0, 0}, mid[3];
104 float fmval_tweak[2];
105 float e_v1_co[2], e_v2_co[2];
181 #define IS_VISIT_POSSIBLE(e) (BM_edge_is_manifold(e) && BM_elem_flag_test(e, BM_ELEM_TAG))
182 #define IS_VISIT_DONE(e) ((e)->l && (BM_elem_index_get((e)->l) != INVALID_UID))
183 #define INVALID_UID INT_MIN
253 if (e_first ==
NULL) {
259 v_step = e_first->
v1;
277 v_step = e_first->
v1;
296 printf(
"%s: found contiguous edge loop of (%d)\n", __func__, uid_end - uid_start);
335 float projectMat[4][4],
336 const float fmval[2])
340 for (lp = eloop_pairs; lp->
l_a; lp++) {
344 float score_a = 0.0f;
345 float score_b = 0.0f;
358 e = (score_a > score_b) ? lp->
l_a->
e : lp->
l_b->
e;
432 for (i = 0, ulp = uloop_pairs; i < total_tag; i++, ulp++) {
440 if (v_shared ==
NULL) {
456 f_verts[0] = v_shared;
462 if (v_shared == ulp->
l_pair[0]->
v) {
476 l_iter = l_iter->
next;
478 l_iter = l_iter->
next;
480 l_iter = l_iter->
next;
485 l_iter = l_iter->
next;
487 l_iter = l_iter->
next;
512 float projectMat[4][4], fmval[3] = {
event->mval[0],
event->mval[1]};
513 float dist_sq = FLT_MAX;
515 bool is_wire, is_manifold_region;
518 int totboundary_edge = 0;
557 if ((e_best ==
NULL) || (d < dist_sq)) {
566 if (e_best && e_best->
l && (is_manifold_region ==
false)) {
601 for (
i1 = 0;
i1 < 3;
i1++) {
608 if ((e_best ==
NULL) || (d < dist_sq)) {
613 for (i2 = 0; i2 < 3; i2++) {
631 if ((is_wire ==
false && totboundary_edge > 2) || (is_wire ==
true && totboundary_edge > 1)) {
657 for (i = 0; i < vout_len; i++) {
715 for (i = 2; i < vout_len; i++) {
763 l_iter = l_first = e_best->
l;
771 if (larr[larr_len]->
e == e_best) {
779 }
while ((l_iter = l_iter->
radial_next) != l_first);
802 if (fill_uloop_pairs) {
812 float l_corner_co[3];
827 if ((v_best ==
NULL) || (d < dist_sq)) {
843 if (do_fill && fill_uloop_pairs) {
871 float projectMat[4][4], fmval[3] = {
event->mval[0],
event->mval[1]};
884 int totedge_manifold;
889 totedge_manifold = 0;
908 all_manifold =
false;
913 if (i == 1 && e_best->
l) {
917 if ((
ELEM(totedge_manifold, 4, 3)) || (all_manifold ==
false)) {
934 if (totedge_manifold != 3) {
973 if (do_fill && fill_uloop_pairs) {
991 uint objects_len = 0;
996 bool no_vertex_selected =
true;
997 bool error_face_selected =
true;
998 bool error_disconnected_vertices =
true;
999 bool error_rip_failed =
true;
1001 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
1002 Object *obedit = objects[ob_index];
1014 no_vertex_selected =
false;
1023 error_face_selected =
false;
1029 error_disconnected_vertices =
false;
1067 error_rip_failed =
false;
1071 .calc_looptri = true,
1072 .calc_normals = true,
1073 .is_destructive = true,
1079 if (no_vertex_selected) {
1083 if (error_face_selected) {
1087 if (error_disconnected_vertices) {
1091 if (error_rip_failed) {
1104 ot->
description =
"Disconnect vertex or edges from connected geometry";
struct ViewLayer * CTX_data_view_layer(const bContext *C)
struct View3D * CTX_wm_view3d(const bContext *C)
struct ARegion * CTX_wm_region(const bContext *C)
struct RegionView3D * CTX_wm_region_view3d(const bContext *C)
BMEditMesh * BKE_editmesh_from_object(struct Object *ob)
Return the BMEditMesh for a given object.
#define BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, v3d, r_len)
void BKE_report(ReportList *reports, eReportType type, const char *message)
A (mainly) macro array library.
#define BLI_array_append_ret(arr)
#define BLI_array_declare(arr)
float dist_to_line_v2(const float p[2], const float l1[2], const float l2[2])
float dist_squared_to_line_segment_v2(const float p[2], const float l1[2], const float l2[2])
void interp_v2_v2v2(float r[2], const float a[2], const float b[2], float t)
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
void mid_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE float len_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE float normalize_v2_length(float r[2], float unit_scale)
MINLINE void add_v3_v3(float r[3], const float a[3])
Object is a sort of wrapper for general info.
void EDBM_update(struct Mesh *me, const struct EDBMUpdate_Params *params)
void ED_view3d_ob_project_mat_get(const struct RegionView3D *v3d, const struct Object *ob, float r_pmat[4][4])
void ED_view3d_project_float_v2_m4(const struct ARegion *region, const float co[3], float r_co[2], const 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 i1
Read Guarded memory(de)allocation.
@ OPTYPE_DEPENDS_ON_CURSOR
#define BM_FACE_FIRST_LOOP(p)
void BM_elem_attrs_copy(BMesh *bm_src, BMesh *bm_dst, const void *ele_src, void *ele_dst)
BMFace * BM_face_create_verts(BMesh *bm, BMVert **vert_arr, const int len, const BMFace *f_example, const eBMCreateFlag create_flag, const bool create_edges)
bool BM_vert_splice(BMesh *bm, BMVert *v_dst, BMVert *v_src)
Splice Vert.
void bmesh_kernel_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len, const bool copy_select)
Separate Vert.
BMEdge * BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *e_example, const eBMCreateFlag create_flag)
Main function for creating a new edge.
void BM_mesh_edgesplit(BMesh *bm, const bool use_verts, const bool tag_only, const bool copy_select)
#define BM_elem_index_get(ele)
#define BM_elem_flag_set(ele, hflag, val)
#define BM_elem_index_set(ele, index)
#define BM_elem_flag_test(ele, hflag)
#define BM_elem_flag_enable(ele, hflag)
int BM_iter_as_array(BMesh *bm, const char itype, void *data, void **array, const int len)
Iterator as Array.
#define BM_ITER_ELEM(ele, iter, data, itype)
#define BM_ITER_MESH(ele, iter, bm, itype)
ATTR_WARN_UNUSED_RESULT BMesh * bm
void BM_mesh_select_mode_clean_ex(BMesh *bm, const short selectmode)
Select Mode Clean.
void BM_vert_select_set(BMesh *bm, BMVert *v, const bool select)
Select Vert.
void BM_edge_select_set(BMesh *bm, BMEdge *e, const bool select)
Select Edge.
void BM_select_history_validate(BMesh *bm)
bool BM_select_history_active_get(BMesh *bm, BMEditSelection *ese)
#define BM_select_history_store(bm, ele)
#define BM_select_history_remove(bm, ele)
bool BM_custom_loop_normals_to_vector_layer(BMesh *bm)
void BM_custom_loop_normals_from_vector_layer(BMesh *bm, bool add_sharp_edges)
BMVert * BM_face_loop_separate_multi_isolated(BMesh *bm, BMLoop *l_sep)
BMVert * BM_face_loop_separate_multi(BMesh *bm, BMLoop **larr, int larr_len)
bool BM_vert_is_wire(const BMVert *v)
BMLoop * BM_face_other_vert_loop(BMFace *f, BMVert *v_prev, BMVert *v)
Other Loop in Face Sharing a Vertex.
BMEdge * BM_vert_other_disk_edge(BMVert *v, BMEdge *e_first)
BMLoop * BM_vert_find_first_loop(BMVert *v)
bool BM_vert_is_manifold_region(const BMVert *v)
void BM_loop_calc_face_tangent(const BMLoop *l, float r_tangent[3])
BM_loop_calc_face_tangent.
bool BM_edge_loop_pair(BMEdge *e, BMLoop **r_la, BMLoop **r_lb)
BMVert * BM_edge_share_vert(BMEdge *e1, BMEdge *e2)
BMFace * BM_face_exists(BMVert **varr, int len)
BMLoop * BM_edge_vert_share_loop(BMLoop *l, BMVert *v)
Return the Loop Shared by Edge and Vert.
float BM_edge_calc_length(const BMEdge *e)
BMLoop * BM_edge_other_loop(BMEdge *e, BMLoop *l)
BMLoop * BM_loop_other_edge_loop(BMLoop *l, BMVert *v)
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()
#define BM_vert_edge_count_is_equal(v, n)
BLI_INLINE BMVert * BM_edge_other_vert(BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE bool BM_edge_in_loop(const BMEdge *e, const BMLoop *l) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
#define BM_vert_face_count_is_equal(v, n)
BLI_INLINE bool BM_edge_is_wire(const BMEdge *e) 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 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
static int edbm_rip_invoke__edge(bContext *C, const wmEvent *event, Object *obedit, bool do_fill)
static float edbm_rip_edge_side_measure(BMEdge *e, BMLoop *e_l, ARegion *region, float projectMat[4][4], const float fmval[2])
static int edbm_rip_invoke__vert(bContext *C, const wmEvent *event, Object *obedit, bool do_fill)
static void edbm_tagged_loop_pairs_do_fill_faces(BMesh *bm, UnorderedLoopPair *uloop_pairs)
static BMEdge * edbm_ripsel_edge_uid_step(BMEdge *e_orig, BMVert **v_prev)
static float edbm_rip_edgedist_squared(ARegion *region, float mat[4][4], const float co1[3], const float co2[3], const float mvalf[2], const float inset)
struct EdgeLoopPair EdgeLoopPair
#define IS_VISIT_POSSIBLE(e)
static BMVert * edbm_ripsel_edloop_pair_start_vert(BMEdge *e)
static void edbm_calc_loop_co(BMLoop *l, float l_mid_co[3])
static UnorderedLoopPair * edbm_tagged_loop_pairs_to_fill(BMesh *bm)
static void edbm_ripsel_deselect_helper(BMesh *bm, EdgeLoopPair *eloop_pairs, ARegion *region, float projectMat[4][4], const float fmval[2])
struct UnorderedLoopPair UnorderedLoopPair
void MESH_OT_rip(wmOperatorType *ot)
static EdgeLoopPair * edbm_ripsel_looptag_helper(BMesh *bm)
static int edbm_rip_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static BMEdge * edbm_ripsel_edge_mark_step(BMVert *v, const int uid)
bool EDBM_view3d_poll(bContext *C)
void(* MEM_freeN)(void *vmemh)
size_t(* MEM_allocN_len)(const void *vmemh)
void *(* MEM_mallocN)(size_t len, const char *str)
SymEdge< T > * prev(const SymEdge< T > *se)
bool RNA_boolean_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)
struct BMLoop * radial_next
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports