diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-04-13 23:42:39 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-04-13 23:42:39 +0400 |
commit | ebae9b1a88ff70e1c6e29bb37e89a7188e5c172f (patch) | |
tree | e4eb2c7c02f8a59a7349e05199f996727629fbb0 /source/blender/src/drawimage.c | |
parent | 4e40e6becce945930ed5aa6f6b7ee242b6b5e6b7 (diff) |
UV Editing
* Changed default UV wire drawing do be a grey line with a black outline, highlighting aroudn selected points.
* Moved some draw options out of the View menu into the View panel.
* Changed header buttons to make Vert/Face modes less confusing.
Diffstat (limited to 'source/blender/src/drawimage.c')
-rw-r--r-- | source/blender/src/drawimage.c | 152 |
1 files changed, 84 insertions, 68 deletions
diff --git a/source/blender/src/drawimage.c b/source/blender/src/drawimage.c index a3862346c93..a0b3bf123ce 100644 --- a/source/blender/src/drawimage.c +++ b/source/blender/src/drawimage.c @@ -409,12 +409,20 @@ static void drawcursor_sima(float xuser_asp, float yuser_asp) // checks if we are selecting only faces int draw_uvs_face_check(void) { - if (G.sima==NULL) + if (G.sima==NULL) { return 0; - if (G.sima->flag & SI_SYNC_UVSEL && G.scene->selectmode == SCE_SELECT_FACE) - return 2; - if (G.sima->flag & SI_SELACTFACE) - return 1; + } + if (G.sima->flag & SI_SYNC_UVSEL) { + if (G.scene->selectmode == SCE_SELECT_FACE) { + return 2; + } else if (G.scene->selectmode & SCE_SELECT_FACE) { + return 1; + } + } else { + if (G.sima->flag & SI_SELACTFACE) { + return 1; + } + } return 0; } @@ -464,6 +472,7 @@ void draw_uvs_sima(void) char col1[4], col2[4]; float pointsize; int drawface; + int lastsel, sel; if (!G.obedit || !CustomData_has_layer(&em->fdata, CD_MTFACE)) return; @@ -887,22 +896,64 @@ void draw_uvs_sima(void) } glLineWidth(1); - cpack(0xA8A8A8); - for (efa= em->faces.first; efa; efa= efa->next) { -// tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); -// if (simaFaceDraw_Check(efa, tface)) { + col2[0] = col2[1] = col2[2] = 128; col2[3] = 255; + glColor4ubv(col2); + + if (G.f & G_DRAWEDGES) { + glShadeModel(GL_SMOOTH); + BIF_GetThemeColor4ubv(TH_VERTEX_SELECT, col1); + lastsel = sel = 0; + + for (efa= em->faces.first; efa; efa= efa->next) { + // tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); + // if (simaFaceDraw_Check(efa, tface)) { + + /*this is a shortcut to do the same as above but a faster for drawing */ + if ((tface=(MTFace *)efa->tmp.p)) { + + glBegin(GL_LINE_LOOP); + sel = (simaUVSel_Check(efa, tface, 0) ? 1 : 0); + if (sel != lastsel) { glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2); lastsel = sel; } + glVertex2fv(tface->uv[0]); + + sel = simaUVSel_Check(efa, tface, 1) ? 1 : 0; + if (sel != lastsel) { glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2); lastsel = sel; } + glVertex2fv(tface->uv[1]); + + sel = simaUVSel_Check(efa, tface, 2) ? 1 : 0; + if (sel != lastsel) { glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2); lastsel = sel; } + glVertex2fv(tface->uv[2]); + + if(efa->v4) { + sel = simaUVSel_Check(efa, tface, 3) ? 1 : 0; + if (sel != lastsel) { glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2); lastsel = sel; } + glVertex2fv(tface->uv[3]); + } + + glEnd(); + } + } + glShadeModel(GL_FLAT); + } else { /* No nice edges */ - /*this is a shortcut to do the same as above but a faster for drawing */ - if ((tface=(MTFace *)efa->tmp.p)) { + for (efa= em->faces.first; efa; efa= efa->next) { + // tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); + // if (simaFaceDraw_Check(efa, tface)) { - glBegin(GL_LINE_LOOP); + /*this is a shortcut to do the same as above but a faster for drawing */ + if ((tface=(MTFace *)efa->tmp.p)) { + + glBegin(GL_LINE_LOOP); glVertex2fv(tface->uv[0]); glVertex2fv(tface->uv[1]); glVertex2fv(tface->uv[2]); - if(efa->v4) glVertex2fv(tface->uv[3]); - glEnd(); + if(efa->v4) + glVertex2fv(tface->uv[3]); + glEnd(); + } } } + break; } @@ -1079,31 +1130,6 @@ static void draw_image_transform(ImBuf *ibuf, float xuser_asp, float yuser_asp) } } -static void draw_image_view_icon(void) -{ - float xPos = 5.0; - - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - - if (G.sima->flag & SI_SYNC_UVSEL) { - /* take settings from the editmesh */ - if (G.scene->selectmode == SCE_SELECT_FACE || G.sima->flag & SI_SELACTFACE) { - BIF_icon_draw_aspect(xPos, 5.0, ICON_FACESEL_HLT, 1.0f); - } - - } else { - /* use the flags for UV mode - normal operation */ - if(G.sima->flag & SI_SELACTFACE) { - BIF_icon_draw_aspect(xPos, 5.0, ICON_FACESEL_HLT, 1.0f); - } - } - - glBlendFunc(GL_ONE, GL_ZERO); - glDisable(GL_BLEND); -} - static void draw_image_view_tool(void) { ToolSettings *settings= G.scene->toolsettings; @@ -1396,19 +1422,6 @@ static void image_panel_game_properties(short cntrl) // IMAGE_HANDLER_GAME_PROPE } } -//static void image_panel_transform_properties(short cntrl) // IMAGE_HANDLER_TRANSFORM_PROPERTIES -//{ -// uiBlock *block; -// -// block= uiNewBlock(&curarea->uiblocks, "image_transform_properties", UI_EMBOSS, UI_HELV, curarea->win); -// uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl); -// uiSetPanelHandler(IMAGE_HANDLER_TRANSFORM_PROPERTIES); // for close and esc -// if(uiNewPanel(curarea, block, "Transform Properties", "Image", 10, 10, 318, 204)==0) -// return; -// -// image_editvertex_buts(block); -//} - static void image_panel_view_properties(short cntrl) // IMAGE_HANDLER_VIEW_PROPERTIES { uiBlock *block; @@ -1434,21 +1447,29 @@ static void image_panel_view_properties(short cntrl) // IMAGE_HANDLER_VIEW_PROPE if (EM_texFaceCheck()) { - uiDefBut(block, LABEL, B_NOP, "Draw Type:", 10, 60,120,19, 0, 0, 0, 0, 0, ""); + uiDefBut(block, LABEL, B_NOP, "Draw Type:", 10, 80,120,19, 0, 0, 0, 0, 0, ""); uiBlockBeginAlign(block); - uiDefButC(block, ROW, B_REDR, "Dash", 10, 40,58,19, &G.sima->dt_uv, 0.0, SI_UVDT_DASH, 0, 0, "Dashed Wire UV drawtype"); - uiDefButC(block, ROW, B_REDR, "Black", 68, 40,58,19, &G.sima->dt_uv, 0.0, SI_UVDT_BLACK, 0, 0, "Black Wire UV drawtype"); - uiDefButC(block, ROW, B_REDR, "White", 126,40,58,19, &G.sima->dt_uv, 0.0, SI_UVDT_WHITE, 0, 0, "White Wire UV drawtype"); - uiDefButC(block, ROW, B_REDR, "Outline", 184,40,58,19, &G.sima->dt_uv, 0.0, SI_UVDT_OUTLINE, 0, 0, "Outline Wire UV drawtype"); + uiDefButC(block, ROW, B_REDR, "Outline", 10,60,58,19, &G.sima->dt_uv, 0.0, SI_UVDT_OUTLINE, 0, 0, "Outline Wire UV drawtype"); + uiDefButC(block, ROW, B_REDR, "Dash", 68, 60,58,19, &G.sima->dt_uv, 0.0, SI_UVDT_DASH, 0, 0, "Dashed Wire UV drawtype"); + uiDefButC(block, ROW, B_REDR, "Black", 126, 60,58,19, &G.sima->dt_uv, 0.0, SI_UVDT_BLACK, 0, 0, "Black Wire UV drawtype"); + uiDefButC(block, ROW, B_REDR, "White", 184,60,58,19, &G.sima->dt_uv, 0.0, SI_UVDT_WHITE, 0, 0, "White Wire UV drawtype"); + uiBlockEndAlign(block); - uiDefButBitI(block, TOG, SI_SMOOTH_UV, B_REDR, "Smooth", 250,40,60,19, &G.sima->flag, 0, 0, 0, 0, "Display smooth lines in the UV view"); + uiDefButBitI(block, TOG, SI_SMOOTH_UV, B_REDR, "Smooth", 250,60,60,19, &G.sima->flag, 0, 0, 0, 0, "Display smooth lines in the UV view"); - uiDefButBitI(block, TOG, SI_DRAW_STRETCH, B_REDR, "UV Stretch", 10,0,100,19, &G.sima->flag, 0, 0, 0, 0, "Difference between UV's and the 3D coords (blue for low distortion, red is high)"); - uiBlockBeginAlign(block); - uiDefButC(block, ROW, B_REDR, "Area", 120,0,60,19, &G.sima->dt_uvstretch, 0.0, SI_UVDT_STRETCH_AREA, 0, 0, "Area distortion between UV's and 3D coords"); - uiDefButC(block, ROW, B_REDR, "Angle", 180,0,60,19, &G.sima->dt_uvstretch, 0.0, SI_UVDT_STRETCH_ANGLE, 0, 0, "Angle distortion between UV's and 3D coords"); - uiBlockEndAlign(block); + uiDefButBitI(block, TOG, G_DRAWFACES, B_REDR, "Faces", 10,30,60,19, &G.f, 0, 0, 0, 0, "Displays all faces as shades in the 3d view and UV editor"); + uiDefButBitI(block, TOG, G_DRAWEDGES, B_REDR, "Edges", 70, 30,60,19, &G.f, 0, 0, 0, 0, "Displays selected edges using hilights and UV editor"); + + uiDefButBitI(block, TOG, SI_DRAWSHADOW, B_REDR, "Final Shadow", 130, 30,110,19, &G.sima->flag, 0, 0, 0, 0, "Draw the final result from the objects modifiers"); + + uiDefButBitI(block, TOG, SI_DRAW_STRETCH, B_REDR, "UV Stretch", 10,0,100,19, &G.sima->flag, 0, 0, 0, 0, "Difference between UV's and the 3D coords (blue for low distortion, red is high)"); + if (G.sima->flag & SI_DRAW_STRETCH) { + uiBlockBeginAlign(block); + uiDefButC(block, ROW, B_REDR, "Area", 120,0,60,19, &G.sima->dt_uvstretch, 0.0, SI_UVDT_STRETCH_AREA, 0, 0, "Area distortion between UV's and 3D coords"); + uiDefButC(block, ROW, B_REDR, "Angle", 180,0,60,19, &G.sima->dt_uvstretch, 0.0, SI_UVDT_STRETCH_ANGLE, 0, 0, "Angle distortion between UV's and 3D coords"); + uiBlockEndAlign(block); + } } image_editcursor_buts(block); @@ -1767,10 +1788,6 @@ static void image_blockhandlers(ScrArea *sa) case IMAGE_HANDLER_GAME_PROPERTIES: image_panel_game_properties(sima->blockhandler[a+1]); break; -// case IMAGE_HANDLER_TRANSFORM_PROPERTIES: -// if (EM_texFaceCheck()) -// image_panel_transform_properties(sima->blockhandler[a+1]); -// break; case IMAGE_HANDLER_VIEW_PROPERTIES: image_panel_view_properties(sima->blockhandler[a+1]); break; @@ -2321,7 +2338,6 @@ void drawimagespace(ScrArea *sa, void *spacedata) if(G.rendering==0) { draw_image_view_tool(); - draw_image_view_icon(); } draw_area_emboss(sa); |