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
This commit is contained in:
@@ -1180,22 +1180,18 @@ void mergemenu(void)
|
|||||||
|
|
||||||
event = pupmenu("MERGE %t|At Center%x1|At Cursor%x2");
|
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 */
|
||||||
|
|
||||||
|
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*/
|
||||||
|
|
||||||
case 1: /*Merge at center of selection*/
|
|
||||||
snap_to_center();
|
|
||||||
notice("Removed: %d", removedoublesflag(1, doublimit));
|
notice("Removed: %d", removedoublesflag(1, doublimit));
|
||||||
allqueue(REDRAWVIEW3D, 0);
|
allqueue(REDRAWVIEW3D, 0);
|
||||||
countall();
|
countall();
|
||||||
break;
|
|
||||||
case 2: /*Merge at Cursor*/
|
|
||||||
snap_sel_to_curs();
|
|
||||||
notice("Removed: %d", removedoublesflag(1, doublimit));
|
|
||||||
allqueue(REDRAWVIEW3D, 0);
|
|
||||||
countall();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void delete_context_selected(void) {
|
void delete_context_selected(void) {
|
||||||
|
|||||||
@@ -7742,6 +7742,7 @@ void undo_menu_mesh(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/******************* BEVEL CODE STARTS HERE ********************/
|
/******************* BEVEL CODE STARTS HERE ********************/
|
||||||
|
|
||||||
void bevel_displace_vec(float *midvec, float *v1, float *v2, float *v3, float d, float no[3])
|
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;
|
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*/
|
/* tag all faces for shrink*/
|
||||||
evl= G.edvl.first;
|
evl= G.edvl.first;
|
||||||
while (evl) {
|
while (evl) {
|
||||||
if (vlakselectedAND(evl, 1)||allfaces) evl->f1= 2;
|
if (vlakselectedAND(evl, 1)||allfaces) {
|
||||||
|
evl->f1= 2;
|
||||||
|
}
|
||||||
evl= evl->next;
|
evl= evl->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8524,6 +8527,7 @@ void bevel_menu()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Canceled==0) {
|
if (Canceled==0) {
|
||||||
|
undo_push_mesh("Bevel");
|
||||||
bevel_mesh_recurs(drawd/fac, recurs, 1);
|
bevel_mesh_recurs(drawd/fac, recurs, 1);
|
||||||
righthandfaces(1);
|
righthandfaces(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1577,7 +1577,6 @@ void special_editmenu(void)
|
|||||||
subdivideflag(1, 0.0, editbutflag | B_SMOOTH);
|
subdivideflag(1, 0.0, editbutflag | B_SMOOTH);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
undo_push_mesh("Merge");
|
|
||||||
mergemenu();
|
mergemenu();
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
@@ -1602,7 +1601,6 @@ void special_editmenu(void)
|
|||||||
vertexsmooth();
|
vertexsmooth();
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
undo_push_mesh("Bevel");
|
|
||||||
bevel_menu();
|
bevel_menu();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -6751,19 +6749,14 @@ void make_displists_by_obdata(void *obdata) {
|
|||||||
/* ******************************************************************** */
|
/* ******************************************************************** */
|
||||||
/* Mirror function in Edit Mode */
|
/* Mirror function in Edit Mode */
|
||||||
|
|
||||||
|
void mirror(short mode) {
|
||||||
void mirrormenu(void){
|
short axis, a;
|
||||||
short mode = 0, axis, a;
|
|
||||||
float mat[3][3], imat[3][3], min[3], max[3];
|
float mat[3][3], imat[3][3], min[3], max[3];
|
||||||
TransVert *tv;
|
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);
|
make_trans_verts(min, max, 0);
|
||||||
Mat3CpyMat4(mat, G.obedit->obmat);
|
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);
|
Mat3Inv(imat, mat);
|
||||||
|
|
||||||
tv = transvmain;
|
tv = transvmain;
|
||||||
@@ -6832,7 +6825,7 @@ void mirrormenu(void){
|
|||||||
float viewmat[3][3], iviewmat[3][3];
|
float viewmat[3][3], iviewmat[3][3];
|
||||||
|
|
||||||
Mat3CpyMat4(viewmat, G.vd->viewmat);
|
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);
|
Mat3Inv(iviewmat, viewmat);
|
||||||
|
|
||||||
// axis is mode with an offset
|
// axis is mode with an offset
|
||||||
@@ -6883,3 +6876,18 @@ void mirrormenu(void){
|
|||||||
|
|
||||||
tottrans= 0;
|
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*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1130,21 +1130,13 @@ void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
|
|||||||
if(G.obedit){
|
if(G.obedit){
|
||||||
if(G.qual==LR_ALTKEY) {
|
if(G.qual==LR_ALTKEY) {
|
||||||
if(G.obedit->type==OB_MESH) {
|
if(G.obedit->type==OB_MESH) {
|
||||||
undo_push_mesh("Merge");
|
|
||||||
mergemenu();
|
mergemenu();
|
||||||
|
|
||||||
makeDispList(G.obedit);
|
makeDispList(G.obedit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if((G.qual==0)) {
|
else if((G.qual==0)) {
|
||||||
if(G.obedit->type==OB_MESH) {
|
|
||||||
undo_push_mesh("Mirror");
|
|
||||||
mirrormenu();
|
mirrormenu();
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
mirrormenu();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if((G.qual==0)){
|
else if((G.qual==0)){
|
||||||
movetolayer();
|
movetolayer();
|
||||||
|
|||||||
Reference in New Issue
Block a user