[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19156] branches/bmesh/blender/source/ blender: coded little vert connect tool.

Joseph Eagar joeedh at gmail.com
Sun Mar 1 09:03:10 CET 2009


Revision: 19156
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19156
Author:   joeedh
Date:     2009-03-01 09:02:28 +0100 (Sun, 01 Mar 2009)

Log Message:
-----------
coded little vert connect tool.  connects selected verts within the same face.  currently integrated with fkey, along with the simple face merge tool I made too.

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/bmesh/bmesh_operators.h
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_opdefines.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_operators_private.h
    branches/bmesh/blender/source/blender/bmesh/operators/dissolveops.c
    branches/bmesh/blender/source/blender/editors/mesh/editmesh_add.c
    branches/bmesh/blender/source/blender/editors/mesh/editmesh_tools.c

Modified: branches/bmesh/blender/source/blender/bmesh/bmesh_operators.h
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/bmesh_operators.h	2009-03-01 06:47:11 UTC (rev 19155)
+++ branches/bmesh/blender/source/blender/bmesh/bmesh_operators.h	2009-03-01 08:02:28 UTC (rev 19156)
@@ -151,11 +151,13 @@
 /*error messages*/
 #define BMERR_SELF_INTERSECTING			1
 #define BMERR_DISSOLVEDISK_FAILED		2
+#define BMERR_CONNECTVERT_FAILED		3
 
 static char *bmop_error_messages[] = {
        0,
        "Self intersection error",
        "Could not dissolve vert",
+       "Could not connect verts",
 };
 
 /*------------begin operator defines (see bmesh_opdefines.c too)------------*/
@@ -286,9 +288,15 @@
 	BMOP_EXFACE_TOTSLOT,
 };
 
+#define BMOP_CONNECT_VERTS		11
+enum {
+	BM_CONVERTS_VERTIN,
+	BM_CONVERTS_EDGEOUT,
+	BM_CONVERTS_TOTSLOT
+};
 
 /*keep this updated!*/
-#define BMOP_TOTAL_OPS			11
+#define BMOP_TOTAL_OPS			12
 /*-------------------------------end operator defines-------------------------------*/
 
 extern BMOpDefine *opdefines[];
@@ -307,6 +315,10 @@
 void BM_esubdivideflag(struct Object *obedit, struct BMesh *bm, int selflag, float rad, 
 	       int flag, int numcuts, int seltype);
 void BM_extrudefaceflag(BMesh *bm, int flag);
+
+/*these next two return 1 if they did anything, or zero otherwise.*/
 int BM_DissolveFaces(struct EditMesh *em, int flag);
+/*this doesn't display errors to the user, btw*/
+int BM_ConnectVerts(struct EditMesh *em, int flag);
 
 #endif

Modified: branches/bmesh/blender/source/blender/bmesh/intern/bmesh_opdefines.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/intern/bmesh_opdefines.c	2009-03-01 06:47:11 UTC (rev 19155)
+++ branches/bmesh/blender/source/blender/bmesh/intern/bmesh_opdefines.c	2009-03-01 08:02:28 UTC (rev 19156)
@@ -3,6 +3,14 @@
 
 #include <stdio.h>
 
+BMOpDefine def_connectverts = {
+	{BMOP_OPSLOT_PNT_BUF,
+	 BMOP_OPSLOT_PNT_BUF},
+	connectverts_exec,
+	BM_CONVERTS_TOTSLOT,
+	0
+};
+
 BMOpDefine def_extrudefaceregion = {
 	{BMOP_OPSLOT_PNT_BUF,
 	 BMOP_OPSLOT_MAPPING,
@@ -108,6 +116,7 @@
 	&def_dissolvevertsop,
 	&def_makefgonsop,
 	&def_extrudefaceregion,
+	&def_connectverts,
 };
 
 int bmesh_total_ops = (sizeof(opdefines) / sizeof(void*));

Modified: branches/bmesh/blender/source/blender/bmesh/intern/bmesh_operators_private.h
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/intern/bmesh_operators_private.h	2009-03-01 06:47:11 UTC (rev 19155)
+++ branches/bmesh/blender/source/blender/bmesh/intern/bmesh_operators_private.h	2009-03-01 08:02:28 UTC (rev 19156)
@@ -18,5 +18,6 @@
 void dissolveverts_exec(BMesh *bmesh, BMOperator *op);
 void bmesh_make_fgons_exec(BMesh *bmesh, BMOperator *op);
 void extrude_edge_context_exec(BMesh *bm, BMOperator *op);
+void connectverts_exec(BMesh *bm, BMOperator *op);
 
 #endif

Modified: branches/bmesh/blender/source/blender/bmesh/operators/dissolveops.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/operators/dissolveops.c	2009-03-01 06:47:11 UTC (rev 19155)
+++ branches/bmesh/blender/source/blender/bmesh/operators/dissolveops.c	2009-03-01 08:02:28 UTC (rev 19156)
@@ -10,7 +10,6 @@
 #include <stdio.h>
 
 #define FACE_MARK	1
-
 #define VERT_MARK	1
 
 void dissolvefaces_exec(BMesh *bm, BMOperator *op)

Modified: branches/bmesh/blender/source/blender/editors/mesh/editmesh_add.c
===================================================================
--- branches/bmesh/blender/source/blender/editors/mesh/editmesh_add.c	2009-03-01 06:47:11 UTC (rev 19155)
+++ branches/bmesh/blender/source/blender/editors/mesh/editmesh_add.c	2009-03-01 08:02:28 UTC (rev 19156)
@@ -668,7 +668,12 @@
 	EditEdge *eed;
 	EditFace *efa;
 	short amount=0;
-		
+	
+	if (em->selectmode & SCE_SELECT_VERTEX) {
+		/*return if bmesh vert connect does anything.*/
+		if (BM_ConnectVerts(em, BM_SELECT)) return;
+	}
+
 	if (em->selectmode & SCE_SELECT_FACE) {
 		/*return if bmesh face dissolve finds stuff to
 		  dissolve.*/

Modified: branches/bmesh/blender/source/blender/editors/mesh/editmesh_tools.c
===================================================================
--- branches/bmesh/blender/source/blender/editors/mesh/editmesh_tools.c	2009-03-01 06:47:11 UTC (rev 19155)
+++ branches/bmesh/blender/source/blender/editors/mesh/editmesh_tools.c	2009-03-01 08:02:28 UTC (rev 19156)
@@ -2353,7 +2353,7 @@
 	MEM_freeN(innerverts);
 }
 
-//Next two fill types are for knife exact only and are provided to allow for knifing through vertices
+//Next two fill types are for   exact only and are provided to allow for knifing through vertices
 //This means there is no multicut!
 static void fill_quad_doublevert(EditMesh *em, EditFace *efa, int v1, int v2)
 {





More information about the Bf-blender-cvs mailing list