== Retopo ==
Fixed bug #5829, Exiting editmode with TAB key toggles RETOPO * Moved the retopo_mode setting to ToolSettings. * Renamed the other retopo_mode to the (more accurate) retopo_paint_tool
This commit is contained in:
@@ -169,7 +169,6 @@ typedef struct EditMesh
|
||||
*/
|
||||
int lastDataMask;
|
||||
|
||||
char retopo_mode; /* 0=OFF, 1=ON, 2=PAINT */
|
||||
struct RetopoPaintData *retopo_paint_data;
|
||||
|
||||
CustomData vdata, fdata;
|
||||
|
||||
@@ -342,9 +342,10 @@ typedef struct ToolSettings {
|
||||
|
||||
/* Retopo */
|
||||
char retopo_mode;
|
||||
char retopo_paint_tool;
|
||||
char line_div, ellipse_div, retopo_hotspot;
|
||||
|
||||
int pad4;
|
||||
char pad4[3];
|
||||
} ToolSettings;
|
||||
|
||||
/* Used by all brushes to store their properties, which can be directly set
|
||||
@@ -619,6 +620,10 @@ typedef struct Scene {
|
||||
#define IMAGEPAINT_DRAW_TOOL_DRAWING 4
|
||||
|
||||
/* toolsettings->retopo_mode */
|
||||
#define RETOPO 1
|
||||
#define RETOPO_PAINT 2
|
||||
|
||||
/* toolsettings->retopo_paint_tool */
|
||||
#define RETOPO_PEN 1
|
||||
#define RETOPO_LINE 2
|
||||
#define RETOPO_ELLIPSE 4
|
||||
|
||||
@@ -812,10 +812,10 @@ static void editing_panel_mesh_type(Object *ob, Mesh *me)
|
||||
/* Retopo */
|
||||
if(G.obedit) {
|
||||
uiBlockBeginAlign(block);
|
||||
but= uiDefButBitC(block,TOG,1,B_NOP, "Retopo", 10,130,170,19, &G.editMesh->retopo_mode, 0,0,0,0, "Turn on the re-topology tool");
|
||||
but= uiDefButBitC(block,TOG,RETOPO,B_NOP, "Retopo", 10,130,170,19, &G.scene->toolsettings->retopo_mode, 0,0,0,0, "Turn on the re-topology tool");
|
||||
uiButSetFunc(but,retopo_toggle,ob,me);
|
||||
if(G.editMesh->retopo_mode) {
|
||||
but= uiDefButBitC(block,TOG,2,B_NOP,"Paint", 10,110,55,19, &G.editMesh->retopo_mode,0,0,0,0, "Draw intersecting lines in the 3d view, ENTER creates quad or tri faces, wrapped onto other objects in the 3d view.");
|
||||
if(G.scene->toolsettings->retopo_mode) {
|
||||
but= uiDefButBitC(block,TOG,RETOPO_PAINT,B_NOP,"Paint", 10,110,55,19, &G.scene->toolsettings->retopo_mode,0,0,0,0, "Draw intersecting lines in the 3d view, ENTER creates quad or tri faces, wrapped onto other objects in the 3d view.");
|
||||
uiButSetFunc(but,retopo_paint_toggle,ob,me);
|
||||
but= uiDefBut(block,BUT,B_NOP,"Retopo All", 65,110,115,19, 0,0,0,0,0, "Apply the re-topology tool to all selected vertices");
|
||||
uiButSetFunc(but,retopo_do_all_cb,ob,me);
|
||||
|
||||
@@ -619,7 +619,7 @@ void free_editMesh(EditMesh *em)
|
||||
|
||||
if(em->retopo_paint_data) retopo_free_paint_data(em->retopo_paint_data);
|
||||
em->retopo_paint_data= NULL;
|
||||
em->retopo_mode= 0;
|
||||
G.scene->toolsettings->retopo_mode&= ~RETOPO_PAINT;
|
||||
}
|
||||
|
||||
/* on G.editMesh */
|
||||
@@ -1930,7 +1930,7 @@ static void *editMesh_to_undoMesh(void)
|
||||
}
|
||||
|
||||
um->retopo_paint_data= retopo_paint_data_copy(em->retopo_paint_data);
|
||||
um->retopo_mode= em->retopo_mode;
|
||||
um->retopo_mode= G.scene->toolsettings->retopo_mode;
|
||||
|
||||
{
|
||||
Multires *mr= get_mesh(G.obedit)->mr;
|
||||
@@ -2060,8 +2060,8 @@ static void undoMesh_to_editMesh(void *umv)
|
||||
|
||||
retopo_free_paint();
|
||||
em->retopo_paint_data= retopo_paint_data_copy(um->retopo_paint_data);
|
||||
em->retopo_mode= um->retopo_mode;
|
||||
if(em->retopo_mode) {
|
||||
G.scene->toolsettings->retopo_mode= um->retopo_mode;
|
||||
if(G.scene->toolsettings->retopo_mode) {
|
||||
if(G.vd->depths) G.vd->depths->damaged= 1;
|
||||
retopo_queue_updates(G.vd);
|
||||
retopo_paint_view_update(G.vd);
|
||||
|
||||
@@ -4999,23 +4999,23 @@ void view3d_buttons(void)
|
||||
if(rpd) {
|
||||
ToolSettings *ts= G.scene->toolsettings;
|
||||
|
||||
uiDefButC(block,ROW,B_REDR,"Pen",xco,0,40,20,&ts->retopo_mode,6.0,RETOPO_PEN,0,0,"");
|
||||
uiDefButC(block,ROW,B_REDR,"Pen",xco,0,40,20,&ts->retopo_paint_tool,6.0,RETOPO_PEN,0,0,"");
|
||||
xco+=40;
|
||||
uiDefButC(block,ROW,B_REDR,"Line",xco,0,40,20,&ts->retopo_mode,6.0,RETOPO_LINE,0,0,"");
|
||||
uiDefButC(block,ROW,B_REDR,"Line",xco,0,40,20,&ts->retopo_paint_tool,6.0,RETOPO_LINE,0,0,"");
|
||||
xco+=40;
|
||||
uiDefButC(block,ROW,B_REDR,"Ellipse",xco,0,60,20,&ts->retopo_mode,6.0,RETOPO_ELLIPSE,0,0,"");
|
||||
uiDefButC(block,ROW,B_REDR,"Ellipse",xco,0,60,20,&ts->retopo_paint_tool,6.0,RETOPO_ELLIPSE,0,0,"");
|
||||
xco+=65;
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
if(ts->retopo_mode == RETOPO_PEN) {
|
||||
if(ts->retopo_paint_tool == RETOPO_PEN) {
|
||||
uiDefButC(block,TOG,B_NOP,"Hotspot",xco,0,60,20, &ts->retopo_hotspot, 0,0,0,0,"Show hotspots at line ends to allow line continuation");
|
||||
xco+=80;
|
||||
}
|
||||
else if(ts->retopo_mode == RETOPO_LINE) {
|
||||
else if(ts->retopo_paint_tool == RETOPO_LINE) {
|
||||
uiDefButC(block,NUM,B_NOP,"LineDiv",xco,0,80,20,&ts->line_div,1,50,0,0,"Subdivisions per retopo line");
|
||||
xco+=80;
|
||||
}
|
||||
else if(ts->retopo_mode == RETOPO_ELLIPSE) {
|
||||
else if(ts->retopo_paint_tool == RETOPO_ELLIPSE) {
|
||||
uiDefButC(block,NUM,B_NOP,"EllDiv",xco,0,80,20,&ts->ellipse_div,3,50,0,0,"Subdivisions per retopo ellipse");
|
||||
xco+=80;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ RetopoPaintData *get_retopo_paint_data()
|
||||
|
||||
char retopo_mesh_paint_check()
|
||||
{
|
||||
return retopo_mesh_check() && G.editMesh->retopo_mode & 2;
|
||||
return retopo_mesh_check() && G.scene->toolsettings->retopo_mode & RETOPO_PAINT;
|
||||
}
|
||||
|
||||
void retopo_free_paint_data(RetopoPaintData *rpd)
|
||||
@@ -391,7 +391,7 @@ void retopo_end_okee()
|
||||
retopo_paint_apply();
|
||||
else
|
||||
retopo_free_paint();
|
||||
G.editMesh->retopo_mode &= ~2;
|
||||
G.scene->toolsettings->retopo_mode &= ~RETOPO_PAINT;
|
||||
}
|
||||
|
||||
void retopo_paint_toggle(void *a, void *b)
|
||||
@@ -401,7 +401,7 @@ void retopo_paint_toggle(void *a, void *b)
|
||||
RetopoPaintData *rpd= MEM_callocN(sizeof(RetopoPaintData),"RetopoPaintData");
|
||||
|
||||
G.editMesh->retopo_paint_data= rpd;
|
||||
G.scene->toolsettings->retopo_mode= RETOPO_PEN;
|
||||
G.scene->toolsettings->retopo_paint_tool= RETOPO_PEN;
|
||||
rpd->seldist= 15;
|
||||
rpd->nearest.line= NULL;
|
||||
G.scene->toolsettings->line_div= 25;
|
||||
@@ -472,7 +472,7 @@ char retopo_paint(const unsigned short event)
|
||||
if(rpd->in_drag && !lbut) { /* End drag */
|
||||
rpd->in_drag= 0;
|
||||
|
||||
switch(G.scene->toolsettings->retopo_mode) {
|
||||
switch(G.scene->toolsettings->retopo_paint_tool) {
|
||||
case RETOPO_PEN:
|
||||
break;
|
||||
case RETOPO_LINE:
|
||||
@@ -488,7 +488,7 @@ char retopo_paint(const unsigned short event)
|
||||
switch(event) {
|
||||
case MOUSEX:
|
||||
case MOUSEY:
|
||||
switch(G.scene->toolsettings->retopo_mode) {
|
||||
switch(G.scene->toolsettings->retopo_paint_tool) {
|
||||
case RETOPO_PEN:
|
||||
if(rpd->in_drag && rpd->lines.last) {
|
||||
l= rpd->lines.last;
|
||||
@@ -540,7 +540,7 @@ char retopo_paint(const unsigned short event)
|
||||
case PADENTER:
|
||||
retopo_paint_apply();
|
||||
case ESCKEY:
|
||||
G.editMesh->retopo_mode= 1;
|
||||
G.scene->toolsettings->retopo_mode&= ~RETOPO_PAINT;
|
||||
retopo_free_paint();
|
||||
|
||||
BIF_undo_push("Retopo toggle");
|
||||
@@ -553,7 +553,7 @@ char retopo_paint(const unsigned short event)
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
break;
|
||||
case EKEY:
|
||||
G.scene->toolsettings->retopo_mode= RETOPO_ELLIPSE;
|
||||
G.scene->toolsettings->retopo_paint_tool= RETOPO_ELLIPSE;
|
||||
allqueue(REDRAWVIEW3D, 1);
|
||||
break;
|
||||
case HKEY:
|
||||
@@ -561,11 +561,11 @@ char retopo_paint(const unsigned short event)
|
||||
allqueue(REDRAWVIEW3D, 1);
|
||||
break;
|
||||
case LKEY:
|
||||
G.scene->toolsettings->retopo_mode= RETOPO_LINE;
|
||||
G.scene->toolsettings->retopo_paint_tool= RETOPO_LINE;
|
||||
allqueue(REDRAWVIEW3D, 1);
|
||||
break;
|
||||
case PKEY:
|
||||
G.scene->toolsettings->retopo_mode= RETOPO_PEN;
|
||||
G.scene->toolsettings->retopo_paint_tool= RETOPO_PEN;
|
||||
allqueue(REDRAWVIEW3D, 1);
|
||||
break;
|
||||
case XKEY:
|
||||
@@ -592,7 +592,7 @@ char retopo_paint(const unsigned short event)
|
||||
rpd->sloc[0]= mouse[0];
|
||||
rpd->sloc[1]= mouse[1];
|
||||
|
||||
switch(G.scene->toolsettings->retopo_mode) {
|
||||
switch(G.scene->toolsettings->retopo_paint_tool) {
|
||||
case RETOPO_PEN:
|
||||
if(rpd->nearest.line) {
|
||||
RetopoPaintPoint *p, *pt;
|
||||
@@ -664,7 +664,7 @@ void retopo_draw_paint_lines()
|
||||
}
|
||||
|
||||
/* Draw ellipse */
|
||||
if(G.scene->toolsettings->retopo_mode==RETOPO_ELLIPSE && rpd->in_drag) {
|
||||
if(G.scene->toolsettings->retopo_paint_tool==RETOPO_ELLIPSE && rpd->in_drag) {
|
||||
short mouse[2];
|
||||
getmouseco_areawin(mouse);
|
||||
|
||||
@@ -672,7 +672,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(G.scene->toolsettings->retopo_mode==RETOPO_LINE && rpd->in_drag) {
|
||||
else if(G.scene->toolsettings->retopo_paint_tool==RETOPO_LINE && rpd->in_drag) {
|
||||
short mouse[2];
|
||||
getmouseco_areawin(mouse);
|
||||
|
||||
@@ -724,7 +724,7 @@ RetopoPaintData *retopo_paint_data_copy(RetopoPaintData *rpd)
|
||||
|
||||
char retopo_mesh_check()
|
||||
{
|
||||
return G.obedit && G.obedit->type==OB_MESH && (G.editMesh->retopo_mode & 1);
|
||||
return G.obedit && G.obedit->type==OB_MESH && (G.scene->toolsettings->retopo_mode & RETOPO);
|
||||
}
|
||||
char retopo_curve_check()
|
||||
{
|
||||
@@ -738,7 +738,7 @@ void retopo_toggle(void *j1,void *j2)
|
||||
if(G.vd->depths) G.vd->depths->damaged= 1;
|
||||
retopo_queue_updates(G.vd);
|
||||
} else {
|
||||
if(G.editMesh && G.editMesh->retopo_mode & 2)
|
||||
if(G.editMesh && G.scene->toolsettings->retopo_mode & RETOPO_PAINT)
|
||||
retopo_end_okee();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user