Blender V5.3
editmesh_rip.cc File Reference
#include "MEM_guardedalloc.h"
#include "DNA_mesh_types.h"
#include "DNA_object_types.h"
#include "BLI_array.hh"
#include "BLI_math_geom_c.hh"
#include "BLI_math_vector.hh"
#include "BLI_math_vector_c.hh"
#include "BLI_span.hh"
#include "BLI_vector.hh"
#include "BKE_context.hh"
#include "BKE_editmesh.hh"
#include "BKE_layer.hh"
#include "BKE_report.hh"
#include "BLT_translation.hh"
#include "RNA_access.hh"
#include "RNA_define.hh"
#include "WM_types.hh"
#include "ED_mesh.hh"
#include "ED_transform.hh"
#include "ED_view3d.hh"
#include "bmesh.hh"
#include "bmesh_tools.hh"
#include "mesh_intern.hh"

Go to the source code of this file.

Classes

struct  blender::EdgeLoopPair
struct  blender::UnorderedLoopPair

Namespaces

namespace  blender
 BMesh Iterators.

Functions

Rip Far-Side De-Select
static BMEdge * blender::edbm_ripsel_edge_uid_step (BMEdge *e_orig, BMVert **v_prev)
static BMVert * blender::edbm_ripsel_edloop_pair_start_vert (BMEdge *e)
static void blender::edbm_ripsel_deselect_helper (BMesh *bm, const Span< EdgeLoopPair > eloop_pairs, ARegion *region, const float4x4 &projectMat, const float fmval[2])
Rip Vertex Implementation
static int blender::edbm_rip_invoke__vert (bContext *C, const wmEvent *event, Object *obedit, bool do_fill)
Rip Edge Implementation
static int blender::edbm_rip_invoke__edge (bContext *C, const wmEvent *event, Object *obedit, bool do_fill)
Rip Operator
static wmOperatorStatus blender::edbm_rip_invoke (bContext *C, wmOperator *op, const wmEvent *event)
void blender::MESH_OT_rip (wmOperatorType *ot)

Local Utilities

#define INSET_DEFAULT   0.00001f
static float blender::edbm_rip_edgedist_squared (ARegion *region, const float4x4 &mat, const float co1[3], const float co2[3], const float mvalf[2], const float inset)
static void blender::edbm_calc_loop_co (BMLoop *l, float l_mid_co[3])
static float blender::edbm_rip_edge_side_measure (BMEdge *e, BMLoop *e_l, ARegion *region, const float4x4 &projectMat, const float fmval[2])

Rip Selection Handling (advanced rip-select <tt>ripsel</tt> functions)

#define IS_VISIT_POSSIBLE(e)
#define IS_VISIT_DONE(e)
#define INVALID_UID   INT_MIN
static BMEdge * blender::edbm_ripsel_edge_mark_step (BMVert *v, const int uid)
static Vector< EdgeLoopPair > blender::edbm_ripsel_looptag_helper (BMesh *bm)

Rip Face-Fill code

enum  { blender::ULP_FLIP_0 = (1 << 0) , blender::ULP_FLIP_1 = (1 << 1) }
static Array< UnorderedLoopPair > blender::edbm_tagged_loop_pairs_to_fill (BMesh *bm)
static void blender::edbm_tagged_loop_pairs_do_fill_faces (BMesh *bm, const Span< UnorderedLoopPair > uloop_pairs)

Macro Definition Documentation

◆ INSET_DEFAULT

#define INSET_DEFAULT   0.00001f

helper to find edge for edge_rip,

Parameters
insetis used so we get some useful distance when comparing multiple edges that meet at the same point and would result in the same distance.

Definition at line 55 of file editmesh_rip.cc.

Referenced by blender::edbm_rip_invoke__vert().

◆ INVALID_UID

#define INVALID_UID   INT_MIN

Definition at line 197 of file editmesh_rip.cc.

Referenced by blender::edbm_ripsel_looptag_helper().

◆ IS_VISIT_DONE

#define IS_VISIT_DONE ( e)
Value:
((e)->l && (BM_elem_index_get((e)->l) != INVALID_UID))
#define BM_elem_index_get(ele)
#define INVALID_UID

Definition at line 196 of file editmesh_rip.cc.

Referenced by blender::edbm_ripsel_edge_mark_step(), and blender::edbm_ripsel_looptag_helper().

◆ IS_VISIT_POSSIBLE

#define IS_VISIT_POSSIBLE ( e)
Value:
(BM_edge_is_manifold(e) && BM_elem_flag_test(e, BM_ELEM_TAG))
#define BM_elem_flag_test(ele, hflag)

How rip selection works:

Firstly - rip is basically edge split with side-selection & grab. Things would be much more simple if we didn't have to worry about side selection

The method used for checking the side of selection is as follows...

  • First tag all rip-able edges.
  • Build a contiguous edge list by looping over tagged edges and following each one's tagged siblings in both directions.
    • The loops are not stored in an array. Instead both loops on either side of each edge has its index values set to count down from the last edge. This way once we have the 'last' edge it's very easy to walk down the connected edge loops. The reason for using loops like this is because when the edges are split we don't know which face user gets the newly created edge (it's as good as random so we can't assume new edges will be on one side). After splitting, it's very simple to walk along boundary loops since each only has one edge from a single side.
  • The end loop pairs are stored in an array however to support multiple edge-selection-islands, so you can rip multiple selections at once.
  • * Execute the split *
  • For each #EdgeLoopPair walk down both sides of the split using the loops and measure which is facing the mouse.
  • Deselect the edge loop facing away.

Limitation! This currently works very poorly with intersecting edge islands (verts with more than 2 tagged edges). This is nice to do but for now not essential.

  • campbell.

Definition at line 195 of file editmesh_rip.cc.

Referenced by blender::edbm_ripsel_edge_mark_step(), and blender::edbm_ripsel_looptag_helper().