Revision: 18231
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18231
Author:   joeedh
Date:     2009-01-02 00:45:56 +0100 (Fri, 02 Jan 2009)

Log Message:
-----------
disabled option added in last commit to not allocate a flag layer

Modified Paths:
--------------
    branches/bmesh/bmesh/bmesh_operators.h
    branches/bmesh/bmesh/intern/bmesh_operators.c
    branches/bmesh/bmesh/operators/subdivideop.c

Modified: branches/bmesh/bmesh/bmesh_operators.h
===================================================================
--- branches/bmesh/bmesh/bmesh_operators.h      2009-01-01 23:32:49 UTC (rev 
18230)
+++ branches/bmesh/bmesh/bmesh_operators.h      2009-01-01 23:45:56 UTC (rev 
18231)
@@ -69,7 +69,7 @@
 void BMO_Flag_Buffer(struct BMesh *bm, struct BMOperator *op, int slotcode, 
int flag);
 
 /*operator option flags*/
-#define NEEDFLAGS      1
+#define NEEDFLAGS      1 /*note: doesn't do anything*/
 
 /*--------------------begin operator defines------------------------*/
 /*split op*/

Modified: branches/bmesh/bmesh/intern/bmesh_operators.c
===================================================================
--- branches/bmesh/bmesh/intern/bmesh_operators.c       2009-01-01 23:32:49 UTC 
(rev 18230)
+++ branches/bmesh/bmesh/intern/bmesh_operators.c       2009-01-01 23:45:56 UTC 
(rev 18231)
@@ -48,7 +48,7 @@
        bm->currentop = op;
 
        /*add flag layer, if appropriate*/
-       if(bm->stackdepth > 1 && op->needflag)
+       if(bm->stackdepth > 1)
                alloc_flag_layer(bm);
 }
 
@@ -64,7 +64,7 @@
 void BMO_pop(BMesh *bm)
 {
        bm->stackdepth--;
-       if(bm->stackdepth > 1 && bm->currentop->needflag)
+       if(bm->stackdepth > 1)
                free_flag_layer(bm);
 }
 

Modified: branches/bmesh/bmesh/operators/subdivideop.c
===================================================================
--- branches/bmesh/bmesh/operators/subdivideop.c        2009-01-01 23:32:49 UTC 
(rev 18230)
+++ branches/bmesh/bmesh/operators/subdivideop.c        2009-01-01 23:45:56 UTC 
(rev 18231)
@@ -41,7 +41,15 @@
        int len; /*total number of verts*/
 } subdpattern;
 
+/*generic subdivision rules:
+  
+  * two selected edges in a face should make a link
+    between them.
 
+  * one edge should do, what? make pretty topology, or just
+    split the edge only?
+*/
+
 /*note: the patterns are rotated as necassary to
   match the input geometry.  they're also based on the
   post-splitted state of the faces.  note that
@@ -105,10 +113,74 @@
        6
 };
 
+/*
+      e3
+v4---------v3
+|          |
+|e4        | e2
+|          |
+|e0   e1   |
+v0---v1----v2
+
+connect v1 to v4 and v3
+
+*/
+subdpattern q_1edge = {
+       {1, 1, 0, 0, 0},
+       {-1, 3, -1, -1, 1},
+       NULL,
+       NULL,
+       5
+};
+
+/*
+      e4
+v5---------v4
+|          |
+|e5        | e3
+|          |v3
+|e0   e1   | e2
+v0---v1----v2
+
+connect v1 to v3
+
+*/
+subdpattern q_2adjedge = {
+       {1, 1, 1, 1, 0, 0},
+       {-1, 3, -1, -1, -1, -1},
+       NULL,
+       NULL,
+       6
+};
+
+
+/*
+   e4 v4 e3
+v5---------v3
+|          |
+|e5        |
+|          | e2
+|  e0   e1 |
+v0---v1----v2
+
+connect v1 to v4
+
+*/
+subdpattern q_2opedge = {
+       {1, 1, 0, 1, 1, 0},
+       {-1, 4, -1, -1, -1, -1},
+       NULL,
+       NULL,
+       6
+};
+
 subdpattern *patterns[] = {
        &t_1edge,
        &t_2edge,
        &t_3edge,
+       &q_1edge,
+       &q_2adjedge,
+       &q_2opedge,
 };
 
 #define PLEN   (sizeof(patterns) / sizeof(void*))
@@ -121,7 +193,7 @@
        BMOpSlot *einput;
        BMEdge *edge, *nedge, *edges[MAX_FACE];
        BMFace *face;
-       BMLoop *nl;
+       BMLoop *nl, *loop;
        BMVert *v1, *verts[MAX_FACE], *lastv;
        BMIter fiter, eiter;
        subdpattern *pat;
@@ -149,15 +221,17 @@
                                if (patterns[i]->len != face->len) continue;
                                lastv = NULL;
                                for (j=0; j<patterns[i]->len; j++) {
-                                       for (a=0, edge=BMIter_New(&eiter, 
bmesh, BM_EDGES_OF_FACE, face); edge; a++, edge=BMIter_Step(&eiter)) {
-                                               verts[a] = edge->v1 == lastv? 
edge->v2 : edge->v1;
+                                       for (a=0, loop=BMIter_New(&eiter, 
bmesh, BM_LOOPS_OF_FACE,face); loop; a++, loop=BMIter_Step(&eiter)) {
+                                               edge = loop->e;
+                                               verts[a] = loop->v;
                                                edges[a] = edge;
 
                                                b = (j + a) % patterns[i]->len;
-                                               if (!(patterns[i]->seledges[b] 
== BMOP_TestFlag(bmesh, edge, SUBD_SPLIT))) break;
+                                               if (!(patterns[i]->seledges[b] 
&& BMOP_TestFlag(bmesh, edge, SUBD_SPLIT))) break;
 
                                                lastv = verts[a];
                                        }
+
                                        if (a == face->len) {
                                                matched = 1;
                                                pat = patterns[i];
@@ -194,6 +268,7 @@
                                }
                        }
                } else { /*no match in the pattern*/
+                       /*this should do some sort of generic subdivision*/
                }
        }
 }
\ No newline at end of file


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to