From 4b6bc29bf27c49f3545eac13d922d1ef03c655a7 Mon Sep 17 00:00:00 2001 From: Martin Poirier Date: Wed, 31 Dec 2003 22:44:26 +0000 Subject: Some random small stuff packed in one commit: - Moved a couple of undo_push_mesh after the action has been confirmed (mainly bevel, merge and mirror) - Split mirror in two functions, interface and functionality - Simplified the code of the merge function --- source/blender/src/edit.c | 24 ++++++++++-------------- source/blender/src/editmesh.c | 6 +++++- source/blender/src/editobject.c | 30 +++++++++++++++++++----------- source/blender/src/space.c | 10 +--------- 4 files changed, 35 insertions(+), 35 deletions(-) (limited to 'source') diff --git a/source/blender/src/edit.c b/source/blender/src/edit.c index 998f92f947c..a5360e65be4 100644 --- a/source/blender/src/edit.c +++ b/source/blender/src/edit.c @@ -1180,22 +1180,18 @@ void mergemenu(void) event = pupmenu("MERGE %t|At Center%x1|At Cursor%x2"); - switch (event) { + if (event==-1) return; /* Return if the menu is closed without any choices */ - case 1: /*Merge at center of selection*/ - snap_to_center(); - notice("Removed: %d", removedoublesflag(1, doublimit)); - allqueue(REDRAWVIEW3D, 0); - countall(); - break; - case 2: /*Merge at Cursor*/ - snap_sel_to_curs(); - notice("Removed: %d", removedoublesflag(1, doublimit)); - allqueue(REDRAWVIEW3D, 0); - countall(); - break; - } + undo_push_mesh("Merge"); /* The action has been confirmed, push the mesh down the undo pipe */ + + if (event==1) + snap_to_center(); /*Merge at Center*/ + else + snap_sel_to_curs(); /*Merge at Cursor*/ + notice("Removed: %d", removedoublesflag(1, doublimit)); + allqueue(REDRAWVIEW3D, 0); + countall(); } void delete_context_selected(void) { diff --git a/source/blender/src/editmesh.c b/source/blender/src/editmesh.c index cd7587f9ba7..53e8a0a80f0 100644 --- a/source/blender/src/editmesh.c +++ b/source/blender/src/editmesh.c @@ -7742,6 +7742,7 @@ void undo_menu_mesh(void) } /******************* BEVEL CODE STARTS HERE ********************/ + void bevel_displace_vec(float *midvec, float *v1, float *v2, float *v3, float d, float no[3]) { float a[3], c[3], n_a[3], n_c[3], mid[3], ac, ac2, fac; @@ -8147,7 +8148,9 @@ void bevel_mesh(float bsize, int allfaces) /* tag all faces for shrink*/ evl= G.edvl.first; while (evl) { - if (vlakselectedAND(evl, 1)||allfaces) evl->f1= 2; + if (vlakselectedAND(evl, 1)||allfaces) { + evl->f1= 2; + } evl= evl->next; } @@ -8524,6 +8527,7 @@ void bevel_menu() } } if (Canceled==0) { + undo_push_mesh("Bevel"); bevel_mesh_recurs(drawd/fac, recurs, 1); righthandfaces(1); } diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c index 47f20c4474f..6db681d9d9f 100644 --- a/source/blender/src/editobject.c +++ b/source/blender/src/editobject.c @@ -1577,7 +1577,6 @@ void special_editmenu(void) subdivideflag(1, 0.0, editbutflag | B_SMOOTH); break; case 4: - undo_push_mesh("Merge"); mergemenu(); break; case 5: @@ -1602,7 +1601,6 @@ void special_editmenu(void) vertexsmooth(); break; case 11: - undo_push_mesh("Bevel"); bevel_menu(); break; } @@ -6751,19 +6749,14 @@ void make_displists_by_obdata(void *obdata) { /* ******************************************************************** */ /* Mirror function in Edit Mode */ - -void mirrormenu(void){ - short mode = 0, axis, a; +void mirror(short mode) { + short axis, a; float mat[3][3], imat[3][3], min[3], max[3]; TransVert *tv; - mode=pupmenu("Mirror Axis %t|Global X%x1| Y%x2| Z%x3|Local X%x4| Y%x5| Z%x6|View X%x7| Y%x8| Z%x9|"); - - if (G.obedit==0) return; - if (mode==-1) return; make_trans_verts(min, max, 0); Mat3CpyMat4(mat, G.obedit->obmat); - // Inverting the matrix explicitly, since a 4x4 inverse is not always the same + // Inverting the matrix explicitly, since the inverse is not always correct (then why the heck are we keeping it!) Mat3Inv(imat, mat); tv = transvmain; @@ -6832,7 +6825,7 @@ void mirrormenu(void){ float viewmat[3][3], iviewmat[3][3]; Mat3CpyMat4(viewmat, G.vd->viewmat); - // Inverting the matrix explicitly, since a 4x4 inverse is not always the same + // Inverting the matrix explicitly Mat3Inv(iviewmat, viewmat); // axis is mode with an offset @@ -6883,3 +6876,18 @@ void mirrormenu(void){ tottrans= 0; } + +void mirrormenu(void){ + short mode = 0; + + if (G.obedit==0) return; + + mode=pupmenu("Mirror Axis %t|Global X%x1| Y%x2| Z%x3|Local X%x4| Y%x5| Z%x6|View X%x7| Y%x8| Z%x9|"); + + if (mode==-1) return; /* return */ + + if(G.obedit->type==OB_MESH) undo_push_mesh("Mirror"); /* If it's a mesh, push it down the undo pipe */ + + mirror(mode); /* separating functionality from interface | call*/ +} + diff --git a/source/blender/src/space.c b/source/blender/src/space.c index 14ddb05dfaf..0c89457a469 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -1130,20 +1130,12 @@ void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) if(G.obedit){ if(G.qual==LR_ALTKEY) { if(G.obedit->type==OB_MESH) { - undo_push_mesh("Merge"); mergemenu(); - makeDispList(G.obedit); } } else if((G.qual==0)) { - if(G.obedit->type==OB_MESH) { - undo_push_mesh("Mirror"); - mirrormenu(); - } - else { - mirrormenu(); - } + mirrormenu(); } } else if((G.qual==0)){ -- cgit v1.2.3