From e835a0ea554f2a49344dfb3014634974b67cdc18 Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Sun, 14 Jan 2007 04:55:51 +0000 Subject: [PATCH] Removed draw_mode from SculptData, replaced with draw_flag, which currently controls whether to use partial redraw and whether to draw the brush circle. Added new menu option for display of brush circle. --- source/blender/makesdna/DNA_scene_types.h | 15 ++++--- source/blender/src/drawobject.c | 2 +- source/blender/src/drawview.c | 3 +- source/blender/src/header_view3d.c | 51 +++++++---------------- source/blender/src/sculptmode.c | 44 ++++++++++--------- 5 files changed, 51 insertions(+), 64 deletions(-) diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 158c0b438b2..762130812ea 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -381,7 +381,7 @@ typedef struct SculptData char averaging; - char draw_mode; + char draw_flag; /* Control tablet input */ char tablet_size, tablet_strength; @@ -391,10 +391,6 @@ typedef struct SculptData char symm; } SculptData; -#define SCULPTREPT_DRAG 1 -#define SCULPTREPT_TILE 2 -#define SCULPTREPT_3D 3 - typedef struct Scene { ID id; struct Object *camera; @@ -598,13 +594,20 @@ typedef struct Scene { #define FFMPEG_MULTIPLEX_AUDIO 1 #define FFMPEG_AUTOSPLIT_OUTPUT 2 -/* SculptData brushtype */ +/* SculptData.brushtype */ #define DRAW_BRUSH 1 #define SMOOTH_BRUSH 2 #define PINCH_BRUSH 3 #define INFLATE_BRUSH 4 #define GRAB_BRUSH 5 #define LAYER_BRUSH 6 +/* SculptData.texrept */ +#define SCULPTREPT_DRAG 1 +#define SCULPTREPT_TILE 2 +#define SCULPTREPT_3D 3 +/* SculptData.draw_flag */ +#define SCULPTDRAW_FAST 1 +#define SCULPTDRAW_BRUSH 2 #define SYMM_X 1 #define SYMM_Y 2 diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c index a39d997a08f..cdc49f49fe5 100644 --- a/source/blender/src/drawobject.c +++ b/source/blender/src/drawobject.c @@ -2162,7 +2162,7 @@ static int draw_mesh_object(Base *base, int dt, int flag) cageDM->release(cageDM); finalDM->release(finalDM); } - else if(!G.obedit && G.scene->sculptdata.draw_mode && + else if(!G.obedit && (G.scene->sculptdata.draw_flag & SCULPTDRAW_FAST) && OBACT==ob && !sculpt_modifiers_active(ob)) { sculptmode_draw_mesh(0); } diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c index 18a679c76d1..ff392984285 100644 --- a/source/blender/src/drawview.c +++ b/source/blender/src/drawview.c @@ -2830,7 +2830,8 @@ void drawview3dspace(ScrArea *sa, void *spacedata) pd->origloc[0]+200*cos(ang), pd->origloc[1]+200*sin(ang)); sdrawXORline(pd->origloc[0], pd->origloc[1], mouse[0], mouse[1]); } - } else { + } + else if(sculpt_data()->draw_flag & SCULPTDRAW_BRUSH) { short c[2]; getmouseco_areawin(c); fdrawXORcirc((float)c[0], (float)c[1], sculptmode_brush()->size); diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c index f787994ca9b..efe2f9e3173 100644 --- a/source/blender/src/header_view3d.c +++ b/source/blender/src/header_view3d.c @@ -4080,21 +4080,22 @@ void do_view3d_sculptmenu(void *arg, int event) case 6: br->dir= br->dir==1 ? 2 : 1; break; case 7: - break; /* Remove */ - case 8: br->airbrush= !br->airbrush; break; - case 9: + case 8: sd->symm ^= SYMM_X; break; - case 10: + case 9: sd->symm ^= SYMM_Y; break; - case 11: + case 10: sd->symm ^= SYMM_Z; break; - case 12: + case 11: if(G.vd) G.vd->pivot_last= !G.vd->pivot_last; break; + case 12: + sd->draw_flag ^= SCULPTDRAW_FAST; + break; case 13: - sd->draw_mode= !sd->draw_mode; + sd->draw_flag ^= SCULPTDRAW_BRUSH; break; case 14: add_blockhandler(curarea, VIEW3D_HANDLER_OBJECT, UI_PNL_UNSTOW); @@ -4122,29 +4123,6 @@ uiBlock *view3d_sculpt_inputmenu(void *arg_unused) return block; } -/*static uiBlock *view3d_view_alignviewmenu(void *arg_unused) -{ - - block= uiNewBlock(&curarea->uiblocks, "view3d_view_alignviewmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin); - uiBlockSetButmFunc(block, do_view3d_view_alignviewmenu, NULL); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Center View to Cursor|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 3, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Center Cursor and View All|Shift C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 6, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align Active Camera to View|Ctrl Alt NumPad 0", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 4, ""); - - if (((G.obedit) && (G.obedit->type == OB_MESH)) || (G.f & G_FACESELECT)) { - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align View to Selected (Top)|Shift V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align View to Selected (Front)|Shift V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align View to Selected (Side)|Shift V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, ""); - } else { - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Align View to Selected|NumPad *", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 5, ""); - } - - uiBlockSetDirection(block, UI_RIGHT); - uiTextBoundsBlock(block, 50); - return block; -}*/ - uiBlock *view3d_sculptmenu(void *arg_unused) { uiBlock *block; @@ -4159,15 +4137,16 @@ uiBlock *view3d_sculptmenu(void *arg_unused) uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); uiDefIconTextBlockBut(block, view3d_sculpt_inputmenu, NULL, ICON_RIGHTARROW_THIN, "Input Devices", 0, yco-=20, 120, 19, ""); uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - uiDefIconTextBut(block, BUTM, 1, (sd->draw_mode ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Partial Redraw", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, ""); + uiDefIconTextBut(block, BUTM, 1, ((sd->draw_flag & SCULPTDRAW_BRUSH) ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Display Brush", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, ""); + uiDefIconTextBut(block, BUTM, 1, ((sd->draw_flag & SCULPTDRAW_FAST) ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Partial Redraw", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, ""); if(G.vd) - uiDefIconTextBut(block, BUTM, 1, (G.vd->pivot_last ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Pivot last", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, ""); + uiDefIconTextBut(block, BUTM, 1, (G.vd->pivot_last ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Pivot last", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, ""); uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - uiDefIconTextBut(block, BUTM, 1, (sd->symm & SYMM_Z ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Symmetry Z|Z", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, ""); - uiDefIconTextBut(block, BUTM, 1, (sd->symm & SYMM_Y ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Symmetry Y|Y", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, ""); - uiDefIconTextBut(block, BUTM, 1, (sd->symm & SYMM_X ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Symmetry X|X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, ""); + uiDefIconTextBut(block, BUTM, 1, (sd->symm & SYMM_Z ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Symmetry Z|Z", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, ""); + uiDefIconTextBut(block, BUTM, 1, (sd->symm & SYMM_Y ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Symmetry Y|Y", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, ""); + uiDefIconTextBut(block, BUTM, 1, (sd->symm & SYMM_X ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Symmetry X|X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, ""); if(sd->brush_type!=GRAB_BRUSH) - uiDefIconTextBut(block, BUTM, 1, (br->airbrush ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Airbrush|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, ""); + uiDefIconTextBut(block, BUTM, 1, (br->airbrush ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Airbrush|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, ""); if(sd->brush_type!=SMOOTH_BRUSH && sd->brush_type!=GRAB_BRUSH) { uiDefIconTextBut(block, BUTM, 1, (br->dir==1 ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT), "Add|V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, ""); } diff --git a/source/blender/src/sculptmode.c b/source/blender/src/sculptmode.c index a9d1e02885c..5dae84169c1 100644 --- a/source/blender/src/sculptmode.c +++ b/source/blender/src/sculptmode.c @@ -205,7 +205,7 @@ void sculptmode_init(Scene *sce) sd->averaging= 1; sd->texsep= 0; sd->texrept= SCULPTREPT_DRAG; - sd->draw_mode= 0; + sd->draw_flag= SCULPTDRAW_BRUSH; sd->tablet_size=3; sd->tablet_strength=10; } @@ -497,7 +497,7 @@ void sculptmode_undo_update(SculptUndoStep *newcur) ss->undo->cur= newcur; - if(!sculpt_data()->draw_mode || sculpt_modifiers_active(ob)) + if(!(sculpt_data()->draw_flag & SCULPTDRAW_FAST) || sculpt_modifiers_active(ob)) DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); if(G.vd->depths) G.vd->depths->damaged= 1; @@ -1605,20 +1605,22 @@ void sculptmode_propset_init(PropsetMode mode) void sculpt_paint_brush(char clear) { - static short mvalo[2]; - short mval[2]; - const short rad= sculptmode_brush()->size; + if(sculpt_data()->draw_flag & SCULPTDRAW_BRUSH) { + static short mvalo[2]; + short mval[2]; + const short rad= sculptmode_brush()->size; - getmouseco_areawin(mval); - - persp(PERSP_WIN); - if(clear) - fdrawXORcirc(mval[0], mval[1], rad); - else - draw_sel_circle(mval, mvalo, rad, rad, 0); - - mvalo[0]= mval[0]; - mvalo[1]= mval[1]; + getmouseco_areawin(mval); + + persp(PERSP_WIN); + if(clear) + fdrawXORcirc(mval[0], mval[1], rad); + else + draw_sel_circle(mval, mvalo, rad, rad, 0); + + mvalo[0]= mval[0]; + mvalo[1]= mval[1]; + } } void sculptmode_propset(unsigned short event) @@ -1907,7 +1909,7 @@ void sculpt() e.layer_store= NULL; /* Capture original copy */ - if(sd->draw_mode) + if(sd->draw_flag & SCULPTDRAW_FAST) glAccum(GL_LOAD, 1); while (get_mbut() & mousebut) { @@ -1954,7 +1956,7 @@ void sculpt() if(modifier_calculations || ob_get_keyblock(ob)) DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); - if(modifier_calculations || sd->brush_type == GRAB_BRUSH || !sd->draw_mode) { + if(modifier_calculations || sd->brush_type == GRAB_BRUSH || !(sd->draw_flag & SCULPTDRAW_FAST)) { calc_damaged_verts(&damaged_verts,e.grabdata); scrarea_do_windraw(curarea); screen_swapbuffers(); @@ -1997,9 +1999,11 @@ void sculpt() glEnable(GL_SCISSOR_TEST); /* Draw cursor */ - persp(PERSP_WIN); - glDisable(GL_DEPTH_TEST); - fdrawXORcirc((float)mouse[0],(float)mouse[1],sculptmode_brush()->size); + if(sculpt_data()->draw_flag & SCULPTDRAW_BRUSH) { + persp(PERSP_WIN); + glDisable(GL_DEPTH_TEST); + fdrawXORcirc((float)mouse[0],(float)mouse[1],sculptmode_brush()->size); + } myswapbuffers(); }