2.5/Vertex paint:
authorNicholas Bishop <nicholasbishop@gmail.com>
Sat, 15 Aug 2009 20:36:15 +0000 (20:36 +0000)
committerNicholas Bishop <nicholasbishop@gmail.com>
Sat, 15 Aug 2009 20:36:15 +0000 (20:36 +0000)
* Made vertex paint local to object, like sculpt mode.
* New test for vertex paint is (ob->mode & OB_MODE_VERTEX_PAINT)

18 files changed:
source/blender/blenkernel/BKE_global.h
source/blender/blenkernel/intern/blender.c
source/blender/blenkernel/intern/brush.c
source/blender/blenkernel/intern/context.c
source/blender/blenkernel/intern/paint.c
source/blender/editors/mesh/mesh_layers.c
source/blender/editors/object/object_edit.c
source/blender/editors/screen/screen_context.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/space_buttons/buttons_context.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_buttons.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_header.c
source/blender/editors/space_view3d/view3d_select.c
source/blender/editors/transform/transform_manipulator.c
source/blender/editors/transform/transform_orientations.c
source/blender/makesdna/DNA_object_types.h

index 3c31989e508b0b15d47c6b452bf28b25665243cf..1d09ff2f2c6fb45b48c8a51c51c40276b81fff2d 100644 (file)
@@ -112,8 +112,6 @@ typedef struct Global {
 
 #define G_FACESELECT   (1 <<  8)
 
-#define G_VERTEXPAINT  (1 << 10)
-
 #define G_DEBUG                        (1 << 12)
 #define G_DOSCRIPTLINKS (1 << 13)
 
index 2e4e5596450583b22d4d7ea8a98b15b73d9776de..3f20d37974842352218164ca3dde4d0116461a9a 100644 (file)
@@ -226,7 +226,7 @@ static void clear_global(void)
 
        G.main= NULL;
        
-       G.f &= ~(G_WEIGHTPAINT + G_VERTEXPAINT + G_FACESELECT + G_PARTICLEEDIT);
+       G.f &= ~(G_WEIGHTPAINT + G_FACESELECT + G_PARTICLEEDIT);
 }
 
 /* make sure path names are correct for OS */
index eddca8d0073cc9e0e28d97f05fd6bf7ac5990815..392872dafd1c4a7cba0202e89389ac4159515631 100644 (file)
@@ -188,10 +188,14 @@ void make_local_brush(Brush *brush)
 
 Brush **current_brush_source(Scene *sce)
 {
-       if(sce->basact && sce->basact->object->mode & OB_MODE_SCULPT)
-               return &sce->toolsettings->sculpt->brush;
-       else if(G.f & G_VERTEXPAINT)
-               return &sce->toolsettings->vpaint->brush;
+       Object *ob = sce->basact ? sce->basact->object : NULL;
+
+       if(ob) {
+               if(ob->mode & OB_MODE_SCULPT)
+                       return &sce->toolsettings->sculpt->brush;
+               else if(ob->mode & OB_MODE_VERTEX_PAINT)
+                       return &sce->toolsettings->vpaint->brush;
+       }
        else if(G.f & G_WEIGHTPAINT)
                return &sce->toolsettings->wpaint->brush;
        else if(G.f & G_TEXTUREPAINT)
index 280ea6eca53a82bf501a20b4381d9bbd327ae4c0..ba06768b12a58c6ef96d4fc196640adedf85be65 100644 (file)
@@ -689,7 +689,7 @@ char *CTX_data_mode_string(const bContext *C)
                if(ob && (ob->flag & OB_POSEMODE)) return "posemode";
                else if (ob && ob->mode & OB_MODE_SCULPT)  return "sculpt_mode";
                else if (G.f & G_WEIGHTPAINT) return "weightpaint";
-               else if (G.f & G_VERTEXPAINT) return "vertexpaint";
+               else if (ob && ob->mode & OB_MODE_VERTEX_PAINT) return "vertexpaint";
                else if (G.f & G_TEXTUREPAINT) return "texturepaint";
                else if(G.f & G_PARTICLEEDIT) return "particlemode";
        }
