55#define INSET_DEFAULT 0.00001f
68 const float dist_2d =
len_v2v2(vec1, vec2);
70 const float dist = inset / dist_2d;
84static float edbm_rip_linedist(
85 ARegion *region,
float mat[4][4],
const float co1[3],
const float co2[3],
const float mvalf[2])
87 float vec1[2], vec2[2];
114 float fmval_tweak[2];
195#define IS_VISIT_POSSIBLE(e) (BM_edge_is_manifold(e) && BM_elem_flag_test(e, BM_ELEM_TAG))
196#define IS_VISIT_DONE(e) ((e)->l && (BM_elem_index_get((e)->l) != INVALID_UID))
197#define INVALID_UID INT_MIN
265 if (e_first ==
nullptr) {
271 v_step = e_first->
v1;
289 v_step = e_first->
v1;
310 printf(
"%s: found contiguous edge loop of (%d)\n", __func__, uid_end - uid_start);
350 const float fmval[2])
356 float score_a = 0.0f;
357 float score_b = 0.0f;
370 e = (score_a > score_b) ? lp.l_a->
e : lp.l_b->e;
443 if ((ulp.l_pair[0] && ulp.l_pair[1]) && (ulp.l_pair[0]->e != ulp.l_pair[1]->e)) {
446 BMFace *f, *f_example = ulp.l_pair[0]->f;
450 if (v_shared ==
nullptr) {
452 f_verts[0] = ulp.l_pair[0]->
e->
v1;
453 f_verts[1] = ulp.l_pair[1]->
e->
v1;
454 f_verts[2] = ulp.l_pair[1]->
e->
v2;
455 f_verts[3] = ulp.l_pair[0]->
e->
v2;
458 std::swap(f_verts[0], f_verts[3]);
461 std::swap(f_verts[1], f_verts[2]);
466 f_verts[0] = v_shared;
469 f_verts[3] =
nullptr;
472 if (v_shared == ulp.l_pair[0]->v) {
473 std::swap(f_verts[0], f_verts[1]);
486 l_iter = l_iter->
next;
488 l_iter = l_iter->
next;
490 l_iter = l_iter->
next;
495 l_iter = l_iter->
next;
497 l_iter = l_iter->
next;
528 bool is_wire, is_manifold_region;
531 int totboundary_edge = 0;
550 if ((
v ==
nullptr) || (
v->
e ==
nullptr)) {
570 if ((e_best ==
nullptr) || (d < dist_sq)) {
579 if (e_best && e_best->
l && (is_manifold_region ==
false)) {
614 for (i1 = 0; i1 < 3; i1++) {
621 if ((e_best ==
nullptr) || (d < dist_sq)) {
626 for (i2 = 0; i2 < 3; i2++) {
644 if ((is_wire ==
false && totboundary_edge > 2) || (is_wire ==
true && totboundary_edge > 1)) {
670 for (i = 0; i < vout_len; i++) {
714 std::swap(vout[0], vout[vi_best]);
728 for (i = 2; i < vout_len; i++) {
776 l_iter = l_first = e_best->
l;
784 if (larr[larr_len]->
e == e_best) {
792 }
while ((l_iter = l_iter->
radial_next) != l_first);
823 float l_corner_co[3];
838 if ((v_best ==
nullptr) || (d < dist_sq)) {
854 if (do_fill && !fill_uloop_pairs.
is_empty()) {
897 int totedge_manifold;
902 totedge_manifold = 0;
921 all_manifold =
false;
926 if (i == 1 && e_best->
l) {
930 if (
ELEM(totedge_manifold, 4, 3) || (all_manifold ==
false)) {
947 if (totedge_manifold != 3) {
985 if (do_fill && !fill_uloop_pairs.
is_empty()) {
1014 bool no_vertex_selected =
true;
1015 bool error_face_selected =
true;
1016 bool error_disconnected_vertices =
true;
1017 bool error_rip_failed =
true;
1019 for (
Object *obedit : objects) {
1029 no_vertex_selected =
false;
1039 error_face_selected =
false;
1045 error_disconnected_vertices =
false;
1083 error_rip_failed =
false;
1089 EDBM_update(id_cast<Mesh *>(obedit->data), ¶ms);
1092 if (no_vertex_selected) {
1096 if (error_face_selected) {
1100 if (error_disconnected_vertices) {
1104 if (error_rip_failed) {
1118 ot->
idname =
"MESH_OT_rip";
1119 ot->
description =
"Disconnect vertices or edges from connected geometry";
#define BLT_I18NCONTEXT_ID_MESH
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define UNUSED_VARS_NDEBUG(...)
#define BM_FACE_FIRST_LOOP(p)
#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)
#define BM_ITER_ELEM(ele, iter, data, itype)
#define BM_ITER_MESH(ele, iter, bm, itype)
#define BM_select_history_store(bm, ele)
#define BM_select_history_remove(bm, ele)
#define BM_vert_edge_count_is_equal(v, n)
#define BM_vert_face_count_is_equal(v, n)
void append(const T &value)
#define IS_VISIT_POSSIBLE(e)
T midpoint(const T &a, const T &b)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
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)
BLI_INLINE bool BM_edge_is_wire(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BMVert * BM_face_loop_separate_multi(BMesh *bm, BMLoop **larr, int larr_len)
static BMVert * edbm_ripsel_edloop_pair_start_vert(BMEdge *e)
BMesh * BKE_editmesh_bmesh_get_for_write(Mesh *mesh)
ATTR_WARN_UNUSED_RESULT const BMLoop * l
bool EDBM_view3d_poll(bContext *C)
bool BM_vert_is_wire(const BMVert *v)
float4x4 ED_view3d_ob_project_mat_get(const RegionView3D *rv3d, const Object *ob)
BMVert * BM_edge_share_vert(BMEdge *e1, BMEdge *e2)
void EDBM_update(Mesh *mesh, const EDBMUpdate_Params *params)
MINLINE float normalize_v2_length(float n[2], float unit_length)
BMLoop * BM_edge_vert_share_loop(BMLoop *l, BMVert *v)
Return the Loop Shared by Edge and Vert.
void BM_custom_loop_normals_from_vector_layer(BMesh *bm, bool add_sharp_edges)
float2 ED_view3d_project_float_v2_m4(const ARegion *region, const float co[3], const float4x4 &mat)
static void edbm_ripsel_deselect_helper(BMesh *bm, const Span< EdgeLoopPair > eloop_pairs, ARegion *region, const float4x4 &projectMat, const float fmval[2])
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
BMLoop * BM_face_other_vert_loop(BMFace *f, BMVert *v_prev, BMVert *v)
Other Loop in Face Sharing a Vertex.
ATTR_WARN_UNUSED_RESULT const BMVert * v
MatBase< float, 4, 4 > float4x4
BLI_INLINE bool BM_edge_is_manifold(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
static void edbm_calc_loop_co(BMLoop *l, float l_mid_co[3])
float BM_edge_calc_length(const BMEdge *e)
BLI_INLINE bool BM_vert_in_edge(const BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE BMVert * BM_edge_other_vert(BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
ViewLayer * CTX_data_view_layer(const bContext *C)
void BM_loop_calc_face_tangent(const BMLoop *l, float r_tangent[3])
BM_loop_calc_face_tangent.
MINLINE void mul_v3_fl(float r[3], float f)
BLI_INLINE bool BM_edge_in_loop(const BMEdge *e, const BMLoop *l) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
float dist_squared_to_line_segment_v2(const float p[2], const float l1[2], const float l2[2])
void BM_mesh_select_mode_clean_ex(BMesh *bm, const short selectmode)
Select Mode Clean.
VecBase< float, 2 > float2
static float edbm_rip_edgedist_squared(ARegion *region, const float4x4 &mat, const float co1[3], const float co2[3], const float mvalf[2], const float inset)
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])
void bmesh_kernel_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len, const bool copy_select)
Separate Vert.
static Array< UnorderedLoopPair > edbm_tagged_loop_pairs_to_fill(BMesh *bm)
ATTR_WARN_UNUSED_RESULT const BMLoop * l_b
BMLoop * BM_vert_find_first_loop(BMVert *v)
bool BM_vert_splice(BMesh *bm, BMVert *v_dst, BMVert *v_src)
Splice Vert.
BLI_INLINE bool BM_edge_is_boundary(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
static int edbm_rip_invoke__edge(bContext *C, const wmEvent *event, Object *obedit, bool do_fill)
RegionView3D * CTX_wm_region_view3d(const bContext *C)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
BMLoop * BM_edge_other_loop(BMEdge *e, BMLoop *l)
void BM_vert_select_set(BMesh *bm, BMVert *v, const bool select)
Select Vert.
void BM_select_history_validate(BMesh *bm)
BMFace * BM_face_exists(BMVert *const *varr, int len)
static void edbm_tagged_loop_pairs_do_fill_faces(BMesh *bm, const Span< UnorderedLoopPair > uloop_pairs)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
MINLINE void add_v3_v3(float r[3], const float a[3])
bool BM_edge_loop_pair(BMEdge *e, BMLoop **r_la, BMLoop **r_lb)
void mid_v3_v3v3(float r[3], const float a[3], const float b[3])
static BMEdge * edbm_ripsel_edge_mark_step(BMVert *v, const int uid)
Main * CTX_data_main(const bContext *C)
static float edbm_rip_edge_side_measure(BMEdge *e, BMLoop *e_l, ARegion *region, const float4x4 &projectMat, const float fmval[2])
void interp_v2_v2v2(float r[2], const float a[2], const float b[2], float t)
bool BM_vert_is_manifold_region(const BMVert *v)
BMEdge * BM_vert_other_disk_edge(BMVert *v, BMEdge *e_first)
MINLINE float len_v2v2(const float v1[2], const float v2[2]) ATTR_WARN_UNUSED_RESULT
static BMEdge * edbm_ripsel_edge_uid_step(BMEdge *e_orig, BMVert **v_prev)
void BM_mesh_edgesplit(BMesh *bm, const bool use_verts, const bool tag_only, const bool copy_select)
Vector< Object * > BKE_view_layer_array_from_objects_in_edit_mode_unique_data(const Main &bmain, const Scene *scene, ViewLayer *view_layer, const View3D *v3d)
Scene * CTX_data_scene(const bContext *C)
@ OPTYPE_DEPENDS_ON_CURSOR
static int edbm_rip_invoke__vert(bContext *C, const wmEvent *event, Object *obedit, bool do_fill)
void BM_elem_attrs_copy(BMesh *bm, const BMCustomDataCopyMap &map, const BMVert *src, BMVert *dst)
VecBase< float, 3 > float3
BMVert * BM_face_loop_separate_multi_isolated(BMesh *bm, BMLoop *l_sep)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
bool BM_select_history_active_get(BMesh *bm, BMEditSelection *ese)
void MESH_OT_rip(wmOperatorType *ot)
bool BM_custom_loop_normals_to_vector_layer(BMesh *bm)
ARegion * CTX_wm_region(const bContext *C)
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.
int BM_iter_as_array(BMesh *bm, const char itype, void *data, void **array, const int len)
Iterator as Array.
static wmOperatorStatus edbm_rip_invoke(bContext *C, wmOperator *op, const wmEvent *event)
View3D * CTX_wm_view3d(const bContext *C)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
static Vector< EdgeLoopPair > edbm_ripsel_looptag_helper(BMesh *bm)
BMLoop * BM_loop_other_edge_loop(BMLoop *l, BMVert *v)
void BM_edge_select_set(BMesh *bm, BMEdge *e, const bool select)
Select Edge.
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
struct BMLoop * radial_next
struct BMLoop * radial_next
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports