From 3a90f211d2cff5aa93bf0d52688685f9b7e92299 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 15 Sep 2007 18:12:16 +0000 Subject: new view option, SolidTex, to draw textures in solid mode. In the view panel as well as the shortcut Shift+T this works in editmode as well as object mode giving results like this http://members.optusnet.com.au/cjbarton/temp1.jpg where before you could only see textures in textured draw type like this http://members.optusnet.com.au/cjbarton/temp2.jpg --- source/blender/blenkernel/intern/DerivedMesh.c | 2 +- source/blender/makesdna/DNA_space_types.h | 35 +++++++++++++------------- source/blender/makesdna/DNA_view3d_types.h | 2 ++ source/blender/python/api2_2x/Window.c | 1 - source/blender/src/buttons_object.c | 1 - source/blender/src/drawmesh.c | 2 +- source/blender/src/drawobject.c | 13 ++++++---- source/blender/src/drawview.c | 1 + source/blender/src/header_image.c | 2 +- source/blender/src/space.c | 5 +++- 10 files changed, 36 insertions(+), 28 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index ab5a3a9a531..ff98f6f642e 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1793,7 +1793,7 @@ CustomDataMask get_viewedit_datamask() /* this includes normals for mesh_create_shadedColors */ mask |= CD_MASK_MTFACE | CD_MASK_MCOL | CD_MASK_NORMAL; } - if(view->drawtype == OB_TEXTURE) { + if((view->drawtype == OB_TEXTURE) || ((view->drawtype == OB_SOLID) && (view->flag2 & V3D_SOLID_TEX))) { mask |= CD_MASK_MTFACE | CD_MASK_MCOL; } } diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 42f08e3795e..3e8d9d50d02 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -461,24 +461,25 @@ typedef struct SpaceImaSel { #define SI_SHOW 1 /* SpaceImage->flag */ -#define SI_BE_SQUARE 1 -#define SI_EDITTILE 2 -#define SI_CLIP_UV 4 -#define SI_DRAWTOOL 8 -#define SI_STICKYUVS 16 -#define SI_DRAWSHADOW 32 -#define SI_SELACTFACE 64 -#define SI_DEPRECATED 128 -#define SI_LOCALSTICKY 256 -#define SI_COORDFLOATS 512 -#define SI_PIXELSNAP 1024 -#define SI_LIVE_UNWRAP 2048 -#define SI_USE_ALPHA 0x1000 -#define SI_SHOW_ALPHA 0x2000 -#define SI_SHOW_ZBUF 0x4000 +#define SI_BE_SQUARE 1<<0 +#define SI_EDITTILE 1<<1 +#define SI_CLIP_UV 1<<2 +#define SI_DRAWTOOL 1<<3 +#define SI_STICKYUVS 1<<4 +#define SI_DRAWSHADOW 1<<5 +#define SI_SELACTFACE 1<<6 +#define SI_DEPRECATED 1<<7 +#define SI_LOCALSTICKY 1<<8 +#define SI_COORDFLOATS 1<<9 +#define SI_PIXELSNAP 1<<10 +#define SI_LIVE_UNWRAP 1<<11 +#define SI_USE_ALPHA 1<<12 +#define SI_SHOW_ALPHA 1<<13 +#define SI_SHOW_ZBUF 1<<14 /* next two for render window dislay */ -#define SI_PREVSPACE 0x8000 -#define SI_FULLWINDOW 0x10000 +#define SI_PREVSPACE 1<<15 +#define SI_FULLWINDOW 1<<16 +#define SI_SYNC_UVSEL 1<<17 /* SpaceText flags (moved from DNA_text_types.h) */ diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index 27cd20c3210..53f2a5aceeb 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -164,10 +164,12 @@ typedef struct View3D { #define V3D_CLIPPING 16384 #define V3D_DRAW_CENTERS 32768 + /* View3d->flag2 (short) */ #define V3D_OPP_DIRECTION_NAME 1 #define V3D_FLYMODE 2 #define V3D_TRANSFORM_SNAP 4 +#define V3D_SOLID_TEX 8 /* View3d->snap_target */ #define V3D_SNAP_TARGET_CLOSEST 0 diff --git a/source/blender/python/api2_2x/Window.c b/source/blender/python/api2_2x/Window.c index cf128ec8dd2..9bcf1290bb0 100644 --- a/source/blender/python/api2_2x/Window.c +++ b/source/blender/python/api2_2x/Window.c @@ -993,7 +993,6 @@ static PyObject *M_Window_ViewLayers( PyObject * self, PyObject * args ) } if (winid==-1) { - printf("Doing WINIID NOT!!!\n"); /* set scene and viewport */ G.scene->lay = layer; if (G.vd) { diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c index 14f7e0c3f97..a998c568619 100644 --- a/source/blender/src/buttons_object.c +++ b/source/blender/src/buttons_object.c @@ -2424,7 +2424,6 @@ static void object_panel_draw(Object *ob) uiDefButBitC(block, TOG, OB_DRAWTRANSP, REDRAWVIEW3D, "Transp", 120, 40, 90, 20, &ob->dtx, 0, 0, 0, 0, "Enables transparent materials for the active object (Mesh only)"); uiDefButBitC(block, TOG, OB_DRAWXRAY, REDRAWVIEW3D, "X-ray", 210, 40, 90, 20, &ob->dtx, 0, 0, 0, 0, "Makes the active object draw in front of others"); - } void object_panel_constraint(char *context) diff --git a/source/blender/src/drawmesh.c b/source/blender/src/drawmesh.c index 99d35f834dc..f974e85293a 100644 --- a/source/blender/src/drawmesh.c +++ b/source/blender/src/drawmesh.c @@ -1201,7 +1201,7 @@ void draw_mesh_textured(Object *ob, DerivedMesh *dm, int faceselect) #endif /* draw game engine text hack - but not if we are editing the mesh */ - if (get_property(ob, "Text") && me->mtface) { + if (me->mtface && get_property(ob, "Text")) { if(ob==G.obedit) editing= 1; else if(ob==OBACT) diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c index 23c7506dcb1..b61505901c8 100644 --- a/source/blender/src/drawobject.c +++ b/source/blender/src/drawobject.c @@ -1947,9 +1947,9 @@ static void draw_em_fancy(Object *ob, EditMesh *em, DerivedMesh *cageDM, Derived EM_init_index_arrays(1, 1, 1); if(dt>OB_WIRE) { - if(G.vd->drawtype==OB_TEXTURE && dt>OB_SOLID) { - draw_mesh_textured(ob, finalDM, 0); - } else if(G.vd->drawtype==OB_SHADED && dt>OB_SOLID) { + if( (G.vd->drawtype==OB_TEXTURE && dt>OB_SOLID) || + (G.vd->drawtype==OB_SOLID && G.vd->flag2 & V3D_SOLID_TEX) + ) { draw_mesh_textured(ob, finalDM, 0); } else { glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, me->flag & ME_TWOSIDED); @@ -2257,7 +2257,10 @@ static void draw_mesh_fancy(Base *base, int dt, int flag) else if(dt==OB_WIRE || totface==0) { draw_wire = 1; } - else if( (ob==OBACT && (G.f & G_TEXTUREPAINT || FACESEL_PAINT_TEST)) || (G.vd->drawtype==OB_TEXTURE && dt>OB_SOLID)) { + else if( (ob==OBACT && (G.f & G_TEXTUREPAINT || FACESEL_PAINT_TEST)) || + (G.vd->drawtype==OB_TEXTURE && dt>OB_SOLID) || + (G.vd->drawtype==OB_SOLID && G.vd->flag2 & V3D_SOLID_TEX)) + { int faceselect= (ob==OBACT && FACESEL_PAINT_TEST); if ((G.vd->flag&V3D_SELECT_OUTLINE) && (base->flag&SELECT) && !(G.f&G_PICKSEL || FACESEL_PAINT_TEST) && !draw_wire) { @@ -4239,7 +4242,7 @@ void draw_object(Base *base, int flag) BMF_DrawString(G.font, ob->id.name+2); } } - if(dtx & OB_DRAWIMAGE) drawDispListwire(&ob->disp); + /*if(dtx & OB_DRAWIMAGE) drawDispListwire(&ob->disp);*/ if((dtx & OB_DRAWWIRE) && dt>=OB_SOLID) drawWireExtra(ob); } diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c index efef8dbcac8..de4a81abb95 100644 --- a/source/blender/src/drawview.c +++ b/source/blender/src/drawview.c @@ -2474,6 +2474,7 @@ static void view3d_panel_properties(short cntrl) // VIEW3D_HANDLER_SETTINGS uiDefButBitS(block, TOG, V3D_SELECT_OUTLINE, REDRAWVIEW3D, "Outline Selected", 10, 30, 140, 19, &vd->flag, 0, 0, 0, 0, "Highlight selected objects with an outline, in Solid, Shaded or Textured viewport shading modes"); uiDefButBitS(block, TOG, V3D_DRAW_CENTERS, REDRAWVIEW3D, "All Object Centers", 10, 10, 140, 19, &vd->flag, 0, 0, 0, 0, "Draw the center points on all objects"); uiDefButBitS(block, TOGN, V3D_HIDE_HELPLINES, REDRAWVIEW3D, "Relationship Lines", 10, -10, 140, 19, &vd->flag, 0, 0, 0, 0, "Draw dashed lines indicating Parent, Constraint, or Hook relationships"); + uiDefButBitS(block, TOG, V3D_SOLID_TEX, REDRAWVIEW3D, "Solid Tex", 10, -30, 140, 19, &vd->flag2, 0, 0, 0, 0, "Display textures in Solid draw type (Shift T)"); uiBlockEndAlign(block); uiDefBut(block, LABEL, 1, "View Locking:", 160, 50, 150, 19, NULL, 0.0, 0.0, 0, 0, ""); diff --git a/source/blender/src/header_image.c b/source/blender/src/header_image.c index 129759138a5..9b20e77dd1a 100644 --- a/source/blender/src/header_image.c +++ b/source/blender/src/header_image.c @@ -1240,7 +1240,7 @@ void image_buttons(void) /* draw LOCK */ uiDefIconButS(block, ICONTOG, 0, ICON_UNLOCKED, xco,0,XIC,YIC, &(G.sima->lock), 0, 0, 0, 0, "Updates other affected window spaces automatically to reflect changes in real time"); - + /* Always do this last */ curarea->headbutlen= xco+2*XIC; diff --git a/source/blender/src/space.c b/source/blender/src/space.c index 8997081919f..0bdd54615fb 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -2327,7 +2327,10 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt) } break; case TKEY: - if(G.obedit){ + if(G.qual == LR_SHIFTKEY) { /* toggle texture in solid draw mode */ + G.vd->flag2 ^= V3D_SOLID_TEX; + allqueue(REDRAWVIEW3D, 0); + } else if(G.obedit){ if((G.qual & LR_CTRLKEY) && G.obedit->type==OB_MESH) { convert_to_triface(G.qual & LR_SHIFTKEY); allqueue(REDRAWVIEW3D, 0); -- cgit v1.2.3