56#define INSET_DEFAULT 0.00001f
69 const float dist_2d =
len_v2v2(vec1, vec2);
70 if (dist_2d > FLT_EPSILON) {
71 const float dist = inset / dist_2d;
85static float edbm_rip_linedist(
86 ARegion *region,
float mat[4][4],
const float co1[3],
const float co2[3],
const float mvalf[2])
88 float vec1[2], vec2[2];
115 const float fmval[2])
118 float fmval_tweak[2];
199#define IS_VISIT_POSSIBLE(e) (BM_edge_is_manifold(e) && BM_elem_flag_test(e, BM_ELEM_TAG))
200#define IS_VISIT_DONE(e) ((e)->l && (BM_elem_index_get((e)->l) != INVALID_UID))
201#define INVALID_UID INT_MIN
269 if (e_first ==
nullptr) {
275 v_step = e_first->
v1;
293 v_step = e_first->
v1;
314 printf(
"%s: found contiguous edge loop of (%d)\n", __func__, uid_end - uid_start);
354 const float fmval[2])
360 float score_a = 0.0f;
361 float score_b = 0.0f;
374 e = (score_a > score_b) ? lp.l_a->
e : lp.l_b->e;
453 for (i = 0, ulp = uloop_pairs; i < total_tag; i++, ulp++) {
461 if (v_shared ==
nullptr) {
469 std::swap(f_verts[0], f_verts[3]);
472 std::swap(f_verts[1], f_verts[2]);
477 f_verts[0] = v_shared;
480 f_verts[3] =
nullptr;
483 if (v_shared == ulp->
l_pair[0]->
v) {
484 std::swap(f_verts[0], f_verts[1]);
497 l_iter = l_iter->
next;
499 l_iter = l_iter->
next;
501 l_iter = l_iter->
next;
506 l_iter = l_iter->
next;
508 l_iter = l_iter->
next;
540 bool is_wire, is_manifold_region;
543 int totboundary_edge = 0;
562 if ((
v ==
nullptr) || (
v->
e ==
nullptr)) {
582 if ((e_best ==
nullptr) || (d < dist_sq)) {
591 if (e_best && e_best->
l && (is_manifold_region ==
false)) {
626 for (i1 = 0; i1 < 3; i1++) {
633 if ((e_best ==
nullptr) || (d < dist_sq)) {
638 for (i2 = 0; i2 < 3; i2++) {
656 if ((is_wire ==
false && totboundary_edge > 2) || (is_wire ==
true && totboundary_edge > 1)) {
682 for (i = 0; i < vout_len; i++) {
726 std::swap(vout[0], vout[vi_best]);
740 for (i = 2; i < vout_len; i++) {
788 l_iter = l_first = e_best->
l;
796 if (larr[larr_len]->
e == e_best) {
804 }
while ((l_iter = l_iter->
radial_next) != l_first);
828 if (fill_uloop_pairs) {
838 float l_corner_co[3];
853 if ((v_best ==
nullptr) || (d < dist_sq)) {
869 if (do_fill && fill_uloop_pairs) {
914 int totedge_manifold;
919 totedge_manifold = 0;
938 all_manifold =
false;
943 if (i == 1 && e_best->
l) {
947 if (
ELEM(totedge_manifold, 4, 3) || (all_manifold ==
false)) {
964 if (totedge_manifold != 3) {
1002 if (do_fill && fill_uloop_pairs) {
1031 bool no_vertex_selected =
true;
1032 bool error_face_selected =
true;
1033 bool error_disconnected_vertices =
true;
1034 bool error_rip_failed =
true;
1036 for (
Object *obedit : objects) {
1048 no_vertex_selected =
false;
1057 error_face_selected =
false;
1063 error_disconnected_vertices =
false;
1101 error_rip_failed =
false;
1104 params.calc_looptris =
true;
1105 params.calc_normals =
true;
1106 params.is_destructive =
true;
1110 if (no_vertex_selected) {
1114 if (error_face_selected) {
1118 if (error_disconnected_vertices) {
1122 if (error_rip_failed) {
1137 ot->
description =
"Disconnect vertex or edges from connected geometry";
Scene * CTX_data_scene(const bContext *C)
RegionView3D * CTX_wm_region_view3d(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
BMEditMesh * BKE_editmesh_from_object(Object *ob)
Return the BMEditMesh for a given object.
blender::Vector< Object * > BKE_view_layer_array_from_objects_in_edit_mode_unique_data(const Scene *scene, ViewLayer *view_layer, const View3D *v3d)
void BKE_report(ReportList *reports, eReportType type, const char *message)
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])
MINLINE float normalize_v2_length(float n[2], float unit_length)
MINLINE float len_v2v2(const float v1[2], const float v2[2]) ATTR_WARN_UNUSED_RESULT
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 void add_v3_v3(float r[3], const float a[3])
#define UNUSED_VARS_NDEBUG(...)
#define BLT_I18NCONTEXT_ID_MESH
Object is a sort of wrapper for general info.
void EDBM_update(Mesh *mesh, const EDBMUpdate_Params *params)
blender::float2 ED_view3d_project_float_v2_m4(const ARegion *region, const float co[3], const blender::float4x4 &mat)
blender::float4x4 ED_view3d_ob_project_mat_get(const RegionView3D *rv3d, const Object *ob)
Read Guarded memory(de)allocation.
@ OPTYPE_DEPENDS_ON_CURSOR
#define BM_FACE_FIRST_LOOP(p)
void BM_elem_attrs_copy(BMesh *bm, const BMCustomDataCopyMap &map, const BMVert *src, BMVert *dst)
bool BM_vert_splice(BMesh *bm, BMVert *v_dst, BMVert *v_src)
Splice Vert.
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)
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(BMesh *bm, BMLoop **larr, int larr_len)
BMVert * BM_face_loop_separate_multi_isolated(BMesh *bm, BMLoop *l_sep)
BMLoop * BM_loop_other_edge_loop(BMLoop *l, BMVert *v)
BMVert * BM_edge_share_vert(BMEdge *e1, BMEdge *e2)
bool BM_vert_is_wire(const 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)
BMFace * BM_face_exists(BMVert *const *varr, int len)
BMEdge * BM_vert_other_disk_edge(BMVert *v, BMEdge *e_first)
BMLoop * BM_edge_vert_share_loop(BMLoop *l, BMVert *v)
Return the Loop Shared by Edge and Vert.
BMLoop * BM_vert_find_first_loop(BMVert *v)
BMLoop * BM_edge_other_loop(BMEdge *e, BMLoop *l)
BMLoop * BM_face_other_vert_loop(BMFace *f, BMVert *v_prev, BMVert *v)
Other Loop in Face Sharing a Vertex.
float BM_edge_calc_length(const BMEdge *e)
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
void append(const T &value)
static BMVert * edbm_ripsel_edloop_pair_start_vert(BMEdge *e)
static int edbm_rip_invoke__edge(bContext *C, const wmEvent *event, Object *obedit, bool do_fill)
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 float edbm_rip_edge_side_measure(BMEdge *e, BMLoop *e_l, ARegion *region, const blender::float4x4 &projectMat, const float fmval[2])
static Vector< EdgeLoopPair > edbm_ripsel_looptag_helper(BMesh *bm)
#define IS_VISIT_POSSIBLE(e)
static void edbm_calc_loop_co(BMLoop *l, float l_mid_co[3])
static BMEdge * edbm_ripsel_edge_mark_step(BMVert *v, const int uid)
static UnorderedLoopPair * edbm_tagged_loop_pairs_to_fill(BMesh *bm)
static void edbm_ripsel_deselect_helper(BMesh *bm, const Span< EdgeLoopPair > eloop_pairs, ARegion *region, const blender::float4x4 &projectMat, const float fmval[2])
static BMEdge * edbm_ripsel_edge_uid_step(BMEdge *e_orig, BMVert **v_prev)
void MESH_OT_rip(wmOperatorType *ot)
static int edbm_rip_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static float edbm_rip_edgedist_squared(ARegion *region, const blender::float4x4 &mat, const float co1[3], const float co2[3], const float mvalf[2], const float inset)
bool EDBM_view3d_poll(bContext *C)
draw_view in_light_buf[] float
void *(* MEM_mallocN)(size_t len, const char *str)
size_t(* MEM_allocN_len)(const void *vmemh)
void MEM_freeN(void *vmemh)
T midpoint(const T &a, const T &b)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
struct BMLoop * radial_next
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
int(* invoke)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports