Changes to "Face Select" mode
authorCampbell Barton <ideasman42@gmail.com>
Mon, 10 Sep 2007 19:32:44 +0000 (19:32 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 10 Sep 2007 19:32:44 +0000 (19:32 +0000)
* Does not indicate that UV's exist, nor does it add UV's when used.
* Only accessible for texturepaint, vertexpaint and weightpaint from a button in the header (Paint Selection Mask)
* Not accessible from the mode menu, this is only an option that applies to paint modes.

This dosnt effect DNA, face select (G_FACESELECT) can be enabled at any time but is only used when paint modes are enabled.

Other changes
* UKey is uv unwrap in editmode, Ukey for undo was editmode only anyway.
* UVCalc in editmode adds a UV Layer if there is not one alredy.
* texture draw in editmode does not draw the face dots (they are get in the way of texturing)
* some missing updates were added.
* removed manipulator from when paint modes are enabled since the manipulator is not drawn in the 3d view.

29 files changed:
source/blender/blenkernel/BKE_global.h
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/include/BDR_editface.h
source/blender/python/api2_2x/Mesh.c
source/blender/src/buttons_editing.c
source/blender/src/buttons_shading.c
source/blender/src/drawmesh.c
source/blender/src/drawobject.c
source/blender/src/drawscene.c
source/blender/src/drawview.c
source/blender/src/edit.c
source/blender/src/editarmature.c
source/blender/src/editface.c
source/blender/src/editmesh.c
source/blender/src/editmesh_add.c
source/blender/src/editmesh_mods.c
source/blender/src/editobject.c
source/blender/src/editscreen.c
source/blender/src/editsima.c
source/blender/src/editview.c
source/blender/src/header_info.c
source/blender/src/header_view3d.c
source/blender/src/outliner.c
source/blender/src/poseobject.c
source/blender/src/space.c
source/blender/src/toolbox.c
source/blender/src/transform_manipulator.c
source/blender/src/unwrapper.c
source/blender/src/view.c

index a1392bb0a983b3da8031d8318ee5ea79ce1ee06d..153446caec51852f6076019c9de40a3388d433e2 100644 (file)
@@ -176,6 +176,7 @@ typedef struct Global {
 #define G_DRAWSEAMS     (1 << 20)
 #define G_HIDDENEDGES   (1 << 21)
 
+
 /* Measurement info Drawing */
 #define G_DRAW_EDGELEN  (1 << 22) 
 #define G_DRAW_FACEAREA (1 << 23)
@@ -193,6 +194,11 @@ typedef struct Global {
 
 #define G_AUTOMATKEYS  (1 << 30)
 
+/* macro for testing face select mode
+ * Texture paint could be removed since selected faces are not used
+ * however hiding faces is useful */
+#define FACESEL_PAINT_TEST ((G.f&G_FACESELECT) && (G.f & (G_VERTEXPAINT|G_WEIGHTPAINT|G_TEXTUREPAINT))) 
+
 /* G.fileflags */
 
 #define G_AUTOPACK               (1 << 0)
index 25826037d5f75559feaedf1673fa3f628d2693d6..ab5a3a9a53159ae7a8c9178bbbf3d550924ec23c 100644 (file)
@@ -1782,7 +1782,7 @@ CustomDataMask get_viewedit_datamask()
        ScrArea *sa;
 
        /* check if we need tfaces & mcols due to face select or texture paint */
-       if(G.f & G_FACESELECT || G.f & G_TEXTUREPAINT) {
+       if(FACESEL_PAINT_TEST || G.f & G_TEXTUREPAINT) {
                mask |= CD_MASK_MTFACE | CD_MASK_MCOL;
        } else {
                /* check if we need tfaces & mcols due to view mode */
@@ -2325,7 +2325,7 @@ static void mesh_build_data(Object *ob, CustomDataMask dataMask)
 
        if(ob!=G.obedit) {
                Object *obact = G.scene->basact?G.scene->basact->object:NULL;
-               int editing = (G.f & (G_FACESELECT|G_WEIGHTPAINT|G_VERTEXPAINT|G_TEXTUREPAINT));
+               int editing = (FACESEL_PAINT_TEST);
                int needMapping = editing && (ob==obact);
 
                if( (G.f & G_WEIGHTPAINT) && ob==obact ) {
index 3ab3343e9966bf674358a7716df2d5e6b1bec0fe..701b32678e42deff11004c0e862aaf55e176724a 100644 (file)
@@ -53,7 +53,6 @@ int minmax_tface(float *min, float *max);
 void face_select(void);
 void face_borderselect(void);
 void uv_autocalc_tface(void);
-void set_faceselect(void);
 void set_texturepaint(void);
 void get_same_uv(void);  
 void seam_mark_clear_tface(short mode);
index 7afd2f07e370c9a2616ad742f2d50167ed8f1842..8fb262fd40ce9ada5b0ee45f2c67074272713174 100644 (file)
@@ -6925,7 +6925,7 @@ static PyObject *Mesh_removeLayer_internal( BPy_Mesh * self, PyObject * value, i
                        if(type == CD_MCOL && (G.f & G_VERTEXPAINT))
                                G.f &= ~G_VERTEXPAINT; /* get out of vertexpaint mode */
                        if(type == CD_MTFACE && (G.f & G_FACESELECT))
-                               set_faceselect();  /* get out of faceselect mode */
+                               G.f |= ~G_FACESELECT; /* get out of faceselect mode */
                }
        }
        
index 122ad6e3a50adea161c4e79413778ba9138bf88c..80c5c88bc69777447f57d7876f199a31c6a07500 100644 (file)
@@ -536,7 +536,7 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
                        if(G.obedit->type == OB_MESH) reveal_mesh();
                        else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) revealNurb();
                }
-               else if(G.f & G_FACESELECT) reveal_tface();
+               else if(FACESEL_PAINT_TEST) reveal_tface();
                
                break;
        case B_SELSWAP:
@@ -719,8 +719,6 @@ static void delete_customdata_layer(void *data1, void *data2)
        if(!CustomData_has_layer(data, type)) {
                if(type == CD_MCOL && (G.f & G_VERTEXPAINT))
                        G.f &= ~G_VERTEXPAINT; /* get out of vertexpaint mode */
-               /*if(type == CD_MTFACE && (G.f & G_FACESELECT))
-                       set_faceselect();*/  /* get out of faceselect mode */
        }
 
        /*reconstruct active layer*/
@@ -4875,7 +4873,7 @@ void do_fpaintbuts(unsigned short event)
                }
                break;
        case B_SET_VCOL:
-               if(G.f & G_FACESELECT) 
+               if(FACESEL_PAINT_TEST) 
                        clear_vpaint_selectedfaces();
                else
                        clear_vpaint();
@@ -5473,7 +5471,7 @@ void editing_panels()
                        uiNewPanelTabbed("Multires", "Editing");
                        editing_panel_sculpting_textures();
                } else {
-                       if(G.f & G_FACESELECT) {
+                       if(FACESEL_PAINT_TEST) {
                                editing_panel_mesh_texface();
                                editing_panel_mesh_uvautocalculation(); /* draw hidden edge option from this needs to be elsewhere */
                        }
index 3f5be1fe7b0e5a5cb73f7ab04674c512e5dbac6d..5addf7fafee6a4c7155f78b419036a40f1e6168c 100644 (file)
@@ -1161,7 +1161,7 @@ void uiblock_image_panel(uiBlock *block, Image **ima_pp, ImageUser *iuser,
                 }
                 
                 /* exception, let's do because we only use this panel 3 times in blender... but not real good code! */
-                if( (G.f & G_FACESELECT) && G.sima && &G.sima->iuser==iuser)
+                if( (FACESEL_PAINT_TEST) && G.sima && &G.sima->iuser==iuser)
                         return;
                 /* left side default per-image options, right half the additional options */
                 
index 41e08a9ab18846ec1f7b822df4003ea927429463..8b38d925c0ec6073f97be6000709d63cdb7eeaa7 100644 (file)
@@ -1205,7 +1205,7 @@ void draw_mesh_textured(Object *ob, DerivedMesh *dm, int faceselect)
                if(ob==G.obedit)
                        editing= 1;
                else if(ob==OBACT)
-                       if(G.f & (G_VERTEXPAINT+G_FACESELECT+G_TEXTUREPAINT+G_WEIGHTPAINT))
+                       if(FACESEL_PAINT_TEST)
                                editing= 1;
 
                if(!editing)
index 1f7a3df73a9d923467aae9b56286e30218704176..ded36ed5a0275f8292e5c7f64179bb3323186f04 100644 (file)
@@ -1632,7 +1632,7 @@ static void draw_em_fancy_verts(EditMesh *em, DerivedMesh *cageDM)
                                draw_dm_verts(cageDM, sel);
                        }
                        
-                       if(G.scene->selectmode & SCE_SELECT_FACE) {
+                       if(G.scene->selectmode & SCE_SELECT_FACE && G.vd->drawtype!=OB_TEXTURE) {
                                glPointSize(fsize);
                                glColor4ubv((GLubyte *)fcol);
                                draw_dm_face_centers(cageDM, sel);
@@ -1974,7 +1974,7 @@ static void draw_em_fancy(Object *ob, EditMesh *em, DerivedMesh *cageDM, Derived
                }
        }
        
-       if((G.f & (G_FACESELECT+G_DRAWFACES))) {        /* transp faces */
+       if((G.f & (G_DRAWFACES)) || FACESEL_PAINT_TEST) {       /* transp faces */
                unsigned char col1[4], col2[4];
                        
                BIF_GetThemeColor4ubv(TH_FACE, (char *)col1);
@@ -2120,7 +2120,7 @@ static void draw_mesh_fancy(Base *base, int dt, int flag)
                glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
 
                // Unwanted combination.
-       if (ob==OBACT && (G.f&G_FACESELECT)) draw_wire = 0;
+       if (ob==OBACT && FACESEL_PAINT_TEST) draw_wire = 0;
 
        if(dt==OB_BOUNDBOX) {
                draw_bounding_volume(ob);
@@ -2133,10 +2133,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_FACESELECT|G_TEXTUREPAINT))) || (G.vd->drawtype==OB_TEXTURE && dt>OB_SOLID)) {
-               int faceselect= (ob==OBACT && (G.f & G_FACESELECT));
+       else if( (ob==OBACT && (G.f & G_TEXTUREPAINT || FACESEL_PAINT_TEST)) || (G.vd->drawtype==OB_TEXTURE && dt>OB_SOLID)) {
+               int faceselect= (ob==OBACT && FACESEL_PAINT_TEST);
 
-               if ((G.vd->flag&V3D_SELECT_OUTLINE) && (base->flag&SELECT) && !(G.f&(G_FACESELECT|G_PICKSEL)) && !draw_wire) {
+               if ((G.vd->flag&V3D_SELECT_OUTLINE) && (base->flag&SELECT) && !(G.f&G_PICKSEL || FACESEL_PAINT_TEST) && !draw_wire) {
                        draw_mesh_object_outline(ob, dm);
                }
 
@@ -3881,7 +3881,7 @@ void draw_object(Base *base, int flag)
        dtx= 0;
 
        /* faceselect exception: also draw solid when dt==wire, except in editmode */
-       if(ob==OBACT && (G.f & (G_FACESELECT+G_VERTEXPAINT+G_TEXTUREPAINT+G_WEIGHTPAINT))) {
+       if(ob==OBACT && (G.f & (G_VERTEXPAINT+G_TEXTUREPAINT+G_WEIGHTPAINT))) {
                if(ob->type==OB_MESH) {
 
                        if(ob==G.obedit);
@@ -4142,7 +4142,7 @@ void draw_object(Base *base, int flag)
        if(G.f & G_SIMULATION) return;
 
        /* object centers, need to be drawn in viewmat space for speed, but OK for picking select */
-       if(ob!=OBACT || (G.f & (G_VERTEXPAINT|G_FACESELECT|G_TEXTUREPAINT|G_WEIGHTPAINT))==0) {
+       if(ob!=OBACT || (G.f & (G_VERTEXPAINT|G_TEXTUREPAINT|G_WEIGHTPAINT))==0) {
                int do_draw_center= -1; /* defines below are zero or positive... */
 
                if((G.scene->basact)==base) 
@@ -4327,7 +4327,7 @@ 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) {
+               if(G.scene->selectmode & SCE_SELECT_FACE && G.vd->drawtype!=OB_TEXTURE) {
                        glPointSize(BIF_GetThemeValuef(TH_FACEDOT_SIZE));
                
                        bglBegin(GL_POINTS);
@@ -4367,6 +4367,7 @@ static int bbs_mesh_wire__setDrawOpts(void *userData, int index)
                return 0;
 }
 
+/* TODO remove this - since face select mode now only works with painting */
 static void bbs_mesh_solid(Object *ob)
 {
        DerivedMesh *dm = mesh_get_derived_final(ob, get_viewedit_datamask());
index b2d8920c1a28cc1ccb1d1a8cee038ceb35bc18c2..297dfcb7fb2b4c9145ccbe0769fe24124fde3402 100644 (file)
@@ -74,8 +74,6 @@ void set_scene(Scene *sce)            /* also see scene.c: set_scene_bg() */
        if( G.obedit) 
                exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);
        
-       if(G.f & G_FACESELECT)
-               set_faceselect();
        if(G.f & G_VERTEXPAINT)
                set_vpaint();
        if(G.f & G_TEXTUREPAINT)
index f927c53747021efd88fb2f26a54755df5be71890..910e8fca1c2fd2fa3f58d7e74996fe9038061fbd 100644 (file)
@@ -1077,7 +1077,7 @@ void backdrawview3d(int test)
        int m;
 #endif
 
-       if(G.f & (G_VERTEXPAINT|G_FACESELECT|G_TEXTUREPAINT|G_WEIGHTPAINT));
+       if(G.f & G_VERTEXPAINT || G.f & G_WEIGHTPAINT || G.f & G_TEXTUREPAINT);
        else if(G.obedit && G.vd->drawtype>OB_WIRE && (G.vd->flag & V3D_ZBUF_SELECT));
        else {
                G.vd->flag &= ~V3D_NEEDBACKBUFDRAW;
@@ -2238,7 +2238,7 @@ static void view3d_panel_object(short cntrl)      // VIEW3D_HANDLER_OBJECT
 
        uiSetButLock(object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
        
-       if(G.f & (G_VERTEXPAINT|G_FACESELECT|G_TEXTUREPAINT|G_WEIGHTPAINT)) {
+       if(G.f & (G_VERTEXPAINT|G_TEXTUREPAINT|G_WEIGHTPAINT)) {
                uiBlockSetFlag(block, UI_BLOCK_FRONTBUFFER);    // force old style frontbuffer draw
        }
        else {
@@ -2383,7 +2383,7 @@ static void view3d_panel_background(short cntrl)  // VIEW3D_HANDLER_BACKGROUND
        uiSetPanelHandler(VIEW3D_HANDLER_BACKGROUND);  // for close and esc
        if(uiNewPanel(curarea, block, "Background Image", "View3d", 340, 10, 318, 204)==0) return;
 
-       if(G.f & (G_VERTEXPAINT|G_FACESELECT|G_TEXTUREPAINT|G_WEIGHTPAINT)) {
+       if(G.f & G_VERTEXPAINT || G.f & G_WEIGHTPAINT || G.f & G_TEXTUREPAINT) {
                uiBlockSetFlag(block, UI_BLOCK_FRONTBUFFER);    // force old style frontbuffer draw
        }
        
@@ -3018,7 +3018,7 @@ void drawview3dspace(ScrArea *sa, void *spacedata)
 
        sa->win_swap= WIN_BACK_OK;
        
-       if(G.f & (G_VERTEXPAINT|G_FACESELECT|G_TEXTUREPAINT|G_WEIGHTPAINT)) {
+       if(G.f & G_VERTEXPAINT || G.f & G_WEIGHTPAINT || G.f & G_TEXTUREPAINT) {
                v3d->flag |= V3D_NEEDBACKBUFDRAW;
                addafterqueue(sa->win, BACKBUFDRAW, 1);
        }
index ca6239b5580dfd3f49429757fec4511cd4067fa7..fb62c33abe82ed4ca0cb5b61a4058a1c91be8413 100644 (file)
@@ -422,7 +422,7 @@ int get_border(rcti *rect, short flag)
                                        circle_selectCB(&obedit_selectionCB);
                                }
                        }
-                       else if (G.f&G_FACESELECT) {
+                       else if (FACESEL_PAINT_TEST) {
                                circle_selectCB(&obedit_selectionCB);
                        }
                        return 0;
@@ -769,7 +769,7 @@ void countall()
                allqueue(REDRAWINFO, 1);        /* 1, because header->win==0! */
                return;
        }
-       else if(G.f & (G_FACESELECT + G_VERTEXPAINT + G_TEXTUREPAINT +G_WEIGHTPAINT)) {
+       else if(FACESEL_PAINT_TEST) {
                me= get_mesh((G.scene->basact) ? (G.scene->basact->object) : 0);
                if(me) {
                        G.totface= me->totface;
index 1b674f404b82ae9d86a524a9d44c9532b08af298..12d58ad535a677ab1f63796ba11ce0016db3de4f 100644 (file)
@@ -1480,7 +1480,7 @@ void add_primitiveArmature(int type)
        if ELEM(curarea->spacetype, SPACE_VIEW3D, SPACE_INFO); else return;
        if(G.vd==NULL) return;
        
-       G.f &= ~(G_VERTEXPAINT+G_FACESELECT+G_TEXTUREPAINT+G_WEIGHTPAINT);
+       G.f &= ~(G_VERTEXPAINT+G_TEXTUREPAINT+G_WEIGHTPAINT);
        setcursor_space(SPACE_VIEW3D, CURSOR_STD);
 
        check_editmode(OB_ARMATURE);
index b22a3b30f0badd3a7ae5238000da6105ac10938a..2a0a043295513174850f201e8656e4c8aafe9f14 100644 (file)
@@ -66,6 +66,7 @@
 #include "BKE_object.h"
 #include "BKE_texture.h"
 #include "BKE_utildefines.h"
+#include "BKE_customdata.h"
 
 #include "BSE_view.h"
 #include "BSE_edit.h"
@@ -340,7 +341,6 @@ static void uv_calc_shift_project(float *target, float *shift, float rotmat[][4]
 void calculate_uv_map(unsigned short mapmode)
 {
        MTFace *tface;
-       /*MFace *mface;*/
        Object *ob;
        float dx, dy, rotatematrix[4][4], radius= 1.0, min[3], cent[3], max[3];
        float fac= 1.0, upangledeg= 0.0, sideangledeg= 90.0;
@@ -358,8 +358,16 @@ void calculate_uv_map(unsigned short mapmode)
                else sideangledeg= 90.0;
        }
        
+       /* add uvs if there not here */
+       if (!EM_texFaceCheck()) {
+               if (em && em->faces.first)
+                       EM_add_data_layer(&em->fdata, CD_MTFACE);
+               
+               if (!EM_texFaceCheck())
+                       return;
+       }
+       
        ob=OBACT;
-       if (!EM_texFaceCheck()) return;
        
        switch(mapmode) {
        case B_UVAUTO_BOUNDS:
@@ -1415,51 +1423,6 @@ void uv_autocalc_tface()
        }
 }
 
-void set_faceselect()  /* toggle */
-{
-       Object *ob = OBACT;
-       Mesh *me = 0;
-       
-       if(ob==NULL) return;
-       if(object_data_is_libdata(ob)) {
-               error_libdata();
-               return;
-       }
-       
-       me= get_mesh(ob);
-       
-       scrarea_queue_headredraw(curarea);
-       
-       if(me) /* make sure modifiers are updated for mapping requirements */
-               DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
-
-       if(G.f & G_FACESELECT) {
-               G.f &= ~G_FACESELECT;
-
-               if((G.f & (G_WEIGHTPAINT|G_VERTEXPAINT|G_TEXTUREPAINT))==0) {
-                       if(me)
-                               reveal_tface();
-                       setcursor_space(SPACE_VIEW3D, CURSOR_STD);
-                       BIF_undo_push("End UV Faceselect");
-               }
-       }
-       else if (me && (ob->lay & G.vd->lay)) {
-               G.f |= G_FACESELECT;
-               /*
-               if(me->mtface==NULL)
-                       make_tfaces(me);
-               */
-               setcursor_space(SPACE_VIEW3D, CURSOR_FACESEL);
-               BIF_undo_push("Set UV Faceselect");
-       }
-
-       countall();
-
-       allqueue(REDRAWVIEW3D, 0);
-       allqueue(REDRAWBUTSEDIT, 0);
-       /*allqueue(REDRAWIMAGE, 0);*/
-}
-
 /* Texture Paint */
 
 void set_texturepaint() /* toggle */
index bc492dd859eab3d5c381873c1a6c95d7cbdbf34f..f0ecb6164717e6925778c1847394e21ba31f79de 100644 (file)
@@ -838,7 +838,7 @@ void make_editMesh()
                evlist[a]= eve;
                
                // face select sets selection in next loop
-               if( (G.f & G_FACESELECT)==0 )
+               if( (FACESEL_PAINT_TEST)==0 )
                        eve->f |= (mvert->flag & 1);
                
                if (mvert->flag & ME_HIDE) eve->h= 1;           
@@ -904,7 +904,7 @@ void make_editMesh()
                                }
                                if(mface->flag & ME_HIDE) efa->h= 1;
 
-                               if((G.f & G_FACESELECT) && (efa->f & SELECT))
+                               if((FACESEL_PAINT_TEST) && (efa->f & SELECT))
                                        EM_select_face(efa, 1); /* flush down */
                        }
                }
index bb1d5d00957ffd6563ca902f0abce9319cc8e7ac..49913b345edf9ca86943b7269e33e5bd21b7a941 100644 (file)
@@ -1188,8 +1188,8 @@ void add_primitiveMesh(int type)
        /* if editmode exists for other type, it exits */
        check_editmode(OB_MESH);
        
-       if(G.f & (G_VERTEXPAINT+G_FACESELECT+G_TEXTUREPAINT)) {
-               G.f &= ~(G_VERTEXPAINT+G_FACESELECT+G_TEXTUREPAINT);
+       if(G.f & (G_VERTEXPAINT+G_TEXTUREPAINT)) {
+               G.f &= ~(G_VERTEXPAINT+G_TEXTUREPAINT);
                setcursor_space(SPACE_VIEW3D, CURSOR_EDIT);
        }
 
index e5e84b5c9b738e674f7ac2b65e7f03e8e3f24460..77f53df011b584452695fe6819ba3fd71a72bd29 100644 (file)
@@ -240,7 +240,7 @@ int EM_mask_init_backbuf_border(short mcords[][2], short tot, short xmin, short
        
        /* method in use for face selecting too */
        if(G.obedit==NULL) {
-               if(G.f & G_FACESELECT);
+               if(FACESEL_PAINT_TEST);
                else return 0;
        }
        else if(G.vd->drawtype<OB_SOLID || (G.vd->flag & V3D_ZBUF_SELECT)==0) return 0;
@@ -302,7 +302,7 @@ int EM_init_backbuf_circle(short xs, short ys, short rads)
        
        /* method in use for face selecting too */
        if(G.obedit==NULL) {
-               if(G.f & G_FACESELECT);
+               if(FACESEL_PAINT_TEST);
                else return 0;
        }
        else if(G.vd->drawtype<OB_SOLID || (G.vd->flag & V3D_ZBUF_SELECT)==0) return 0;
@@ -697,7 +697,7 @@ static void unified_select_draw(EditVert *eve, EditEdge *eed, EditFace *efa)
                        }
                }
                
-               if(G.scene->selectmode & SCE_SELECT_FACE) {
+               if(G.scene->selectmode & SCE_SELECT_FACE && (G.vd->drawtype!=OB_TEXTURE)) {
                        if(efa->fgonf==0) {
                                glPointSize(BIF_GetThemeValuef(TH_FACEDOT_SIZE));
                                BIF_ThemeColor((efa->f & SELECT)?TH_FACE_DOT:TH_WIRE);
@@ -1311,6 +1311,8 @@ void select_mesh_group_menu()
                        EM_select_flush(); /* so that selected verts, go onto select faces */
                        G.totvertsel += selcount;
                        allqueue(REDRAWVIEW3D, 0);
+                       if (EM_texFaceCheck())
+                               allqueue(REDRAWIMAGE, 0);
                        BIF_undo_push("Select Similar Vertices");
                }
                return;
@@ -1323,6 +1325,8 @@ void select_mesh_group_menu()
                        /*EM_select_flush();*/ /* dont use because it can end up selecting more edges and is not usefull*/
                        G.totedgesel+=selcount;
                        allqueue(REDRAWVIEW3D, 0);
+                       if (EM_texFaceCheck())
+                               allqueue(REDRAWIMAGE, 0);
                        BIF_undo_push("Select Similar Edges");
                }
                return;
@@ -1658,8 +1662,9 @@ static void mouse_mesh_loop(void)
                
                EM_selectmode_flush();
                countall();
-               
                allqueue(REDRAWVIEW3D, 0);
+               if (EM_texFaceCheck())
+                       allqueue(REDRAWIMAGE, 0);
        }
 }
 
@@ -1767,6 +1772,8 @@ static void selectconnectedAll(void)
        countall();
 
        allqueue(REDRAWVIEW3D, 0);
+       if (EM_texFaceCheck())
+               allqueue(REDRAWIMAGE, 0);
        BIF_undo_push("Select Connected (All)");
 }
 
@@ -1989,6 +1996,8 @@ void reveal_mesh(void)
        countall();
 
        allqueue(REDRAWVIEW3D, 0);
+       if (EM_texFaceCheck())
+               allqueue(REDRAWIMAGE, 0);
        DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA);     
        BIF_undo_push("Reveal");
 }
@@ -2716,6 +2725,8 @@ void EM_selectmode_menu(void)
                }
                
                allqueue(REDRAWVIEW3D, 1);
+               if (EM_texFaceCheck())
+                       allqueue(REDRAWIMAGE, 0);
        }
 }
 
index 1bb546982f8f5f2c0f0fe3a7a5ec735a4945d607..762a3a1d4a9d00c3ab6c7289bf401f83e5eba447 100644 (file)
@@ -186,7 +186,7 @@ void add_object_draw(int type)      /* for toolbox or menus, only non-editmode stuff
 {
        Object *ob;
        
-       G.f &= ~(G_VERTEXPAINT+G_FACESELECT+G_TEXTUREPAINT+G_WEIGHTPAINT+G_SCULPTMODE);
+       G.f &= ~(G_VERTEXPAINT+G_TEXTUREPAINT+G_WEIGHTPAINT+G_SCULPTMODE);
        setcursor_space(SPACE_VIEW3D, CURSOR_STD);
 
        if ELEM3(curarea->spacetype, SPACE_VIEW3D, SPACE_BUTS, SPACE_INFO) {
@@ -306,7 +306,7 @@ void delete_obj(int ok)
        }
        countall();
 
-       G.f &= ~(G_VERTEXPAINT+G_FACESELECT+G_TEXTUREPAINT+G_WEIGHTPAINT);
+       G.f &= ~(G_VERTEXPAINT+G_TEXTUREPAINT+G_WEIGHTPAINT);
        setcursor_space(SPACE_VIEW3D, CURSOR_STD);
        
        if(islamp) reshadeall_displist();       /* only frees displist */
@@ -2201,7 +2201,7 @@ void special_editmenu(void)
                if(ob->flag & OB_POSEMODE) {
                        pose_special_editmenu();
                }
-               else if(G.f & G_FACESELECT) {
+               else if(FACESEL_PAINT_TEST) {
                        Mesh *me= get_mesh(ob);
                        MTFace *tface;
                        MFace *mface;
@@ -3411,7 +3411,7 @@ void copy_attr_menu()
        
        if ((G.obedit)) return; /* no editmode copy yet */
        
-       if(G.f & G_FACESELECT) {
+       if(FACESEL_PAINT_TEST) {
                event= pupmenu("Copy Active Texface%t|Image%x1|UV Coords%x2|Color%x3|Mode%x4|Transp%x5");
                copy_attr_tface(event);
        
index 44069beaf43c56be0e0fc3f497a226c3e2b3bfc9..b877915b1d6fe35af805f8286acfb405f3f3f607 100644 (file)
@@ -176,7 +176,7 @@ static int choose_cursor(ScrArea *sa)
                if(G.obedit) return CURSOR_EDIT;
                else if(G.f & (G_VERTEXPAINT|G_WEIGHTPAINT|G_TEXTUREPAINT))
                                return CURSOR_VPAINT;
-               else if(G.f & G_FACESELECT) return CURSOR_FACESEL;
+               else if(FACESEL_PAINT_TEST) return CURSOR_FACESEL;
                else if(G.f & G_SCULPTMODE) return CURSOR_EDIT;
                else return CURSOR_STD;
        }
index 6da1af19e3aa99d1463eb0a61dc43c8d016c7d94..ed5a1c73cb9f1ba86666ab2956b3b21d5f803183 100644 (file)
@@ -140,7 +140,7 @@ int is_uv_tface_editing_allowed_silent(void)
 
 int is_uv_tface_editing_allowed(void)
 {
-       if(!G.obedit) error("Unable to perform action in Edit Mode");
+       if(!G.obedit) error("Enter Edit Mode to perform this action");
 
        return is_uv_tface_editing_allowed_silent();
 }
index 80bebf0ec68f878f52093d12b360e1a85c57038e..176821e0cc963913c6ca3a402def90633b4ff1be 100644 (file)
@@ -575,7 +575,7 @@ static void do_lasso_select_facemode(short mcords[][2], short moves, short selec
 static void do_lasso_select(short mcords[][2], short moves, short select)
 {
        if(G.obedit==NULL) {
-               if(G.f & G_FACESELECT)
+               if(FACESEL_PAINT_TEST)
                        do_lasso_select_facemode(mcords, moves, select);
                else if(G.f & (G_VERTEXPAINT|G_TEXTUREPAINT|G_WEIGHTPAINT))
                        ;
@@ -1102,10 +1102,6 @@ void set_active_base(Base *base)
                        if(G.f & G_TEXTUREPAINT) 
                                set_texturepaint(); /* Switch off tex paint */
                }
-               /* always end this */
-               if(G.f & G_FACESELECT) {
-                       set_faceselect();       /* toggle */
-               }
        }
        
        /* sets scene->basact */
@@ -1670,7 +1666,7 @@ void borderselect(void)
        int a, index;
        short hits, val;
 
-       if(G.obedit==NULL && (G.f & G_FACESELECT)) {
+       if(G.obedit==NULL && (FACESEL_PAINT_TEST)) {
                face_borderselect();
                return;
        }
@@ -1683,8 +1679,11 @@ void borderselect(void)
        val= get_border(&rect, 3);
        if (!a) setlinestyle(0);
        
-       if(val==0)
+       if(val==0) {
+               if (EM_texFaceCheck())
+                       allqueue(REDRAWIMAGE, 0);
                return;
+       }
        
        if(G.obedit) {
                if(G.obedit->type==OB_MESH) {
@@ -1919,7 +1918,7 @@ static void mesh_selectionCB(int selecting, Object *editobj, short *mval, float
        EditMesh *em = G.editMesh;
        int bbsel;
 
-       if(!G.obedit && (G.f&G_FACESELECT)) {
+       if(!G.obedit && (FACESEL_PAINT_TEST)) {
                Mesh *me = get_mesh(OBACT);
 
                if (me) {
index 685da07f88f27b659e2ded8b37d443cec7f40791..f4a572873d50057311ee64cfcb3e0658ac78564e 100644 (file)
@@ -489,7 +489,6 @@ void do_info_buttons(unsigned short event)
                        if(G.f & G_VERTEXPAINT) set_vpaint(); /* Switch off vertex paint */
                        if(G.f & G_TEXTUREPAINT) set_texturepaint(); /* Switch off tex paint */
                        if(G.f & G_WEIGHTPAINT) set_wpaint();           /* Switch off weight paint */
-                       if(G.f & G_FACESELECT) set_faceselect(); /* Switch off face select */
                        
                        /* check all sets */
                        sce1= G.main->scene.first;
index c5b45b7ff33f75d2211db87c8d04b24d578e9327..a9aae6d21878a44de40712398692e0f2d1dc4a58 100644 (file)
 #define V3D_OBJECTMODE_SEL                     ICON_OBJECT
 #define V3D_EDITMODE_SEL                       ICON_EDITMODE_HLT
 #define V3D_SCULPTMODE_SEL                     ICON_SCULPTMODE_HLT
-#define V3D_FACESELECTMODE_SEL         ICON_FACESEL_HLT
+#define V3D_FACESELECT_SEL                     ICON_FACESEL_HLT        /* this is not a mode anymore - just a switch */
 #define V3D_VERTEXPAINTMODE_SEL                ICON_VPAINT_HLT
 #define V3D_TEXTUREPAINTMODE_SEL       ICON_TPAINT_HLT
 #define V3D_WEIGHTPAINTMODE_SEL                ICON_WPAINT_HLT
@@ -385,7 +385,7 @@ static void do_view3d_view_alignviewmenu(void *arg, int event)
        case 2:
                if ((G.obedit) && (G.obedit->type == OB_MESH)) {
                        editmesh_align_view_to_selected(v3d, event);
-               } else if (G.f & G_FACESELECT) {
+               } else if (FACESEL_PAINT_TEST) {
                        Object *obact= OBACT;
                        if (obact && obact->type==OB_MESH) {
                                Mesh *me= obact->data;
@@ -437,7 +437,7 @@ static uiBlock *view3d_view_alignviewmenu(void *arg_unused)
        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)) {
+       if (((G.obedit) && (G.obedit->type == OB_MESH)) || (FACESEL_PAINT_TEST)) {
                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, "");
@@ -4081,7 +4081,7 @@ static void do_view3d_vpaintmenu(void *arg, int event)
                BIF_undo();
                break;
        case 1: /* set vertex colors/weight */
-               if(G.f & G_FACESELECT)
+               if(FACESEL_PAINT_TEST)
                        clear_vpaint_selectedfaces();
                else /* we know were in vertex paint mode */
                        clear_vpaint();
@@ -4203,7 +4203,7 @@ static uiBlock *view3d_wpaintmenu(void *arg_unused)
        
        uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
        
-       if (G.f & G_FACESELECT) {
+       if (FACESEL_PAINT_TEST) {
                uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Weight|Shift K",             0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
                uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
                menunr++;
@@ -4671,7 +4671,7 @@ static char *view3d_modeselect_pup(void)
        if (ob->type == OB_MESH) {
 
                str += sprintf(str, formatstr, "Sculpt Mode", V3D_SCULPTMODE_SEL, ICON_SCULPTMODE_HLT);
-               str += sprintf(str, formatstr, "Face Select", V3D_FACESELECTMODE_SEL, ICON_FACESEL_HLT);
+               /*str += sprintf(str, formatstr, "Face Select", V3D_FACESELECTMODE_SEL, ICON_FACESEL_HLT);*/
                str += sprintf(str, formatstr, "Vertex Paint", V3D_VERTEXPAINTMODE_SEL, ICON_VPAINT_HLT);
                str += sprintf(str, formatstr, "Texture Paint", V3D_TEXTUREPAINTMODE_SEL, ICON_TPAINT_HLT);
                str += sprintf(str, formatstr, "Weight Paint", V3D_WEIGHTPAINTMODE_SEL, ICON_WPAINT_HLT);
@@ -4798,7 +4798,7 @@ void do_view3d_buttons(short event)
                if (select_area(SPACE_VIEW3D)) {
                                start_game();
                }
-               break;          
+               break;
        case B_MODESELECT:
                if (G.vd->modeselect == V3D_OBJECTMODE_SEL) {
                        
@@ -4807,7 +4807,6 @@ void do_view3d_buttons(short event)
                        if(G.f & G_VERTEXPAINT) set_vpaint(); /* Switch off vertex paint */
                        if(G.f & G_TEXTUREPAINT) set_texturepaint(); /* Switch off tex paint */
                        if(G.f & G_WEIGHTPAINT) set_wpaint();           /* Switch off weight paint */
-                       if(G.f & G_FACESELECT) set_faceselect(); /* Switch off face select */
                        if(ob) exit_posemode();         /* exit posemode for active object */
                        if(G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);      /* exit editmode and undo */
                } 
@@ -4826,7 +4825,6 @@ void do_view3d_buttons(short event)
                else if (G.vd->modeselect == V3D_SCULPTMODE_SEL) {
                        if (!(G.f & G_SCULPTMODE)) {
                                G.vd->flag &= ~V3D_MODE;
-                               if(G.f & G_FACESELECT) set_faceselect(); /* Switch off face select */
                                if(G.f & G_VERTEXPAINT) set_vpaint(); /* Switch off vertex paint */
                                if(G.f & G_TEXTUREPAINT) set_texturepaint(); /* Switch off tex paint */
                                if(G.f & G_WEIGHTPAINT) set_wpaint();           /* Switch off weight paint */
@@ -4834,25 +4832,7 @@ void do_view3d_buttons(short event)
                                        
                                set_sculptmode();
                        }
-               } 
-               else if (G.vd->modeselect == V3D_FACESELECTMODE_SEL) {
-                       if ((G.obedit) && (G.f & G_FACESELECT)) {
-                               exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
-                       } else if ((G.f & G_FACESELECT) && (G.f & G_VERTEXPAINT)) {
-                               if(G.f & G_VERTEXPAINT) set_vpaint(); /* Switch off vertex paint */
-                       } else if ((G.f & G_FACESELECT) && (G.f & G_TEXTUREPAINT)) {
-                               if(G.f & G_TEXTUREPAINT) set_texturepaint(); /* Switch off tex paint */
-                       } else {
-                               G.vd->flag &= ~V3D_MODE;
-                               if(G.f & G_SCULPTMODE) set_sculptmode(); /* Switch off sculptmode */
-                               if(G.f & G_VERTEXPAINT) set_vpaint(); /* Switch off vertex paint */
-                               if(G.f & G_TEXTUREPAINT) set_texturepaint(); /* Switch off tex paint */
-                               if(G.f & G_WEIGHTPAINT) set_wpaint();           /* Switch off weight paint */
-                               if (G.obedit) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* exit editmode and undo */
-                               
-                               set_faceselect();
-                       }
-               } 
+               }
                else if (G.vd->modeselect == V3D_VERTEXPAINTMODE_SEL) {
                        if (!(G.f & G_VERTEXPAINT)) {
                                G.vd->flag &= ~V3D_MODE;
@@ -5034,7 +5014,7 @@ static void view3d_header_pulldowns(uiBlock *block, short *xcoord)
                } else if (ob && ob->type == OB_ARMATURE) {
                        uiDefPulldownBut(block, view3d_select_armaturemenu, NULL, "Select",     xco,-2, xmax-3, 24, "");
                }
-       } else if (G.f & G_FACESELECT) {
+       } else if (FACESEL_PAINT_TEST) {
                if (ob && ob->type == OB_MESH) {
                        uiDefPulldownBut(block, view3d_select_faceselmenu, NULL, "Select", xco,-2, xmax-3, 24, "");
                }
@@ -5100,7 +5080,7 @@ static void view3d_header_pulldowns(uiBlock *block, short *xcoord)
                uiDefPulldownBut(block, view3d_sculptmenu, NULL, "Sculpt", xco, -2, xmax-3, 24, "");
                xco+= xmax;
        }
-       else if (G.f & G_FACESELECT) {
+       else if (FACESEL_PAINT_TEST) {
                if (ob && ob->type == OB_MESH) {
                        xmax= GetButStringLength("Face");
                        uiDefPulldownBut(block, view3d_faceselmenu, NULL, "Face",       xco,-2, xmax-3, 24, "");
@@ -5168,7 +5148,7 @@ void view3d_buttons(void)
        else if (G.f & G_WEIGHTPAINT) G.vd->modeselect = V3D_WEIGHTPAINTMODE_SEL;
        else if (G.f & G_VERTEXPAINT) G.vd->modeselect = V3D_VERTEXPAINTMODE_SEL;
        else if (G.f & G_TEXTUREPAINT) G.vd->modeselect = V3D_TEXTUREPAINTMODE_SEL;
-       else if(G.f & G_FACESELECT) G.vd->modeselect = V3D_FACESELECTMODE_SEL;
+       /*else if(G.f & G_FACESELECT) G.vd->modeselect = V3D_FACESELECTMODE_SEL;*/
                
        G.vd->flag &= ~V3D_MODE;
        
@@ -5178,7 +5158,7 @@ void view3d_buttons(void)
        if(G.f & G_VERTEXPAINT) G.vd->flag |= V3D_VERTEXPAINT;
        if(G.f & G_WEIGHTPAINT) G.vd->flag |= V3D_WEIGHTPAINT;
        if (G.f & G_TEXTUREPAINT) G.vd->flag |= V3D_TEXTUREPAINT;
-       if(G.f & G_FACESELECT) G.vd->flag |= V3D_FACESELECT;
+       if(FACESEL_PAINT_TEST) G.vd->flag |= V3D_FACESELECT;
        
        uiDefIconTextButS(block, MENU, B_MODESELECT, (G.vd->modeselect),view3d_modeselect_pup() , 
                                                                                                                                xco,0,126,20, &(G.vd->modeselect), 0, 0, 0, 0, "Mode (Hotkeys: Tab, F, V, Ctrl Tab)");
@@ -5223,35 +5203,41 @@ void view3d_buttons(void)
                        uiBlockEndAlign(block);
                }
        } else {
-               uiDefIconTextButS(block, ICONTEXTROW,B_AROUND, ICON_ROTATE, around_pup(), xco,0,XIC+10,YIC, &(G.vd->around), 0, 3.0, 0, 0, "Rotation/Scaling Pivot (Hotkeys: Comma, Shift Comma, Period) ");
-
-               xco+= XIC+10;
-       
-               uiDefIconButBitS(block, TOG, V3D_ALIGN, B_AROUND, ICON_ALIGN,
-                                xco,0,XIC,YIC,
-                                &G.vd->flag, 0, 0, 0, 0, "Move object centers only");  
-               uiBlockEndAlign(block);
-       
-               xco+= XIC+8;
+               if (G.f & (G_VERTEXPAINT|G_WEIGHTPAINT|G_TEXTUREPAINT)) {
+                       uiDefIconButBitI(block, TOG, G_FACESELECT, B_REDR, ICON_FACESEL_HLT,xco,0,XIC,YIC, &G.f, 0, 0, 0, 0, "Painting Mask (FKey)");
+                       xco+= XIC+10;
+               } else {
+                       /* Manipulators arnt used in weight paint mode */
+                       uiDefIconTextButS(block, ICONTEXTROW,B_AROUND, ICON_ROTATE, around_pup(), xco,0,XIC+10,YIC, &(G.vd->around), 0, 3.0, 0, 0, "Rotation/Scaling Pivot (Hotkeys: Comma, Shift Comma, Period) ");
 
-               /* Transform widget / manipulators */
-               uiBlockBeginAlign(block);
-               uiDefIconButBitS(block, TOG, V3D_USE_MANIPULATOR, B_REDR, ICON_MANIPUL,xco,0,XIC,YIC, &G.vd->twflag, 0, 0, 0, 0, "Use 3d transform manipulator (Ctrl Space)");  
-               xco+= XIC;
+                       xco+= XIC+10;
+               
+                       uiDefIconButBitS(block, TOG, V3D_ALIGN, B_AROUND, ICON_ALIGN,
+                                        xco,0,XIC,YIC,
+                                        &G.vd->flag, 0, 0, 0, 0, "Move object centers only");  
+                       uiBlockEndAlign(block);
+               
+                       xco+= XIC+8;
        
-               if(G.vd->twflag & V3D_USE_MANIPULATOR) {
-                       uiDefIconButBitS(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, xco,0,XIC,YIC, &G.vd->twtype, 1.0, 0.0, 0, 0, "Translate manipulator mode (Ctrl Alt G)");
-                       xco+= XIC;
-                       uiDefIconButBitS(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, xco,0,XIC,YIC, &G.vd->twtype, 1.0, 0.0, 0, 0, "Rotate manipulator mode (Ctrl Alt R)");
-                       xco+= XIC;
-                       uiDefIconButBitS(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, xco,0,XIC,YIC, &G.vd->twtype, 1.0, 0.0, 0, 0, "Scale manipulator mode (Ctrl Alt S)");
+                       /* Transform widget / manipulators */
+                       uiBlockBeginAlign(block);
+                       uiDefIconButBitS(block, TOG, V3D_USE_MANIPULATOR, B_REDR, ICON_MANIPUL,xco,0,XIC,YIC, &G.vd->twflag, 0, 0, 0, 0, "Use 3d transform manipulator (Ctrl Space)");  
                        xco+= XIC;
-               }
-               uiDefButS(block, MENU, B_NOP, "Orientation%t|Global%x0|Local%x1|Normal%x2|View%x3",xco,0,70,YIC, &G.vd->twmode, 0, 0, 0, 0, "Transform Orientation (Alt Space)");
-               xco+= 70;
-               uiBlockEndAlign(block);
-               xco+= 8;
-       
+               
+                       if(G.vd->twflag & V3D_USE_MANIPULATOR) {
+                               uiDefIconButBitS(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, xco,0,XIC,YIC, &G.vd->twtype, 1.0, 0.0, 0, 0, "Translate manipulator mode (Ctrl Alt G)");
+                               xco+= XIC;
+                               uiDefIconButBitS(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, xco,0,XIC,YIC, &G.vd->twtype, 1.0, 0.0, 0, 0, "Rotate manipulator mode (Ctrl Alt R)");
+                               xco+= XIC;
+                               uiDefIconButBitS(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, xco,0,XIC,YIC, &G.vd->twtype, 1.0, 0.0, 0, 0, "Scale manipulator mode (Ctrl Alt S)");
+                               xco+= XIC;
+                       }
+                       uiDefButS(block, MENU, B_NOP, "Orientation%t|Global%x0|Local%x1|Normal%x2|View%x3",xco,0,70,YIC, &G.vd->twmode, 0, 0, 0, 0, "Transform Orientation (Alt Space)");
+                       xco+= 70;
+                       uiBlockEndAlign(block);
+                       xco+= 8;
+               }
+               
                /* LAYERS */
                if(G.obedit==NULL && G.vd->localview==0) {
                        uiBlockBeginAlign(block);
index e67ed466c2351bc434be36a4498702bb9d810501..37d25e4f100107b4eb7b32dfe6a026cca2a5518a 100644 (file)
@@ -2533,7 +2533,7 @@ static void object_delete_cb(TreeElement *te, TreeStoreElem *tsep, TreeStoreElem
                if(G.obedit==base->object) exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR);
                
                if(base==BASACT) {
-                       G.f &= ~(G_VERTEXPAINT+G_FACESELECT+G_TEXTUREPAINT+G_WEIGHTPAINT);
+                       G.f &= ~(G_VERTEXPAINT+G_TEXTUREPAINT+G_WEIGHTPAINT);
                        setcursor_space(SPACE_VIEW3D, CURSOR_STD);
                }
                
index dda173d0d62659b10b015444eab466654f40d30d..3318b3758fc1b314c65256de4d36ccd436b299c8 100644 (file)
@@ -113,7 +113,7 @@ void enter_posemode(void)
        }
 
        if (G.obedit) exit_editmode(EM_FREEDATA|EM_WAITCURSOR);
-       G.f &= ~(G_VERTEXPAINT | G_FACESELECT | G_TEXTUREPAINT | G_WEIGHTPAINT);
+       G.f &= ~(G_VERTEXPAINT | G_TEXTUREPAINT | G_WEIGHTPAINT);
 }
 
 void set_pose_keys (Object *ob)
index 2221d21ae90c9912c996632fcaf1d9632624f770..0e96121bbec6d01d70de2b9e6e7eca1a7a615d1d 100644 (file)
@@ -648,7 +648,7 @@ static void align_view_to_selected(View3D *v3d)
                if ((G.obedit) && (G.obedit->type == OB_MESH)) {
                        editmesh_align_view_to_selected(v3d, axis);
                        addqueue(v3d->area->win, REDRAW, 1);
-               } else if (G.f & G_FACESELECT) {
+               } else if (FACESEL_PAINT_TEST) {
                        Object *obact= OBACT;
                        if (obact && obact->type==OB_MESH) {
                                Mesh *me= obact->data;
@@ -1568,7 +1568,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                        mouse_mesh();   /* loop select for 1 mousebutton dudes */
                                else if(G.qual==LR_CTRLKEY)
                                        mouse_select(); /* also allow in editmode, for vertex parenting */
-                               else if(G.f & G_FACESELECT)
+                               else if(FACESEL_PAINT_TEST)
                                        face_select();
                                else if( G.f & (G_VERTEXPAINT|G_TEXTUREPAINT))
                                        sample_vpaint();
@@ -1689,7 +1689,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                                deselectall_posearmature(ob, 1, 1);
                                        }
                                        else {
-                                               if(G.f & G_FACESELECT) deselectall_tface();
+                                               if(FACESEL_PAINT_TEST) deselectall_tface();
                                                else {
                                                        /* by design, the center of the active object 
                                                         * (which need not necessarily by selected) will
@@ -1804,7 +1804,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                else if (G.qual==LR_CTRLKEY) {
                                        if(G.obedit && G.obedit->type==OB_MESH)
                                                Edge_Menu();
-                                       else if (G.f & G_FACESELECT)
+                                       else if (FACESEL_PAINT_TEST)
                                                seam_mark_clear_tface(0);
                                }
                                else if (G.qual==LR_SHIFTKEY) {
@@ -1848,7 +1848,10 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                                fly();
                                }
                                else {
-                                       set_faceselect();
+                                       if (G.f & (G_VERTEXPAINT|G_WEIGHTPAINT|G_TEXTUREPAINT)){
+                                               G.f ^= G_FACESELECT;
+                                               allqueue(REDRAWVIEW3D, 1);
+                                       }
                                }
                                
                                break;
@@ -1953,7 +1956,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                                        show_all_armature_bones();
                                        }
                                }
-                               else if(G.f & G_FACESELECT)
+                               else if(FACESEL_PAINT_TEST)
                                        hide_tface();
                                else if(ob && (ob->flag & OB_POSEMODE)) {
                                        if (G.qual==0)
@@ -2017,7 +2020,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                }
                                else {
                                        if((G.qual==LR_SHIFTKEY)) {
-                                               if(G.f & G_FACESELECT)
+                                               if(FACESEL_PAINT_TEST)
                                                        if (G.f & G_WEIGHTPAINT)
                                                                clear_wpaint_selectedfaces();
                                                        else
@@ -2045,7 +2048,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                        selectconnected_posearmature();
                                }
                                else {
-                                       if(G.f & G_FACESELECT) {
+                                       if(FACESEL_PAINT_TEST) {
                                                if((G.qual==0))
                                                        select_linked_tfaces(0);
                                                else if((G.qual==LR_SHIFTKEY))
@@ -2064,7 +2067,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                }
                                break;
                        case MKEY:
-                               if((G.obedit==0) && (G.f & G_FACESELECT) && (G.qual==0))
+                               if((G.obedit==0) && (FACESEL_PAINT_TEST) && (G.qual==0))
                                        mirror_uv_tface();
                                else if(G.obedit){
                                        if(G.qual==LR_ALTKEY) {
@@ -2198,7 +2201,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                }
                                break;                          
                        case RKEY:
-                               if((G.obedit==0) && (G.f & G_FACESELECT) && (G.qual==0) && !(G.f & G_WEIGHTPAINT))
+                               if((G.obedit==0) && (FACESEL_PAINT_TEST) && (G.qual==0) && !(G.f & G_WEIGHTPAINT))
                                        rotate_uv_tface();
                                else if((G.obedit==0) && G.qual==LR_ALTKEY) {
                                        if(okee("Clear rotation")) {
@@ -2342,6 +2345,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                
                                break;
                        case UKEY:
+                               /*// Use Ctrl Z like everybody else
                                if(G.obedit) {
                                        if(G.obedit->type==OB_MESH) {
                                                if(G.qual==0) BIF_undo(); else BIF_redo();
@@ -2349,6 +2353,11 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                        else if ELEM5(G.obedit->type, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE) {
                                                if(G.qual==0) BIF_undo(); else BIF_redo();
                                        }
+                               }*/
+                               if(G.obedit) {
+                                       if(G.qual==0) {
+                                               uv_autocalc_tface();
+                                       }
                                }
                                else if((G.qual==0)) {
                                        if(G.f & G_WEIGHTPAINT)
@@ -2357,8 +2366,6 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                                BIF_undo();
                                        else if(G.f & G_TEXTUREPAINT)
                                                imagepaint_undo();
-                                       /*else if (G.f & G_FACESELECT)
-                                               uv_autocalc_tface();*/
                                        else {
                                                single_user();
                                        }
@@ -2370,7 +2377,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                        if ((G.obedit) && G.obedit->type==OB_MESH) {
                                                align_view_to_selected(v3d);
                                        }
-                                       else if (G.f & G_FACESELECT) {
+                                       else if (FACESEL_PAINT_TEST) {
                                                align_view_to_selected(v3d);
                                        }
                                }
@@ -2397,11 +2404,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                        initTransform(TFM_WARP, CTX_NONE);
                                        Transform();
                                }
-                               else if(G.qual==LR_ALTKEY) {
-                                       if(G.obedit) {
-                                               uv_autocalc_tface();
-                                       }
-                               }
+                               /*else if(G.qual==LR_ALTKEY) {}*/
                                else if(G.qual==LR_CTRLKEY) {
                                        if(G.obedit) {
                                                if ELEM(G.obedit->type,  OB_CURVE, OB_SURF) {
@@ -2479,7 +2482,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                                if ((G.obedit) && (G.obedit->type == OB_MESH)) {
                                                        editmesh_align_view_to_selected(G.vd, 3);
                                                } 
-                                               else if (G.f & G_FACESELECT) {
+                                               else if (FACESEL_PAINT_TEST) {
                                                        if(ob->type==OB_MESH) {
                                                                Mesh *me= ob->data;
                                                                faceselect_align_view_to_selected(G.vd, me, 3);
index 69057c2b75e532f8df6922e6d66884a252f7620e..ed523008cf9ce916b7a6eddc5bf1e6609d2414ee 100644 (file)
@@ -2095,7 +2095,7 @@ void toolbox_n(void)
                                }
                        }
                }
-               else if (G.f & G_FACESELECT) {
+               else if (FACESEL_PAINT_TEST) {
                        menu3 = tb_face_select;
                }
        }
index 773ae3d17ecea83de840c63fd634c52d3f013e49..8fcb00c526d65e4cb7dbae94f3c17f5bc8624865 100644 (file)
@@ -427,7 +427,7 @@ int calc_manipulator_stats(ScrArea *sa)
                /* restore, mode can be TFM_INIT */
                Trans.mode= mode;
        }
-       else if(G.f & (G_FACESELECT + G_VERTEXPAINT + G_TEXTUREPAINT +G_WEIGHTPAINT)) {
+       else if(G.f & (G_VERTEXPAINT + G_TEXTUREPAINT +G_WEIGHTPAINT)) {
                ;
        }
        else {
index 0b7bd896caf841b8c10a9c9107bcad78bfc6b463..ddcf356d669d9615724a8fba7679a91363267136 100644 (file)
@@ -290,7 +290,14 @@ void unwrap_lscm(short seamcut)
        short abf = G.scene->toolsettings->unwrapper == 1;
        short fillholes = G.scene->toolsettings->uvcalc_flag & 1;
        
-       if(!EM_texFaceCheck()) return;
+       /* add uvs if there not here */
+       if (!EM_texFaceCheck()) {
+               if (em && em->faces.first)
+                       EM_add_data_layer(&em->fdata, CD_MTFACE);
+               
+               if (!EM_texFaceCheck())
+                       return;
+       }
 
        handle = construct_param_handle(em, 0, fillholes, seamcut == 0);
 
index b17dfbd2bb7cdf504f7e80fa10d3123b664a9a73..9b4f65fbc81fdcaaa0570f41bc644230c3c9fc3a 100644 (file)
@@ -1398,7 +1398,7 @@ void centerview() /* like a localview without local! */
                        }
                }
        }
-       else if (G.f & G_FACESELECT) {
+       else if (FACESEL_PAINT_TEST) {
                ok= minmax_tface(min, max);
        }
        else {