diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-09-14 15:39:53 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-09-14 15:39:53 +0400 |
commit | 2a6f7c349cd553375d9fdd0ae2f7e0788189744a (patch) | |
tree | 907d934e2fafb4620397fa11306b0172b5dc8e61 /source | |
parent | fcd2d300046eb5d726eceaeabd182a0286d997d6 (diff) |
changed how shading works in editmode
Texture Draw; no shading only textures (better for mapping work)
Shaded Draw; textured with shading (in editmode it used to be like solid draw mode)
ZClip Option; dont draw face center dots.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/src/buttons_editing.c | 23 | ||||
-rw-r--r-- | source/blender/src/drawimage.c | 70 | ||||
-rw-r--r-- | source/blender/src/drawmesh.c | 9 | ||||
-rw-r--r-- | source/blender/src/drawobject.c | 15 | ||||
-rw-r--r-- | source/blender/src/editmesh_mods.c | 4 |
5 files changed, 58 insertions, 63 deletions
diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index 42e2d5d04dc..ea90f6fdc16 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -5286,8 +5286,9 @@ static void editing_panel_mesh_texface(void) MTFace *tf; block= uiNewBlock(&curarea->uiblocks, "editing_panel_mesh_texface", UI_EMBOSS, UI_HELV, curarea->win); - if(uiNewPanel(curarea, block, "Texture face", "Editing", 960, 0, 318, 204)==0) return; - + uiNewPanelTabbed("Multires", "Editing"); + if(uiNewPanel(curarea, block, "Texture Face", "Editing", 960, 0, 318, 204)==0) return; + tf = get_active_mtface(NULL, NULL); if(tf) { uiBlockBeginAlign(block); @@ -5314,17 +5315,6 @@ static void editing_panel_mesh_texface(void) uiDefButC(block, ROW, REDRAWVIEW3D, "Opaque", 600,80,60,19, &tf->transp, 2.0, 0.0, 0, 0, "Render color of textured face as color"); uiDefButC(block, ROW, REDRAWVIEW3D, "Add", 660,80,60,19, &tf->transp, 2.0, 1.0, 0, 0, "Render face transparent and add color of face"); uiDefButC(block, ROW, REDRAWVIEW3D, "Alpha", 720,80,60,19, &tf->transp, 2.0, 2.0, 0, 0, "Render polygon transparent, depending on alpha channel of the texture"); - - uiBlockSetCol(block, TH_AUTO); - - uiBlockBeginAlign(block); - uiDefButF(block, COL, B_VPCOLSLI, "", 769,40,40,28, &(Gvp.r), 0, 0, 0, 0, ""); - uiDefBut(block, BUT, B_SET_VCOL, "Set VertCol", 809,40,103,28, 0, 0, 0, 0, 0, "Set Vertex color of selection to current (Shift+K)"); - - uiBlockBeginAlign(block); - uiDefBut(block, BUT, B_COPY_TF_MODE, "Copy DrawMode", 600,7,117,28, 0, 0, 0, 0, 0, "Copy the drawmode from active face to selected faces"); - uiDefBut(block, BUT, B_COPY_TF_UV, "Copy UV+tex", 721,7,85,28, 0, 0, 0, 0, 0, "Copy UV information and textures from active face to selected faces"); - uiDefBut(block, BUT, B_COPY_TF_COL, "Copy VertCol", 809,7,103,28, 0, 0, 0, 0, 0, "Copy vertex colors from active face to selected faces"); } } @@ -5345,7 +5335,7 @@ static void editing_panel_mesh_uvautocalculation(void) block= uiNewBlock(&curarea->uiblocks, "editing_panel_mesh_uvautocalculation", UI_EMBOSS, UI_HELV, curarea->win); /* make this a tab of "Texture face" to save screen space*/ - uiNewPanelTabbed("Modifiers", "Editing"); + uiNewPanelTabbed("Multires", "Editing"); if(uiNewPanel(curarea, block, "UV Calculation", "Editing", 960, 0, 318, 204)==0) return; row-= 4*butHB+butS; @@ -5475,6 +5465,8 @@ void editing_panels() editing_panel_mesh_tools(ob, ob->data); editing_panel_mesh_tools1(ob, ob->data); editing_panel_mesh_uvautocalculation(); + if (EM_texFaceCheck()) + editing_panel_mesh_texface(); } else if(G.f & G_SCULPTMODE) { uiNewPanelTabbed("Multires", "Editing"); @@ -5482,9 +5474,6 @@ void editing_panels() uiNewPanelTabbed("Multires", "Editing"); editing_panel_sculpting_textures(); } else { - if(FACESEL_PAINT_TEST) { - editing_panel_mesh_texface(); - } if(G.f & (G_VERTEXPAINT | G_TEXTUREPAINT | G_WEIGHTPAINT) ) { editing_panel_mesh_paint(); } diff --git a/source/blender/src/drawimage.c b/source/blender/src/drawimage.c index 9e3ce1b785e..462c7a6d878 100644 --- a/source/blender/src/drawimage.c +++ b/source/blender/src/drawimage.c @@ -293,50 +293,44 @@ void image_changed(SpaceImage *sima, int dotile) if(sima->image==NULL) sima->flag &= ~SI_DRAWTOOL; - if(sima->mode==SI_TEXTURE) { + if(sima->mode!=SI_TEXTURE || !EM_texFaceCheck()) + return; - if(EM_texFaceCheck()) { - /* skip assigning these procedural images... */ - if(sima->image) { - if(sima->image->type==IMA_TYPE_R_RESULT) - return; - if(sima->image->type==IMA_TYPE_COMPOSITE) - return; - } - /* - tface= me->mtface; - mface = me->mface; - a= me->totface; - while(a--) { - if(mface->flag & ME_FACE_SEL) { - */ - for (efa= em->faces.first; efa; efa= efa->next) { - if (efa->f & SELECT) { - tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); - - if(dotile==2) { - tface->mode &= ~TF_TILES; - } - else { - tface->tpage= sima->image; - tface->mode |= TF_TEX; - - if(dotile) tface->tile= sima->curtile; - } + /* skip assigning these procedural images... */ + if(sima->image) { + if(sima->image->type==IMA_TYPE_R_RESULT) + return; + if(sima->image->type==IMA_TYPE_COMPOSITE) + return; + } + + for (efa= em->faces.first; efa; efa= efa->next) { + if (efa->f & SELECT) { + tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); + + if(dotile==2) { + tface->mode &= ~TF_TILES; + } else { + if (sima->image) { + tface->tpage= sima->image; + tface->mode |= TF_TEX; - if(sima->image) { - if(sima->image->tpageflag & IMA_TILES) tface->mode |= TF_TILES; - else tface->mode &= ~TF_TILES; + if(sima->image->tpageflag & IMA_TILES) tface->mode |= TF_TILES; + else tface->mode &= ~TF_TILES; - if(sima->image->id.us==0) id_us_plus(&sima->image->id); - else id_lib_extern(&sima->image->id); - } + if(sima->image->id.us==0) id_us_plus(&sima->image->id); + else id_lib_extern(&sima->image->id); + } else { + tface->tpage= NULL; + tface->mode &= ~TF_TEX; } + + if(dotile) tface->tile= sima->curtile; } - object_uvs_changed(OBACT); - allqueue(REDRAWBUTSEDIT, 0); } } + object_uvs_changed(OBACT); + allqueue(REDRAWBUTSEDIT, 0); } @@ -896,7 +890,7 @@ static void image_panel_game_properties(short cntrl) // IMAGE_HANDLER_GAME_PROPE uiBlockEndAlign(block); uiBlockBeginAlign(block); - uiDefButBitS(block, TOG, IMA_TILES, B_SIMAGEDRAW1, "Tiles", 160,150,140,19, &G.sima->image->tpageflag, 0, 0, 0, 0, "Toggles use of tilemode for faces"); + uiDefButBitS(block, TOG, IMA_TILES, B_SIMAGEDRAW1, "Tiles", 160,150,140,19, &G.sima->image->tpageflag, 0, 0, 0, 0, "Toggles use of tilemode for faces (Shift LMB to pick the tile for selected faces)"); uiDefButS(block, NUM, B_SIMAGEDRAW, "X:", 160,130,70,19, &G.sima->image->xrep, 1.0, 16.0, 0, 0, "Sets the degree of repetition in the X direction"); uiDefButS(block, NUM, B_SIMAGEDRAW, "Y:", 230,130,70,19, &G.sima->image->yrep, 1.0, 16.0, 0, 0, "Sets the degree of repetition in the Y direction"); uiBlockBeginAlign(block); diff --git a/source/blender/src/drawmesh.c b/source/blender/src/drawmesh.c index 8b38d925c0e..99d35f834dc 100644 --- a/source/blender/src/drawmesh.c +++ b/source/blender/src/drawmesh.c @@ -953,7 +953,7 @@ static void draw_textured_begin(Object *ob) unsigned char obcol[4]; int istex, solidtex= 0; - if(G.vd->drawtype==OB_SOLID || ob==G.obedit) { + if(G.vd->drawtype==OB_SOLID || (ob==G.obedit && G.vd->drawtype!=OB_TEXTURE)) { /* draw with default lights in solid draw mode and edit mode */ solidtex= 1; Gtexdraw.islit= -1; @@ -1186,9 +1186,9 @@ void draw_mesh_textured(Object *ob, DerivedMesh *dm, int faceselect) } else { #endif - if(ob==G.obedit) + if(ob==G.obedit) { dm->drawMappedFacesTex(dm, draw_em_tf_mapped__set_draw, G.editMesh); - else if(faceselect) { + } else if(faceselect) { if(G.f & G_WEIGHTPAINT) dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me, 1); else @@ -1220,6 +1220,9 @@ void draw_mesh_textured(Object *ob, DerivedMesh *dm, int faceselect) /* reset from negative scale correction */ glFrontFace(GL_CCW); + + /* in editmode, the blend mode needs to be set incase it was ADD */ + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); dm->release(dm); } diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c index ff33b1d0c92..1c5fb42d7f0 100644 --- a/source/blender/src/drawobject.c +++ b/source/blender/src/drawobject.c @@ -1632,7 +1632,10 @@ static void draw_em_fancy_verts(EditMesh *em, DerivedMesh *cageDM) draw_dm_verts(cageDM, sel); } - if(G.scene->selectmode & SCE_SELECT_FACE && G.vd->drawtype!=OB_TEXTURE) { + if( (G.scene->selectmode & SCE_SELECT_FACE) && + (G.vd->drawtype<=OB_SOLID) && + ( !((G.vd->flag & V3D_ZBUF_SELECT) && (G.vd->drawtype==OB_SOLID)) ) + ) { glPointSize(fsize); glColor4ubv((GLubyte *)fcol); draw_dm_face_centers(cageDM, sel); @@ -1947,8 +1950,9 @@ static void draw_em_fancy(Object *ob, EditMesh *em, DerivedMesh *cageDM, Derived if(dt>OB_WIRE) { if(G.vd->drawtype==OB_TEXTURE && dt>OB_SOLID) { draw_mesh_textured(ob, finalDM, 0); - } - else { + } else if(G.vd->drawtype==OB_SHADED && dt>OB_SOLID) { + draw_mesh_textured(ob, finalDM, 0); + } else { glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, me->flag & ME_TWOSIDED); glEnable(GL_LIGHTING); @@ -4448,7 +4452,10 @@ static int bbs_mesh_solid_EM(DerivedMesh *dm, int facecol) if (facecol) { dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, (void*)(long) 1, 0); - if(G.scene->selectmode & SCE_SELECT_FACE && G.vd->drawtype!=OB_TEXTURE) { + if( (G.scene->selectmode & SCE_SELECT_FACE) && + (G.vd->drawtype<=OB_SOLID) && + ( !((G.vd->flag & V3D_ZBUF_SELECT) && (G.vd->drawtype==OB_SOLID)) ) + ) { glPointSize(BIF_GetThemeValuef(TH_FACEDOT_SIZE)); bglBegin(GL_POINTS); diff --git a/source/blender/src/editmesh_mods.c b/source/blender/src/editmesh_mods.c index 64ba5c5e179..ffe4bc61764 100644 --- a/source/blender/src/editmesh_mods.c +++ b/source/blender/src/editmesh_mods.c @@ -2078,8 +2078,10 @@ void mouse_mesh(void) countall(); allqueue(REDRAWVIEW3D, 0); - if (EM_texFaceCheck()) + if (EM_texFaceCheck()) { allqueue(REDRAWIMAGE, 0); + allqueue(REDRAWBUTSEDIT, 0); /* for the texture face panel */ + } } rightmouse_transform(); |