Added Goofsters alt-m menu for merging verts while in edit mode menu.
authorKent Mein <mein@cs.umn.edu>
Fri, 21 Feb 2003 16:40:29 +0000 (16:40 +0000)
committerKent Mein <mein@cs.umn.edu>
Fri, 21 Feb 2003 16:40:29 +0000 (16:40 +0000)
Kent

source/blender/src/edit.c
source/blender/src/space.c

index ae29e73dc13e28b370b9461612db53ea3c207b0a..4e8ab5876512b739a33188f3f4562a318a595c99 100644 (file)
@@ -76,6 +76,8 @@
 #include "BIF_space.h"
 #include "BIF_editview.h"
 #include "BIF_glutil.h"
+#include "BIF_toolbox.h"
+#include "BIF_editmesh.h"
 
 #include "BSE_view.h"
 #include "BSE_edit.h"
@@ -836,3 +838,57 @@ void snapmenu()
                allqueue(REDRAWVIEW3D, 0);
        }
 }
+
+void mergemenu() {
+   extern TransVert *transvmain;
+   extern int tottrans;
+   extern float doublimit;
+   TransVert *tv;
+   float *curs, imat[3][3], bmat[3][3], vec[3];
+   int a;
+   short event;
+
+   event= pupmenu("MERGE %t|At Cursor%x1|Other Options Coming Soon!%x2");
+
+   curs= give_cursor();
+
+   if(event== 1 || event==2) {
+
+#ifdef __NLA
+      if ELEM5(G.obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, 
+          OB_CURVE) make_trans_verts(bmat[0], bmat[1], 0);
+#else
+      if ELEM4(G.obedit->type, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE) 
+          make_trans_verts(bmat[0], bmat[1], 0);
+#endif
+      if(tottrans==0) return;
+
+      Mat3CpyMat4(bmat, G.obedit->obmat);
+      Mat3Inv(imat, bmat);
+
+      tv= transvmain;
+      for(a=0; a<tottrans; a++, tv++) {
+
+         if(event==1 || event==2) { /*Move all to Cursor*/
+
+            vec[0]= curs[0]-G.obedit->obmat[3][0];
+            vec[1]= curs[1]-G.obedit->obmat[3][1];
+            vec[2]= curs[2]-G.obedit->obmat[3][2];
+         }
+         Mat3MulVecfl(imat, vec);
+         VECCOPY(tv->loc, vec);
+
+      }
+      MEM_freeN(transvmain);
+      transvmain= 0;
+
+      if ELEM(G.obedit->type, OB_SURF, OB_CURVE) makeDispList(G.obedit);
+
+      if (G.obedit->type == OB_ARMATURE) special_trans_update(0);
+
+      notice("Removed: %d\n", removedoublesflag(1, doublimit));
+      allqueue(REDRAWVIEW3D, 0);
+      return;
+   }
+}
+
index fb31d498a64f6baa8bd1996f9886a754aa83ef95..6ce12f4ca8e914f65a00db4fc0f1852a1e2acf09 100644 (file)
@@ -820,7 +820,9 @@ void winqread3d(unsigned short event, short val, char ascii)
                                }
                                break;
                        case MKEY:
-                               movetolayer();
+                               if((G.obedit) && (G.qual & LR_ALTKEY)) 
+                                       mergemenu();
+                               else movetolayer();
                                break;
                        case NKEY:
                                if(G.obedit) {