2.5/Vertex paint:
[blender.git] / source / blender / editors / space_view3d / view3d_header.c
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 {