index a42581f3a763816d06996a8666801ef9162472c8..e945c218217a3511bf15fadd3bc1671aa3205110 100644 (file)
@@ -32,6 +32,6 @@
 
 int paint_facesel_test(Object *ob)
 {
-       return (G.f&G_FACESELECT) && (G.f & (G_VERTEXPAINT|G_WEIGHTPAINT|G_TEXTUREPAINT));
+       return (G.f&G_FACESELECT) && ((G.f & (G_WEIGHTPAINT|G_TEXTUREPAINT)) || (ob && (ob->mode & OB_MODE_VERTEX_PAINT)));
 
 }
index 99d50d1a9b0a9f22347042c462d2b0cf5861e4c8..e06381780db8627d1394b29c6a34ee3e971ab5c1 100644 (file)
 #include "WM_types.h"
 
 #include "ED_mesh.h"
+#include "ED_object.h"
 #include "ED_view3d.h"
 
 #include "mesh_intern.h"
 
-static void delete_customdata_layer(Mesh *me, CustomDataLayer *layer)
+static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *layer)
 {
+       Mesh *me = ob->data;
        CustomData *data= (me->edit_mesh)? &me->edit_mesh->fdata: &me->fdata;
        void *actlayerdata, *rndlayerdata, *clonelayerdata, *masklayerdata, *layerdata=layer->data;
        int type= layer->type;
@@ -87,9 +89,8 @@ static void delete_customdata_layer(Mesh *me, CustomDataLayer *layer)
                mesh_update_customdata_pointers(me);
        }
 
-       if(!CustomData_has_layer(data, type))
-               if(type == CD_MCOL && (G.f & G_VERTEXPAINT))
-                       G.f &= ~G_VERTEXPAINT; /* get out of vertexpaint mode */
+       if(!CustomData_has_layer(data, type) && (type == CD_MCOL && (ob->mode & OB_MODE_VERTEX_PAINT)))
+               ED_object_toggle_modes(C, OB_MODE_VERTEX_PAINT);
 
        /* reconstruct active layer */
        if (actlayerdata != layerdata) {
@@ -225,7 +226,7 @@ static int uv_texture_remove_exec(bContext *C, wmOperator *op)
        if(!cdl)
                return OPERATOR_CANCELLED;
 
-       delete_customdata_layer(me, cdl);
+       delete_customdata_layer(C, ob, cdl);
 
        DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
@@ -328,7 +329,7 @@ static int vertex_color_remove_exec(bContext *C, wmOperator *op)
        if(!cdl)
                return OPERATOR_CANCELLED;
 
-       delete_customdata_layer(me, cdl);
+       delete_customdata_layer(C, ob, cdl);
 
        DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob);
index c65855c24a07241c67c1e9c57ddbe88c025e36d3..f5a93fae8e9a5bd0569ee7549b3433da7c5a29ee 100644 (file)
@@ -4165,7 +4165,7 @@ void special_editmenu(Scene *scene, View3D *v3d)
                        }
                        DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
                }
