diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2006-12-08 03:44:44 +0300 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2006-12-08 03:44:44 +0300 |
commit | 3da771fefcde9efc3797bb08cd3d90d09dbe1f81 (patch) | |
tree | 5b40b411c0fe92b04ee798820ea36fc9ff4982c5 /source | |
parent | fb261464b0fd0cd5d971ee2e865f88095f5de3cb (diff) |
Fix for bug #5369, retopology - undo reverts elipse to pen
Moved the retopo tool settings into ToolSettings.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/include/BIF_retopo.h | 10 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 11 | ||||
-rw-r--r-- | source/blender/src/header_view3d.c | 10 | ||||
-rw-r--r-- | source/blender/src/retopo.c | 29 |
4 files changed, 30 insertions, 30 deletions
diff --git a/source/blender/include/BIF_retopo.h b/source/blender/include/BIF_retopo.h index 50dc23ead1c..dad8e6a8a0a 100644 --- a/source/blender/include/BIF_retopo.h +++ b/source/blender/include/BIF_retopo.h @@ -66,7 +66,6 @@ typedef struct RetopoPaintSel { } RetopoPaintSel; typedef struct RetopoPaintData { - char mode; char in_drag; short sloc[2]; @@ -75,17 +74,8 @@ typedef struct RetopoPaintData { short seldist; RetopoPaintSel nearest; - - /* Interface controls */ - char line_div; - char ellipse_div; } RetopoPaintData; -/* RetopoPaintData.mode */ -#define RETOPO_PEN 1 -#define RETOPO_LINE 2 -#define RETOPO_ELLIPSE 4 - RetopoPaintData *get_retopo_paint_data(); char retopo_mesh_check(); diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 85127f1979a..553600364d9 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -366,7 +366,11 @@ typedef struct ToolSettings { /* IPO-Editor */ float clean_thresh; - float pad3; + + /* Retopo */ + char retopo_mode; + char line_div, ellipse_div; + char pad3; } ToolSettings; @@ -654,6 +658,11 @@ typedef struct Scene { #define IMAGEPAINT_DRAW_TOOL 2 #define IMAGEPAINT_DRAW_TOOL_DRAWING 4 +/* toolsettings->retopo_mode */ +#define RETOPO_PEN 1 +#define RETOPO_LINE 2 +#define RETOPO_ELLIPSE 4 + #ifdef __cplusplus } #endif diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c index f173e08e5c3..e91929fa5f9 100644 --- a/source/blender/src/header_view3d.c +++ b/source/blender/src/header_view3d.c @@ -4918,17 +4918,17 @@ void view3d_buttons(void) if(retopo_mesh_paint_check()) { RetopoPaintData *rpd= get_retopo_paint_data(); if(rpd) { - uiDefButC(block,ROW,B_NOP,"Pen",xco,0,40,20,&rpd->mode,6.0,RETOPO_PEN,0,0,""); + uiDefButC(block,ROW,B_NOP,"Pen",xco,0,40,20,&G.scene->toolsettings->retopo_mode,6.0,RETOPO_PEN,0,0,""); xco+=40; - uiDefButC(block,ROW,B_NOP,"Line",xco,0,40,20,&rpd->mode,6.0,RETOPO_LINE,0,0,""); + uiDefButC(block,ROW,B_NOP,"Line",xco,0,40,20,&G.scene->toolsettings->retopo_mode,6.0,RETOPO_LINE,0,0,""); xco+=40; - uiDefButC(block,ROW,B_NOP,"Ellipse",xco,0,60,20,&rpd->mode,6.0,RETOPO_ELLIPSE,0,0,""); + uiDefButC(block,ROW,B_NOP,"Ellipse",xco,0,60,20,&G.scene->toolsettings->retopo_mode,6.0,RETOPO_ELLIPSE,0,0,""); xco+=65; uiBlockBeginAlign(block); - uiDefButC(block,NUM,B_NOP,"LineDiv",xco,0,80,20,&rpd->line_div,1,50,0,0,"How much to subdivide each line made with the Line tool"); + uiDefButC(block,NUM,B_NOP,"LineDiv",xco,0,80,20,&G.scene->toolsettings->line_div,1,50,0,0,"Subdivisions per retopo line"); xco+=80; - uiDefButC(block,NUM,B_NOP,"EllDiv",xco,0,80,20,&rpd->ellipse_div,3,50,0,0,"How much to subdivide each ellipse made with the Ellipse tool"); + uiDefButC(block,NUM,B_NOP,"EllDiv",xco,0,80,20,&G.scene->toolsettings->ellipse_div,3,50,0,0,"Subdivisions per retopo ellipse"); xco+=85; uiBlockEndAlign(block); diff --git a/source/blender/src/retopo.c b/source/blender/src/retopo.c index 0c78d858f29..673da1a1eca 100644 --- a/source/blender/src/retopo.c +++ b/source/blender/src/retopo.c @@ -38,6 +38,7 @@ #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_object_types.h" +#include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_view3d_types.h" @@ -351,8 +352,8 @@ void retopo_paint_add_line(RetopoPaintData *rpd, short mouse[2]) /* Add initial point */ add_rppoint(l,rpd->sloc[0],rpd->sloc[1]); - for(i=0; i<rpd->line_div; ++i) { - const float mul= (i+1.0f)/rpd->line_div; + for(i=0; i<G.scene->toolsettings->line_div; ++i) { + const float mul= (i+1.0f) / G.scene->toolsettings->line_div; add_rppoint(l,rpd->sloc[0] + range[0]*mul,rpd->sloc[1] + range[1]*mul); } @@ -364,8 +365,8 @@ void retopo_paint_add_ellipse(RetopoPaintData *rpd, short mouse[2]) int i; add_rpline(rpd); - for (i=0; i<rpd->ellipse_div; i++) { - float t= (float) i/rpd->ellipse_div; + for (i=0; i<G.scene->toolsettings->ellipse_div; i++) { + float t= (float) i / G.scene->toolsettings->ellipse_div; float cur= t*(M_PI*2); float w= abs(mouse[0]-rpd->sloc[0]); @@ -396,11 +397,11 @@ void retopo_paint_toggle(void *a, void *b) RetopoPaintData *rpd= MEM_callocN(sizeof(RetopoPaintData),"RetopoPaintData"); G.editMesh->retopo_paint_data= rpd; - rpd->mode= RETOPO_PEN; + G.scene->toolsettings->retopo_mode= RETOPO_PEN; rpd->seldist= 15; rpd->nearest.line= NULL; - rpd->line_div= 25; - rpd->ellipse_div= 25; + G.scene->toolsettings->line_div= 25; + G.scene->toolsettings->ellipse_div= 25; } else retopo_end_okee(); BIF_undo_push("Retopo toggle"); @@ -445,7 +446,7 @@ char retopo_paint(const unsigned short event) if(rpd->in_drag && !lbut) { /* End drag */ rpd->in_drag= 0; - switch(rpd->mode) { + switch(G.scene->toolsettings->retopo_mode) { case RETOPO_PEN: break; case RETOPO_LINE: @@ -461,7 +462,7 @@ char retopo_paint(const unsigned short event) switch(event) { case MOUSEX: case MOUSEY: - switch(rpd->mode) { + switch(G.scene->toolsettings->retopo_mode) { case RETOPO_PEN: if(rpd->in_drag && rpd->lines.last) { l= rpd->lines.last; @@ -526,11 +527,11 @@ char retopo_paint(const unsigned short event) allqueue(REDRAWVIEW3D, 0); break; case EKEY: - rpd->mode= RETOPO_ELLIPSE; + G.scene->toolsettings->retopo_mode= RETOPO_ELLIPSE; allqueue(REDRAWBUTSEDIT, 0); break; case PKEY: - rpd->mode= RETOPO_PEN; + G.scene->toolsettings->retopo_mode= RETOPO_PEN; allqueue(REDRAWBUTSEDIT, 0); break; case LEFTMOUSE: @@ -541,7 +542,7 @@ char retopo_paint(const unsigned short event) rpd->sloc[0]= mouse[0]; rpd->sloc[1]= mouse[1]; - switch(rpd->mode) { + switch(G.scene->toolsettings->retopo_mode) { case RETOPO_PEN: if(rpd->nearest.line) { RetopoPaintPoint *p, *pt; @@ -609,7 +610,7 @@ void retopo_draw_paint_lines() } /* Draw ellipse */ - if(rpd->mode==RETOPO_ELLIPSE && rpd->in_drag) { + if(G.scene->toolsettings->retopo_mode==RETOPO_ELLIPSE && rpd->in_drag) { short mouse[2]; getmouseco_areawin(mouse); @@ -617,7 +618,7 @@ void retopo_draw_paint_lines() fdrawXORellipse(rpd->sloc[0],rpd->sloc[1],abs(mouse[0]-rpd->sloc[0]),abs(mouse[1]-rpd->sloc[1])); setlinestyle(0); } - else if(rpd->mode==RETOPO_LINE && rpd->in_drag) { + else if(G.scene->toolsettings->retopo_mode==RETOPO_LINE && rpd->in_drag) { short mouse[2]; getmouseco_areawin(mouse); |