[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19310] branches/bmesh/blender/source/ blender: extrude region op now does wire vert extrudes too
Joseph Eagar
joeedh at gmail.com
Mon Mar 16 12:38:42 CET 2009
Revision: 19310
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19310
Author: joeedh
Date: 2009-03-16 12:38:42 +0100 (Mon, 16 Mar 2009)
Log Message:
-----------
extrude region op now does wire vert extrudes too
Modified Paths:
--------------
branches/bmesh/blender/source/blender/bmesh/bmesh_operator_api.h
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_polygon.c
branches/bmesh/blender/source/blender/bmesh/operators/bmesh_dupeops.c
branches/bmesh/blender/source/blender/bmesh/operators/extrudeops.c
branches/bmesh/blender/source/blender/editors/mesh/editmesh_lib.c
Modified: branches/bmesh/blender/source/blender/bmesh/bmesh_operator_api.h
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/bmesh_operator_api.h 2009-03-16 11:11:44 UTC (rev 19309)
+++ branches/bmesh/blender/source/blender/bmesh/bmesh_operator_api.h 2009-03-16 11:38:42 UTC (rev 19310)
@@ -259,6 +259,12 @@
for (; key; key=BMO_IterStep(&oiter)) {
val = BMO_IterMapVal(&oiter);
//do something with the key/val pair
+ //note that val is a pointer to the val data,
+ //whether it's a float, pointer, whatever.
+ //
+ // so to get a pointer, for example, use:
+ // *((void**)BMO_IterMapVal(&oiter));
+ //or something like that.
}
*/
Modified: branches/bmesh/blender/source/blender/bmesh/bmesh_operators.h
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/bmesh_operators.h 2009-03-16 11:11:44 UTC (rev 19309)
+++ branches/bmesh/blender/source/blender/bmesh/bmesh_operators.h 2009-03-16 11:38:42 UTC (rev 19310)
@@ -16,6 +16,7 @@
//bounding edges of split faces
BMOP_SPLIT_BOUNDS_EDGEMAP, /*boundarymap*/
+ BMOP_SPLIT_ISOLATED_VERTS_MAP, /*isovertmap*/
BMOP_SPLIT_TOTSLOT,
};
@@ -31,6 +32,7 @@
/*we need a map for verts duplicated not connected
to any faces, too.*/
BMOP_DUPE_BOUNDS_EDGEMAP, /*boundarymap*/
+ BMOP_DUPE_ISOLATED_VERTS_MAP, /*isovertmap*/
BMOP_DUPE_TOTSLOT
};
Modified: branches/bmesh/blender/source/blender/bmesh/intern/bmesh_opdefines.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/intern/bmesh_opdefines.c 2009-03-16 11:11:44 UTC (rev 19309)
+++ branches/bmesh/blender/source/blender/bmesh/intern/bmesh_opdefines.c 2009-03-16 11:38:42 UTC (rev 19310)
@@ -103,7 +103,8 @@
{{BMOP_OPSLOT_ELEMENT_BUF, "geom"},
{BMOP_OPSLOT_ELEMENT_BUF, "origout"},
{BMOP_OPSLOT_ELEMENT_BUF, "newout"},
- {BMOP_OPSLOT_MAPPING, "boundarymap"}},
+ {BMOP_OPSLOT_MAPPING, "boundarymap"},
+ {BMOP_OPSLOT_MAPPING, "isovertmap"}},
dupeop_exec,
BMOP_DUPE_TOTSLOT,
0
@@ -113,7 +114,8 @@
"split",
{{BMOP_OPSLOT_ELEMENT_BUF, "geom"},
{BMOP_OPSLOT_ELEMENT_BUF, "geomout"},
- {BMOP_OPSLOT_MAPPING, "boundarymap"}},
+ {BMOP_OPSLOT_MAPPING, "boundarymap"},
+ {BMOP_OPSLOT_MAPPING, "isovertmap"}},
splitop_exec,
BMOP_SPLIT_TOTSLOT,
0
Modified: branches/bmesh/blender/source/blender/bmesh/intern/bmesh_polygon.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/intern/bmesh_polygon.c 2009-03-16 11:11:44 UTC (rev 19309)
+++ branches/bmesh/blender/source/blender/bmesh/intern/bmesh_polygon.c 2009-03-16 11:38:42 UTC (rev 19310)
@@ -637,7 +637,6 @@
}
}
-#if 1
/*each pair of loops defines a new edge, a split. this function goes
through and sets pairs that are geometrically invalid to null. a
split is invalid, if it forms a concave angle or it intersects other
@@ -718,9 +717,6 @@
shrink_edgef(v1, v2, 1.00001f);
if (linecrossesf(p1, p2, mid, out)) clen++;
- //else if (linecrossesf(p2, p1, out, mid)) clen++;
- //else if (linecrossesf(p1, p2, out, mid)) clen++;
-
}
if (clen%2 == 0) {
@@ -764,4 +760,3 @@
if (projverts != projectverts) MEM_freeN(projverts);
if (edgeverts != edgevertsstack) MEM_freeN(edgeverts);
}
-#endif
Modified: branches/bmesh/blender/source/blender/bmesh/operators/bmesh_dupeops.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/operators/bmesh_dupeops.c 2009-03-16 11:11:44 UTC (rev 19309)
+++ branches/bmesh/blender/source/blender/bmesh/operators/bmesh_dupeops.c 2009-03-16 11:38:42 UTC (rev 19310)
@@ -147,7 +147,7 @@
static void copy_mesh(BMOperator *op, BMesh *source, BMesh *target)
{
- BMVert *v = NULL;
+ BMVert *v = NULL, *v2;
BMEdge *e = NULL, **edar = NULL;
BMLoop *l = NULL;
BMFace *f = NULL;
@@ -215,7 +215,9 @@
/*finally dupe all loose vertices*/
for(v = BMIter_New(&verts, source, BM_VERTS, source); v; v = BMIter_Step(&verts)){
if(BMO_TestFlag(source, (BMHeader*)v, DUPE_INPUT) && (!BMO_TestFlag(source, (BMHeader*)v, DUPE_DONE))){
- copy_vertex(source, v, target, vhash);
+ v2 = copy_vertex(source, v, target, vhash);
+ BMO_Insert_MapPointer(source, op,
+ BMOP_DUPE_ISOLATED_VERTS_MAP, v, v2);
BMO_SetFlag(source, (BMHeader*)v, DUPE_DONE);
}
}
@@ -390,7 +392,9 @@
BMO_CopySlot(&dupeop, splitop, BMOP_DUPE_NEW, BMOP_SPLIT_MULTOUT);
BMO_CopySlot(&dupeop, splitop, BMOP_DUPE_BOUNDS_EDGEMAP,
BMOP_SPLIT_BOUNDS_EDGEMAP);
-
+ BMO_CopySlot(&dupeop, splitop, BMOP_DUPE_ISOLATED_VERTS_MAP,
+ BMOP_SPLIT_ISOLATED_VERTS_MAP);
+
/*cleanup*/
BMO_Finish_Op(bm, &delop);
BMO_Finish_Op(bm, &dupeop);
Modified: branches/bmesh/blender/source/blender/bmesh/operators/extrudeops.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/operators/extrudeops.c 2009-03-16 11:11:44 UTC (rev 19309)
+++ branches/bmesh/blender/source/blender/bmesh/operators/extrudeops.c 2009-03-16 11:38:42 UTC (rev 19310)
@@ -19,9 +19,9 @@
BMOperator dupeop, delop;
BMOIter siter;
BMIter iter, fiter, viter;
- BMEdge *e, *newedge, *e2;
+ BMEdge *e, *newedge, *e2, *ce;
BMLoop *l, *l2;
- BMVert *verts[4], *v;
+ BMVert *verts[4], *v, *v2;
BMFace *f;
int rlen, found, delorig=0, i, reverse;
@@ -100,8 +100,10 @@
newedge = BMO_IterMapVal(&siter);
newedge = *(BMEdge**)newedge;
if (!newedge) continue;
+ if (!newedge->loop) ce = e;
+ else ce = newedge;
- if (newedge->loop->v == newedge->v1) {
+ if (ce->loop && (ce->loop->v == ce->v1)) {
verts[0] = e->v1;
verts[1] = e->v2;
verts[2] = newedge->v2;
@@ -150,7 +152,13 @@
}
}
-
+ /*link isolated verts*/
+ v = BMO_IterNew(&siter, bm, &dupeop, BMOP_DUPE_ISOLATED_VERTS_MAP);
+ for (; v; v=BMO_IterStep(&siter)) {
+ v2 = *((void**)BMO_IterMapVal(&siter));
+ BM_Make_Edge(bm, v, v2, v->edge, 1);
+ }
+
/*cleanup*/
if (delorig) BMO_Finish_Op(bm, &delop);
BMO_Finish_Op(bm, &dupeop);
Modified: branches/bmesh/blender/source/blender/editors/mesh/editmesh_lib.c
===================================================================
--- branches/bmesh/blender/source/blender/editors/mesh/editmesh_lib.c 2009-03-16 11:11:44 UTC (rev 19309)
+++ branches/bmesh/blender/source/blender/editors/mesh/editmesh_lib.c 2009-03-16 11:38:42 UTC (rev 19310)
@@ -1165,7 +1165,7 @@
BMO_Init_Op(&extop, BMOP_EXTRUDE_EDGECONTEXT);
BMO_HeaderFlag_To_Slot(bm, &extop, BMOP_EXFACE_EDGEFACEIN,
- flag, BM_EDGE|BM_FACE);
+ flag, BM_VERT|BM_EDGE|BM_FACE);
for (edge=BMIter_New(&iter, bm, BM_EDGES, NULL); edge; edge=BMIter_Step(&iter)) {
BM_Select_Edge(bm, edge, 0);
@@ -1802,10 +1802,23 @@
/* generic extrude */
short extrudeflag(Object *obedit, EditMesh *em, short flag, float *nor)
{
- if(em->selectmode & SCE_SELECT_VERTEX)
- return extrudeflag_vert(obedit, em, flag, nor);
- else
+ if(em->selectmode & SCE_SELECT_VERTEX) {
+ EditEdge *eed;
+
+ /*ensure vert flags are consistent for edge selections*/
+ for (eed=em->edges.first; eed; eed=eed->next) {
+ if (eed->f & flag) {
+ eed->v1->f |= flag;
+ eed->v2->f |= flag;
+ } else {
+ if ((eed->v1->f & flag) && (eed->v2->f & flag))
+ eed->f |= flag;
+ }
+ }
+
return extrudeflag_edge(obedit, em, flag, nor);
+ } else
+ return extrudeflag_edge(obedit, em, flag, nor);
}
More information about the Bf-blender-cvs
mailing list