Patch #4896, submitted by Juho Vepsäläinen (bebraw):

Allows "Degr" field in Mesh tools accept negative and positive float values
from range [-360, 360].
This commit is contained in:
Ken Hughes 2006-11-09 14:30:11 +00:00
parent c1b05cace9
commit 56a12a30c5
4 changed files with 10 additions and 14 deletions

View File

@ -197,7 +197,7 @@ extern void esubdivideflag(int flag, float rad, int beauty, int numcuts, int sel
extern void extrude_mesh(void);
extern void split_mesh(void);
extern void extrude_repeat_mesh(int steps, float offs);
extern void spin_mesh(int steps,int degr,float *dvec, int mode);
extern void spin_mesh(int steps,float degr,float *dvec, int mode);
extern void screw_mesh(int steps,int turns);
extern void delete_mesh(void);
extern void beauty_fill(void);
@ -228,4 +228,3 @@ void pathselect(void);
void loop_to_region(void);
void region_to_loop(void);
#endif

View File

@ -323,11 +323,9 @@ typedef struct ToolSettings {
short cornertype;
short editbutflag;
/* Extrude Tools */
short degr;
float degr;
short step;
short turn;
short pad1;
float extr_offs;
float doublimit;
@ -643,4 +641,3 @@ typedef struct Scene {
#endif
#endif

View File

@ -3697,12 +3697,12 @@ static void editing_panel_mesh_tools(Object *ob, Mesh *me)
uiDefBut(block, BUT,B_SCREW,"Screw", 10,75,100,24, 0, 0, 0, 0, 0, "Activates the screw tool"); // Bish - This could use some more definition
uiDefBut(block, BUT,B_SPIN, "Spin", 110,75,100,24, 0, 0, 0, 0, 0, "Extrudes the selected vertices in a circle around the cursor in the indicated viewport");
uiDefBut(block, BUT,B_SPINDUP,"Spin Dup", 210,75,115,24, 0, 0, 0, 0, 0, "Creates copies of the selected vertices in a circle around the cursor in the indicated viewport");
uiDefButS(block, NUM, B_DIFF, "Degr:", 10,55,100,19, &G.scene->toolsettings->degr,10.0,360.0, 0, 0, "Specifies the number of degrees 'Spin' revolves");
uiDefButF(block, NUM, B_DIFF, "Degr:", 10,55,100,19, &G.scene->toolsettings->degr,-360.0,360.0, 1000, 0, "Specifies the number of degrees 'Spin' revolves");
uiDefButS(block, NUM, B_DIFF, "Steps:", 110,55,100,19, &G.scene->toolsettings->step,1.0,180.0, 0, 0, "Specifies the total number of 'Spin' slices");
uiDefButS(block, NUM, B_DIFF, "Turns:", 210,55,115,19, &G.scene->toolsettings->turn,1.0,360.0, 0, 0, "Specifies the number of revolutions the screw turns");
uiDefButBitS(block, TOG, B_KEEPORIG, B_DIFF, "Keep Original",10,35,200,19, &G.scene->toolsettings->editbutflag, 0, 0, 0, 0, "Keeps a copy of the original vertices and faces after executing tools");
uiDefButBitS(block, TOG, B_CLOCKWISE, B_DIFF, "Clockwise", 210,35,115,19, &G.scene->toolsettings->editbutflag, 0, 0, 0, 0, "Specifies the direction for 'Screw' and 'Spin'");
uiDefButBitS(block, TOG, B_CLOCKWISE, B_DIFF, "Clockwise", 210,35,115,19, &G.scene->toolsettings->editbutflag, 0, 0, 0, 0, "Specifies the direction for 'Screw'");
uiBlockBeginAlign(block);
uiDefBut(block, BUT,B_EXTREP, "Extrude Dup", 10,10,150,19, 0, 0, 0, 0, 0, "Creates copies of the selected vertices in a straight line away from the current viewport");

View File

@ -787,7 +787,7 @@ void extrude_repeat_mesh(int steps, float offs)
BIF_undo_push("Extrude Repeat");
}
void spin_mesh(int steps, int degr, float *dvec, int mode)
void spin_mesh(int steps, float degr, float *dvec, int mode)
{
EditMesh *em = G.editMesh;
EditVert *eve,*nextve;
@ -810,9 +810,8 @@ void spin_mesh(int steps, int degr, float *dvec, int mode)
cent[2]-= G.obedit->obmat[3][2];
Mat3MulVecfl(imat, cent);
phi= (float)(degr*M_PI/360.0);
phi= degr*M_PI/(-360.0);
phi/= steps;
if(G.scene->toolsettings->editbutflag & B_CLOCKWISE) phi= -phi;
if(dvec) {
n[0]=n[1]= 0.0;
@ -879,7 +878,7 @@ void screw_mesh(int steps, int turns)
EditMesh *em = G.editMesh;
EditVert *eve,*v1=0,*v2=0;
EditEdge *eed;
float dvec[3], nor[3];
float dvec[3], nor[3],deg=(-360);
TEST_EDITMESH
@ -937,8 +936,9 @@ void screw_mesh(int steps, int turns)
dvec[1]= -dvec[1];
dvec[2]= -dvec[2];
}
if(G.scene->toolsettings->editbutflag & B_CLOCKWISE) deg= -deg;
spin_mesh(turns*steps, turns*360, dvec, 0);
spin_mesh(turns*steps, turns*deg, dvec, 0);
BIF_undo_push("Spin");
}