Two in one:
[blender.git] / source / blender / src / editmesh_mods.c
index c7b34068b3e2e200f6aa382d50c2391565ad4d6b..5944c77e045fe2aab415ac3ac2b226b7dad560d9 100644 (file)
@@ -102,6 +102,7 @@ editmesh_mods.c, UI level access, no geometry changes
 
 #include "RE_render_ext.h"  /* externtex */
 
+#include "multires.h"
 #include "mydevice.h"
 #include "blendef.h"
 
@@ -358,6 +359,14 @@ static void findnearestvert__doClosest(void *userData, EditVert *eve, int x, int
        }
 }
 
+
+
+
+static unsigned int findnearestvert__backbufIndextest(unsigned int index){
+               EditVert *eve = BLI_findlink(&G.editMesh->verts, index-1);
+               if(eve && (eve->f & SELECT)) return 0;
+               return 1; 
+}
 /**
  * findnearestvert
  * 
@@ -372,23 +381,23 @@ EditVert *findnearestvert(int *dist, short sel, short strict)
        short mval[2];
 
        getmouseco_areawin(mval);
-               
-       /**
-        *  FIXME
-        *  Strict bypasses the openGL select buffer
-        *  someone with more knowledge of this should fix it -- theeth
-        */
-       if(strict == 0 && G.vd->drawtype>OB_WIRE && (G.vd->flag & V3D_ZBUF_SELECT)) {
+       if(G.vd->drawtype>OB_WIRE && (G.vd->flag & V3D_ZBUF_SELECT)){
                int distance;
-               unsigned int index = sample_backbuf_rect(mval, 50, em_wireoffs, 0xFFFFFF, &distance);
-               EditVert *eve = BLI_findlink(&G.editMesh->verts, index-1);
-
-               if (eve && distance < *dist) {
+               unsigned int index;
+               EditVert *eve;
+               
+               if(strict) index = sample_backbuf_rect(mval, 50, em_wireoffs, 0xFFFFFF, &distance, strict, findnearestvert__backbufIndextest); 
+               else index = sample_backbuf_rect(mval, 50, em_wireoffs, 0xFFFFFF, &distance, 0, NULL); 
+               
+               eve = BLI_findlink(&G.editMesh->verts, index-1);
+               
+               if(eve && distance < *dist) {
                        *dist = distance;
                        return eve;
                } else {
                        return NULL;
                }
+                       
        }
        else {
                struct { short mval[2], pass, select, strict; int dist, lastIndex, closestIndex; EditVert *closest; } data;
@@ -483,7 +492,7 @@ EditEdge *findnearestedge(int *dist)
 
        if(G.vd->drawtype>OB_WIRE && (G.vd->flag & V3D_ZBUF_SELECT)) {
                int distance;
-               unsigned int index = sample_backbuf_rect(mval, 50, em_solidoffs, em_wireoffs, &distance);
+               unsigned int index = sample_backbuf_rect(mval, 50, em_solidoffs, em_wireoffs, &distance,0, NULL);
                EditEdge *eed = BLI_findlink(&G.editMesh->edges, index-1);
 
                if (eed && distance<*dist) {
@@ -2643,6 +2652,18 @@ void editmesh_mark_sharp(int set)
        allqueue(REDRAWVIEW3D, 0);
 }
 
+void BME_Menu()        {
+       short ret;
+       ret= pupmenu("BME modeller%t|Select Edges of Vert%x1");
+       
+       switch(ret)
+       {
+               case 1:
+               //BME_edges_of_vert();
+               break;
+       }
+}
+
 void Edge_Menu() {
        short ret;