-               else if(G.f & G_VERTEXPAINT) {
+               else if(ob->mode & OB_MODE_VERTEX_PAINT) {
                        Mesh *me= get_mesh(ob);
                        
                        if(me==0 || (me->mcol==NULL && me->mtface==NULL) ) return;
@@ -7042,4 +7042,6 @@ void ED_object_toggle_modes(bContext *C, int mode)
 {
        if(mode & OB_MODE_SCULPT)
                WM_operator_name_call(C, "SCULPT_OT_sculptmode_toggle", WM_OP_EXEC_REGION_WIN, NULL);
+       if(mode & OB_MODE_VERTEX_PAINT)
+               WM_operator_name_call(C, "SCULPT_OT_vertex_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
 }
index ba91502dcbbf649d5cd092ee853a863122a47c9d..0ac9333aafcaac663967d3dc619635fa20aedc09 100644 (file)
@@ -44,6 +44,10 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
        bScreen *sc= CTX_wm_screen(C);
        Scene *scene= sc->scene;
        Base *base;
+       Object *ob = NULL;
+
+       if(scene && scene->basact)
+               ob = scene->basact->object;
 
        if(CTX_data_dir(member)) {
                static const char *dir[] = {
@@ -112,14 +116,14 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
                return 1;
        }
        else if(CTX_data_equals(member, "sculpt_object")) {
-               if(scene->basact && (scene->basact->object->mode & OB_MODE_SCULPT))
-                       CTX_data_id_pointer_set(result, &scene->basact->object->id);
+               if(ob && (ob->mode & OB_MODE_SCULPT))
+                       CTX_data_id_pointer_set(result, &ob->id);
 
                return 1;
        }
        else if(CTX_data_equals(member, "vertex_paint_object")) {
-               if(G.f & G_VERTEXPAINT && scene->basact)
-                       CTX_data_id_pointer_set(result, &scene->basact->object->id);
+               if(ob && (ob->mode & OB_MODE_VERTEX_PAINT))
+                       CTX_data_id_pointer_set(result, &ob->id);
 
                return 1;
        }
index 812c41f430eb36c0f44b12531f7f2eb94280319c..b8ee2710152bb67e44a08ec4abb008dda37d946b 100644 (file)
@@ -108,7 +108,9 @@ static void error() {}
 
 static int vp_poll(bContext *C)
 {
-       if(G.f & G_VERTEXPAINT) {
+       Object *ob = CTX_data_active_object(C);
+
+       if(ob && ob->mode & OB_MODE_VERTEX_PAINT) {
                ScrArea *sa= CTX_wm_area(C);
                if(sa->spacetype==SPACE_VIEW3D) {
                        ARegion *ar= CTX_wm_region(C);
@@ -369,12 +371,12 @@ void clear_vpaint(Scene *scene)
        unsigned int *to, paintcol;
        int a;
        
-       if((G.f & G_VERTEXPAINT)==0) return;
-
        ob= OBACT;
        me= get_mesh(ob);
        if(!ob || ob->id.lib) return;
 
+       if(!(ob->mode & OB_MODE_VERTEX_PAINT)) return;
+
        if(me==0 || me->mcol==0 || me->totface==0) return;
 
        paintcol= vpaint_get_current_col(scene->toolsettings->vpaint);
@@ -540,10 +542,10 @@ void vpaint_dogamma(Scene *scene)
        int a, temp;
        unsigned char *cp, gamtab[256];
 
-       if((G.f & G_VERTEXPAINT)==0) return;
-
        ob= OBACT;
        me= get_mesh(ob);
+
+       if(!(ob->mode & OB_MODE_VERTEX_PAINT)) return;
        if(me==0 || me->mcol==0 || me->totface==0) return;
 
        igam= 1.0/vp->gamma;
@@ -1584,22 +1586,22 @@ static int set_vpaint(bContext *C, wmOperator *op)              /* toggle */
        me= get_mesh(ob);
        
        if(me==NULL || object_data_is_libdata(ob)) {
-               G.f &= ~G_VERTEXPAINT;
+               ob->mode &= ~OB_MODE_VERTEX_PAINT;
                return OPERATOR_PASS_THROUGH;
        }
        
        if(me && me->totface>=MAXINDEX) {
                error("Maximum number of faces: %d", MAXINDEX-1);
-               G.f &= ~G_VERTEXPAINT;
+               ob->mode &= ~OB_MODE_VERTEX_PAINT;
                return OPERATOR_FINISHED;
        }
        
        if(me && me->mcol==NULL) make_vertexcol(scene, 0);
        
        /* toggle: end vpaint */
-       if(G.f & G_VERTEXPAINT) {
+       if(ob->mode & OB_MODE_VERTEX_PAINT) {
                
-               G.f &= ~G_VERTEXPAINT;
+               ob->mode &= ~OB_MODE_VERTEX_PAINT;
                
                if(vp) {
                        toggle_paint_cursor(C, 0);
@@ -1608,7 +1610,7 @@ static int set_vpaint(bContext *C, wmOperator *op)                /* toggle */
        }
        else {
                
-               G.f |= G_VERTEXPAINT;
+               ob->mode |= OB_MODE_VERTEX_PAINT;
                /* Turn off weight painting */
                if (G.f & G_WEIGHTPAINT)
                        set_wpaint(C, op);
index 0be151a11b663a5ea3af97c61b8af2eebed371e4..d438490ff7e47b4e188045800c50334c73375dec 100644 (file)
@@ -323,7 +323,7 @@ static int buttons_context_path_brush(const bContext *C, ButsContextPath *path)
 
                if(obact && obact->mode & OB_MODE_SCULPT)
                        br= ts->sculpt->brush;
-               else if(G.f & G_VERTEXPAINT)
+               else if(obact && obact->mode & OB_MODE_VERTEX_PAINT)
                        br= ts->vpaint->brush;
                else if(G.f & G_WEIGHTPAINT)
                        br= ts->wpaint->brush;
index 850731baf91df3563b7aa170d00056dc4c927afe..3f3cb401959f7c996befb8927acc9d6e2e948ee9 100644 (file)
@@ -2348,12 +2348,13 @@ static void draw_mesh_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base
 
                                GPU_disable_material();
                        }
-                       else if((G.f & (G_VERTEXPAINT+G_TEXTUREPAINT)) && me->mcol) {
-                               dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 1);
-                       }
-                       else if(G.f & (G_VERTEXPAINT+G_TEXTUREPAINT)) {
-                               glColor3f(1.0f, 1.0f, 1.0f);
-                               dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 0);
+                       else if((G.f & G_TEXTUREPAINT || ob->mode & OB_MODE_VERTEX_PAINT)) {
+                               if(me->mcol)
+                                       dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 1);
+                               else {
+                                       glColor3f(1.0f, 1.0f, 1.0f);
+                                       dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 0);
+                               }
                        }
                        else do_draw= 1;
                }
@@ -5072,7 +5073,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
        dtx= 0;
 
        /* faceselect exception: also draw solid when dt==wire, except in editmode */
-       if(ob==OBACT && (G.f & (G_VERTEXPAINT+G_TEXTUREPAINT+G_WEIGHTPAINT))) {
+       if(ob==OBACT && (G.f & (G_TEXTUREPAINT+G_WEIGHTPAINT) || ob->mode & OB_MODE_VERTEX_PAINT)) {
                if(ob->type==OB_MESH) {
 
                        if(ob==scene->obedit);
@@ -5710,7 +5711,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
        if(G.f & G_RENDER_SHADOW) 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_TEXTUREPAINT|G_WEIGHTPAINT))==0) {
+       if(ob!=OBACT || ((G.f & (G_TEXTUREPAINT|G_WEIGHTPAINT))==0) || ob->mode & OB_MODE_VERTEX_PAINT) {
                int do_draw_center= -1; /* defines below are zero or positive... */
 
                if((scene->basact)==base) 
index c09646e7cd75bfeb7594d888711f5425df1cfab3..8057ed9f819bb0071c624dd6c0bbf62aa54e07b7 100644 (file)
@@ -1058,7 +1058,7 @@ static void view3d_panel_object(const bContext *C, Panel *pa)
 
 // XXX uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
        
-       if(G.f & (G_VERTEXPAINT|G_TEXTUREPAINT|G_WEIGHTPAINT)) {
+       if(ob->mode & OB_MODE_VERTEX_PAINT || G.f & (G_TEXTUREPAINT|G_WEIGHTPAINT)) {
        }
        else {
                //bt= uiDefBut(block, TEX, B_IDNAME, "OB: ",    10,180,140,20, ob->id.name+2, 0.0, 21.0, 0, 0, "");
index f88386a08a6c2588829325032a43563563da8479..c1f02c74460957c955794263f41b80b7c29b2bb0 100644 (file)
@@ -1091,7 +1091,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
 void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
 {
        RegionView3D *rv3d= ar->regiondata;
-       struct Base *base;
+       struct Base *base = scene->basact;
 
 /*for 2.43 release, don't use glext and just define the constant.
   this to avoid possibly breaking platforms before release.*/
@@ -1103,7 +1103,9 @@ void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
        int m;
 #endif
 
-       if(G.f & G_VERTEXPAINT || G.f & G_WEIGHTPAINT || (scene->basact && paint_facesel_test(scene->basact->object)));
+       if(G.f & G_WEIGHTPAINT ||
+          (base && (base->object->mode & OB_MODE_VERTEX_PAINT ||
+                    paint_facesel_test(base->object))));
        else if((G.f & G_TEXTUREPAINT) && scene->toolsettings && (scene->toolsettings->imapaint.flag & IMAGEPAINT_PROJECT_DISABLE));
        else if((G.f & G_PARTICLEEDIT) && v3d->drawtype>OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT));
        else if(scene->obedit && v3d->drawtype>OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT));
@@ -1150,7 +1152,6 @@ void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
        
        G.f |= G_BACKBUFSEL;
        
-       base= (scene->basact);
        if(base && (base->lay & v3d->lay)) {
                draw_object_backbufsel(scene, v3d, rv3d, base->object);
        }
@@ -1883,7 +1884,7 @@ static CustomDataMask get_viewedit_datamask(bScreen *screen, Object *ob)
        }
        
        /* check if we need mcols due to vertex paint or weightpaint */
-       if(G.f & G_VERTEXPAINT)
+       if(ob && ob->mode & OB_MODE_VERTEX_PAINT)
                mask |= CD_MASK_MCOL;
        if(G.f & G_WEIGHTPAINT)
                mask |= CD_MASK_WEIGHT_MCOL;
@@ -2121,7 +2122,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
        
        /* XXX here was the blockhandlers for floating panels */
 
-       if(G.f & G_VERTEXPAINT || G.f & G_WEIGHTPAINT || G.f & G_TEXTUREPAINT) {
+       if((ob && ob->mode & OB_MODE_VERTEX_PAINT) || G.f & G_WEIGHTPAINT || G.f & G_TEXTUREPAINT) {
                v3d->flag |= V3D_NEEDBACKBUFDRAW;
                // XXX addafterqueue(ar->win, BACKBUFDRAW, 1);
        }
index a451dbaef63876f2d9c0531e2af0686ca7c8016a..26e2918c0328654aac1d5721b54d7f9882b03210 100644 (file)
@@ -139,8 +139,6 @@ static void ED_toggle_paint_modes(bContext *C, int mode)
 {
        if(mode & G_TEXTUREPAINT)
                WM_operator_name_call(C, "PAINT_OT_texture_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
-       if(mode & G_VERTEXPAINT)
-               WM_operator_name_call(C, "PAINT_OT_vertex_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
        else if(mode & G_WEIGHTPAINT)
                WM_operator_name_call(C, "PAINT_OT_weight_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
 
@@ -155,7 +153,7 @@ int ED_view3d_exit_paint_modes(bContext *C)
 
        ED_toggle_paint_modes(C, G.f);
        
-       G.f &= ~(G_VERTEXPAINT+G_TEXTUREPAINT+G_WEIGHTPAINT+G_PARTICLEEDIT);
+       G.f &= ~(G_TEXTUREPAINT+G_WEIGHTPAINT+G_PARTICLEEDIT);
 
        return restore;
 }
@@ -985,8 +983,7 @@ static void view3d_select_metaballmenu(bContext *C, uiLayout *layout, void *arg_
 void uiTemplate_view3d_select_metaballmenu(uiLayout *layout, bContext *C)
 {
        void *arg_unused = NULL;
-       ARegion *ar= CTX_wm_region(C);
-       view3d_select_metaballmenu(C, ar, arg_unused);
+       view3d_select_metaballmenu(C, layout, arg_unused);
 }
 
 static void view3d_select_armaturemenu(bContext *C, uiLayout *layout, void *arg_unused)
@@ -3476,7 +3473,7 @@ static void do_view3d_header_buttons(bContext *C, void *arg, int event)
                        }
                }
                else if (v3d->modeselect == V3D_VERTEXPAINTMODE_SEL) {
-                       if (!(G.f & G_VERTEXPAINT)) {
+                       if (ob && !(ob->mode & OB_MODE_VERTEX_PAINT)) {
                                v3d->flag &= ~V3D_MODE;
                                ED_view3d_exit_paint_modes(C);
                                ED_object_toggle_modes(C, ob->mode);
@@ -3710,7 +3707,7 @@ static void view3d_header_pulldowns(const bContext *C, uiBlock *block, Object *o
                uiDefPulldownBut(block, view3d_wpaintmenu, NULL, "Paint", xco,yco, xmax-3, 20, "");
                xco+= xmax;
        }
-       else if (G.f & G_VERTEXPAINT) {
+       else if (ob && ob->mode & OB_MODE_VERTEX_PAINT) {
                xmax= GetButStringLength("Paint");
                uiDefPulldownBut(block, view3d_vpaintmenu, NULL, "Paint", xco,yco, xmax-3, 20, "");
                xco+= xmax;
@@ -3804,7 +3801,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
        else if(ob && (ob->flag & OB_POSEMODE)) v3d->modeselect = V3D_POSEMODE_SEL;
        else if (ob && (ob->mode & OB_MODE_SCULPT))  v3d->modeselect = V3D_SCULPTMODE_SEL;
        else if (G.f & G_WEIGHTPAINT) v3d->modeselect = V3D_WEIGHTPAINTMODE_SEL;
-       else if (G.f & G_VERTEXPAINT) v3d->modeselect = V3D_VERTEXPAINTMODE_SEL;
+       else if (ob && (ob->mode & OB_MODE_VERTEX_PAINT)) v3d->modeselect = V3D_VERTEXPAINTMODE_SEL;
        else if (G.f & G_TEXTUREPAINT) v3d->modeselect = V3D_TEXTUREPAINTMODE_SEL;
        /*else if(G.f & G_FACESELECT) v3d->modeselect = V3D_FACESELECTMODE_SEL;*/
        else if(G.f & G_PARTICLEEDIT) v3d->modeselect = V3D_PARTICLEEDITMODE_SEL;
@@ -3814,7 +3811,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
        /* not sure what the v3d->flag is useful for now... modeselect is confusing */
        if(obedit) v3d->flag |= V3D_EDITMODE;
        if(ob && (ob->flag & OB_POSEMODE)) v3d->flag |= V3D_POSEMODE;
-       if(G.f & G_VERTEXPAINT) v3d->flag |= V3D_VERTEXPAINT;
+       if(ob && (ob->mode & OB_MODE_VERTEX_PAINT)) v3d->flag |= V3D_VERTEXPAINT;
        if(G.f & G_WEIGHTPAINT) v3d->flag |= V3D_WEIGHTPAINT;
        if (G.f & G_TEXTUREPAINT) v3d->flag |= V3D_TEXTUREPAINT;
        if(paint_facesel_test(ob)) v3d->flag |= V3D_FACESELECT;
@@ -3860,7 +3857,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
                        uiBlockEndAlign(block);
                }
        } else {
-               if (obedit==NULL && (G.f & (G_VERTEXPAINT|G_WEIGHTPAINT|G_TEXTUREPAINT))) {
+               if (obedit==NULL && ((ob && ob->mode & OB_MODE_VERTEX_PAINT) || G.f & (G_WEIGHTPAINT|G_TEXTUREPAINT))) {
                        uiDefIconButBitI(block, TOG, G_FACESELECT, B_VIEW_BUTSEDIT, ICON_FACESEL_HLT,xco,yco,XIC,YIC, &G.f, 0, 0, 0, 0, "Painting Mask (FKey)");
                        header_xco_step(ar, &xco, &yco, &maxco, XIC+10);
                } else {
index 3966fc343c4edfaa3a471952cde355c1b73130f3..a6a42c0ba677f9fa4059e48bab4002e184159b23 100644 (file)
@@ -694,10 +694,12 @@ static void do_lasso_select_node(short mcords[][2], short moves, short select)
 
 void view3d_lasso_select(bContext *C, ViewContext *vc, short mcords[][2], short moves, short select)
 {
+       Object *ob = CTX_data_active_object(C);
+
        if(vc->obedit==NULL) {
-               if(paint_facesel_test(CTX_data_active_object(C)))
+               if(paint_facesel_test(ob))
                        do_lasso_select_facemode(vc, mcords, moves, select);
-               else if(G.f & (G_VERTEXPAINT|G_TEXTUREPAINT|G_WEIGHTPAINT))
+               else if(G.f & (G_TEXTUREPAINT|G_WEIGHTPAINT) || (ob && ob->mode & OB_MODE_VERTEX_PAINT))
                        ;
                else if(G.f & G_PARTICLEEDIT)
                        PE_lasso_select(C, mcords, moves, select);
index 55e06b731f46fedbb26cc8e3506f93fc0a4abce0..be377f6af8397193f4aeb5fff12f79fca79f58a6 100644 (file)
@@ -358,10 +358,10 @@ int calc_manipulator_stats(const bContext *C)
                        Mat4MulVecfl(ob->obmat, scene->twmax);
                }
        }
-       else if(G.f & (G_VERTEXPAINT + G_TEXTUREPAINT + G_WEIGHTPAINT)) {
+       else if(G.f & (G_TEXTUREPAINT + G_WEIGHTPAINT)) {
                ;
        }
-       else if(ob && (ob->mode & OB_MODE_SCULPT)) {
+       else if(ob && (ob->mode & (OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT))) {
                ;
        }
        else if(G.f & G_PARTICLEEDIT) {
index 46853fa62c33460f279ae8a72b008a4664731ecc..6ba67084387ded0e5a51faa579d420da18129ce0 100644 (file)
@@ -894,10 +894,10 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
                        result = ORIENTATION_EDGE;
                }
        }
-       else if(ob && (ob->mode & OB_MODE_SCULPT))
+       else if(ob && (ob->mode & (OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT)))
        {
        }
-       else if(G.f & (G_VERTEXPAINT + G_TEXTUREPAINT + G_WEIGHTPAINT))
+       else if(G.f & (G_TEXTUREPAINT + G_WEIGHTPAINT))
        {
        }
        else if(G.f & G_PARTICLEEDIT)
index 324cf61f21bacea714a2ac678ec129980ddccc22..63037a8efe47062789e928b48a38b917b99d15af 100644 (file)
@@ -512,8 +512,9 @@ extern Object workob;
 #define OB_LOCK_SCALE  448
 
 /* ob->mode */
-#define OB_MODE_NONE      0
-#define OB_MODE_SCULPT    1
+#define OB_MODE_NONE           0
+#define OB_MODE_SCULPT         1
+#define OB_MODE_VERTEX_PAINT   2
 
 /* ob->softflag in DNA_object_force.h */