[Bf-blender-cvs] [7bca8be] master: BMesh: improve docs for BM_edge_split

Campbell Barton noreply at git.blender.org
Wed Aug 20 04:50:03 CEST 2014


Commit: 7bca8be24da2fa7db26c0e83c6df853a0a2d2876
Author: Campbell Barton
Date:   Wed Aug 20 12:33:24 2014 +1000
Branches: master
https://developer.blender.org/rB7bca8be24da2fa7db26c0e83c6df853a0a2d2876

BMesh: improve docs for BM_edge_split

===================================================================

M	source/blender/bmesh/intern/bmesh_mods.c

===================================================================

diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c
index a0fa659..56f380b 100644
--- a/source/blender/bmesh/intern/bmesh_mods.c
+++ b/source/blender/bmesh/intern/bmesh_mods.c
@@ -1135,22 +1135,32 @@ BMEdge *BM_vert_collapse_edge(BMesh *bm, BMEdge *e_kill, BMVert *v_kill,
 /**
  * \brief Edge Split
  *
- * Splits an edge. \a v should be one of the vertices in \a e and defines
- * the "from" end of the splitting operation: the new vertex will be
- * \a percent of the way from \a v to the other end.
- * The newly created edge is attached to \a v and is returned in \a r_e.
- * The original edge \a e will be the other half of the split.
+ * <pre>
+ * Before: v
+ *         +-----------------------------------+
+ *                           e
+ *
+ * After:  v                 v_new (returned)
+ *         +-----------------+-----------------+
+ *                 r_e                e
+ * </pre>
  *
- * \return The new vert
+ * \param e  The edge to split.
+ * \param v  One of the vertices in \a e and defines the the "from" end of the splitting operation,
+ * the new vertex will be \a fac of the way from \a v to the other end.
+ * \param r_e  The newly created edge.
+ * \return  The new vertex.
  */
-BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float percent)
+BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float fac)
 {
-	BMVert *v_new, *v2;
+	BMVert *v_new, *v_other;
 	BMFace **oldfaces = NULL;
 	BMEdge *e_dummy;
 	BLI_array_staticdeclare(oldfaces, 32);
 	const bool do_mdisp = (e->l && CustomData_has_layer(&bm->ldata, CD_MDISPS));
 
+	BLI_assert(BM_vert_in_edge(e, v) == true);
+
 	/* we need this for handling multi-res */
 	if (!r_e) {
 		r_e = &e_dummy;
@@ -1175,22 +1185,22 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float perce
 		}
 	}
 
-	v2 = BM_edge_other_vert(e, v);
+	v_other = BM_edge_other_vert(e, v);
 	v_new = bmesh_semv(bm, v, e, r_e);
 
 	BLI_assert(v_new != NULL);
+	BLI_assert(BM_vert_in_edge(*r_e, v) && BM_vert_in_edge(*r_e, v_new));
+	BLI_assert(BM_vert_in_edge(e, v_new) && BM_vert_in_edge(e, v_other));
 
-	sub_v3_v3v3(v_new->co, v2->co, v->co);
-	madd_v3_v3v3fl(v_new->co, v->co, v_new->co, percent);
+	sub_v3_v3v3(v_new->co, v_other->co, v->co);
+	madd_v3_v3v3fl(v_new->co, v->co, v_new->co, fac);
 
-	if (r_e) {
-		(*r_e)->head.hflag = e->head.hflag;
-		BM_elem_attrs_copy(bm, bm, e, *r_e);
-	}
+	(*r_e)->head.hflag = e->head.hflag;
+	BM_elem_attrs_copy(bm, bm, e, *r_e);
 
 	/* v->v_new->v2 */
-	BM_data_interp_face_vert_edge(bm, v2, v, v_new, e, percent);
-	BM_data_interp_from_verts(bm, v, v2, v_new, percent);
+	BM_data_interp_face_vert_edge(bm, v_other, v, v_new, e, fac);
+	BM_data_interp_from_verts(bm, v, v_other, v_new, fac);
 
 	if (do_mdisp) {
 		int i, j;




More information about the Bf-blender-cvs mailing list