From 56a12a30c5fa3699b66a3f6e92781c373b5403a0 Mon Sep 17 00:00:00 2001 From: Ken Hughes Date: Thu, 9 Nov 2006 14:30:11 +0000 Subject: [PATCH] =?UTF-8?q?Patch=20#4896,=20submitted=20by=20Juho=20Veps?= =?UTF-8?q?=C3=A4l=C3=A4inen=20(bebraw):?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allows "Degr" field in Mesh tools accept negative and positive float values from range [-360, 360]. --- source/blender/include/BIF_editmesh.h | 3 +-- source/blender/makesdna/DNA_scene_types.h | 5 +---- source/blender/src/buttons_editing.c | 6 +++--- source/blender/src/editmesh_tools.c | 10 +++++----- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/source/blender/include/BIF_editmesh.h b/source/blender/include/BIF_editmesh.h index cbd0cf0704b..0df24d17917 100644 --- a/source/blender/include/BIF_editmesh.h +++ b/source/blender/include/BIF_editmesh.h @@ -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 - diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 4fd7ebe8791..3710e0fc514 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -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 - diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index 3910c9dcdcd..48c73d2eaf0 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -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"); diff --git a/source/blender/src/editmesh_tools.c b/source/blender/src/editmesh_tools.c index 8a9b5dc9a31..33f47fe76dd 100644 --- a/source/blender/src/editmesh_tools.c +++ b/source/blender/src/editmesh_tools.c @@ -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"); }