The zblur plugin (aka as DoF) integrated in render. Compared to patch
[blender.git] / source / blender / src / buttons_editing.c
index f97bfc959577411aae927924649dea4d2c83517b..c55574d97915216243799134c32ca05ef883cbed 100644 (file)
@@ -40,7 +40,6 @@
 #endif
 
 #ifdef WIN32
-#include "BLI_winstuff.h"
 #ifndef snprintf
 #define snprintf _snprintf
 #endif
@@ -70,7 +69,6 @@
 #include "DNA_object_types.h"
 #include "DNA_radio_types.h"
 #include "DNA_screen_types.h"
-#include "DNA_sound_types.h"
 #include "DNA_texture_types.h"
 #include "DNA_userdef_types.h"
 #include "DNA_vfont_types.h"
@@ -96,7 +94,6 @@
 #include "BIF_editdeform.h"
 #include "BIF_editfont.h"
 #include "BIF_editmesh.h"
-#include "BIF_editsound.h"
 #include "BIF_interface.h"
 #include "BIF_meshtools.h"
 #include "BIF_mywindow.h"
 #include "BKE_constraint.h"
 #include "BKE_curve.h"
 #include "BKE_displist.h"
+#include "BKE_DerivedMesh.h"
 #include "BKE_effect.h"
 #include "BKE_font.h"
 #include "BKE_ika.h"
 #include "BKE_mball.h"
 #include "BKE_mesh.h"
 #include "BKE_object.h"
-#include "BKE_sound.h"
 #include "BKE_texture.h"
 #include "BKE_utildefines.h"
 
 #include "LOD_DependKludge.h"
 #include "LOD_decimation.h"
 
+#include "RE_renderconverter.h"                // make_sticky
+
 #include "butspace.h" // own module
 
 static int decim_faces=0;
@@ -166,6 +165,10 @@ short uv_calc_mapdir= 1, uv_calc_mapalign= 1, facesel_draw_edges= 0;
 
 extern ListBase editNurb;
 
+
+/* *************************** static functions prototypes ****************** */
+void validate_editbonebutton(EditBone *);
+
 /* *************************** MESH DECIMATE ******************************** */
 
 /* should be removed from this c file (ton) */
@@ -262,7 +265,6 @@ static void decimate_faces(void)
 
        if(LOD_LoadMesh(&lod) ) {
                if( LOD_PreprocessMesh(&lod) ) {
-                       DispList *dl;
                        DispListMesh *dlm;
                        MFace *mfaceint;
 
@@ -273,11 +275,11 @@ static void decimate_faces(void)
                        }
 
                        /* ok, put back the stuff in a displist */
-                       freedisplist(&(ob->disp));
-                       dl= MEM_callocN(sizeof(DispList), "disp");
-                       BLI_addtail(&ob->disp, dl);
-                       dl->type= DL_MESH;
-                       dlm=dl->mesh= MEM_callocN(sizeof(DispListMesh), "dispmesh");
+                       if (me->decimated) {
+                               displistmesh_free(me->decimated);
+                       }
+
+                       dlm= me->decimated= MEM_callocN(sizeof(DispListMesh), "dispmesh");
                        dlm->mvert= MEM_callocN(lod.vertex_num*sizeof(MVert), "mvert");
                        dlm->mface= MEM_callocN(lod.face_num*sizeof(MFace), "mface");
                        dlm->totvert= lod.vertex_num;
@@ -318,8 +320,14 @@ static void decimate_cancel(void)
 
        ob= OBACT;
        if(ob) {
-               freedisplist(&ob->disp);
-               makeDispList(ob);
+               if (ob->type==OB_MESH) {
+                       Mesh *me = ob->data;
+                       
+                       if (me->decimated) {
+                               displistmesh_free(me->decimated);
+                               me->decimated = NULL;
+                       }
+               }
        }
        allqueue(REDRAWVIEW3D, 0);
 }
@@ -327,9 +335,6 @@ static void decimate_cancel(void)
 static void decimate_apply(void)
 {
        Object *ob;
-       DispList *dl;
-       DispListMesh *dlm;
-       Mesh *me;
        MFace *mface;
        MFace *mfaceint;
        int a;
@@ -337,11 +342,11 @@ static void decimate_apply(void)
        if(G.obedit) return;
 
        ob= OBACT;
-       if(ob) {
-               dl= ob->disp.first;
-               if(dl && dl->mesh) {
-                       dlm= dl->mesh;
-                       me= ob->data;
+       if(ob && ob->type==OB_MESH) {
+               Mesh *me = ob->data;
+
+               if (me->decimated) {
+                       DispListMesh *dlm= me->decimated;
 
                        // vertices
                        if(me->mvert) MEM_freeN(me->mvert);
@@ -367,7 +372,8 @@ static void decimate_apply(void)
                                test_index_mface(mface, 3);
                        }
 
-                       freedisplist(&ob->disp);
+                       displistmesh_free(me->decimated);
+                       me->decimated= NULL;
 
                        G.obedit= ob;
                        make_editMesh();
@@ -379,6 +385,7 @@ static void decimate_apply(void)
                        if (mesh_uses_displist(me)) {
                                makeDispList(ob);
                        }
+                       BIF_undo_push("Apply decimation");
                }
                else error("Not a decimated Mesh");
        }
@@ -439,12 +446,16 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
        case B_MATNEW:
                new_material_to_objectdata((G.scene->basact) ? (G.scene->basact->object) : 0);
                scrarea_queue_winredraw(curarea);
+               BIF_undo_push("New material");
+               allqueue(REDRAWBUTSSHADING, 0);
                allqueue(REDRAWVIEW3D_Z, 0);
                allqueue(REDRAWOOPS, 0);
                break;
        case B_MATDEL:
                delete_material_index();
                scrarea_queue_winredraw(curarea);
+               BIF_undo_push("Delete material index");
+               allqueue(REDRAWBUTSSHADING, 0);
                allqueue(REDRAWVIEW3D_Z, 0);
                allqueue(REDRAWOOPS, 0);
                break;
@@ -457,9 +468,6 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
                                                efa->mat_nr= G.obedit->actcol-1;
                                        efa= efa->next;
                                }
-                               allqueue(REDRAWVIEW3D_Z, 0);
-                               makeDispList(G.obedit);
-                               BIF_undo_push("Assign material index");
                        }
                        else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) {
                                nu= editNurb.first;
@@ -469,6 +477,9 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
                                        nu= nu->next;
                                }
                        }
+                       allqueue(REDRAWVIEW3D_Z, 0);
+                       makeDispList(G.obedit);
+                       BIF_undo_push("Assign material index");
                }
                break;
        case B_MATSEL:
@@ -519,6 +530,7 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
                                        }
                                        nu= nu->next;
                                }
+                               BIF_undo_push("Select material index");
                                allqueue(REDRAWVIEW3D, 0);
                        }
                }
@@ -572,23 +584,19 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
                                        }
                                        efa= efa->next;
                                }
-
-                               makeDispList(G.obedit);
-                               allqueue(REDRAWVIEW3D, 0);
-                               if(event == B_SETSMOOTH) BIF_undo_push("Set Smooth");
-                               else BIF_undo_push("Set Solid");
                        }
                        else {
                                nu= editNurb.first;
                                while(nu) {
                                        if(isNurbsel(nu)) {
-                                               if(event==B_SETSMOOTH) nu->flag |= ME_SMOOTH;
-                                               else nu->flag &= ~ME_SMOOTH;
+                                               if(event==B_SETSMOOTH) nu->flag |= CU_SMOOTH;
+                                               else nu->flag &= ~CU_SMOOTH;
                                        }
                                        nu= nu->next;
                                }
-                               
                        }
+                       makeDispList(G.obedit);
+                       allqueue(REDRAWVIEW3D, 0);
                }
                else {
                        base= FIRSTBASE;
@@ -614,6 +622,9 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
                        }
                        allqueue(REDRAWVIEW3D, 0);
                }
+               if(event == B_SETSMOOTH) BIF_undo_push("Set Smooth");
+               else BIF_undo_push("Set Solid");
+
                break;
 
        default:
@@ -656,12 +667,12 @@ static void editing_panel_mesh_type(Object *ob, Mesh *me)
 
        uiBlockBeginAlign(block);
        uiBlockSetCol(block, TH_BUT_SETTING1);
-       uiDefButS(block, TOG|BIT|7, B_MAKEDISP, "SubSurf",      10,134,70,19, &me->flag, 0, 0, 0, 0, "Treats the active object as a Subdivision Surface");
-       uiDefButS(block, MENU, B_MAKEDISP, subsurfmenu,         80,134,84,19, &(me->subsurftype), 0, 0, 0, 0, "Selects type of Subsurf algorithm.");
+       uiDefButS(block, TOG|BIT|7, B_SUBSURFTYPE, "SubSurf",   10,134,70,19, &me->flag, 0, 0, 0, 0, "Treats the active object as a Subdivision Surface");
+       uiDefButS(block, MENU, B_SUBSURFTYPE, subsurfmenu,              80,134,84,19, &(me->subsurftype), 0, 0, 0, 0, "Selects type of Subsurf algorithm.");
        uiBlockSetCol(block, TH_AUTO);
-       uiDefButS(block, NUM, B_MAKEDISP, "Subdiv:",            10, 114,110,19, &me->subdiv, 0, 6, 0, 0, "Defines the level of subdivision to display in real time interactively");
+       uiDefButS(block, NUM, B_SUBSURFTYPE, "Subdiv:",         10, 114,110,19, &me->subdiv, 0, 6, 0, 0, "Defines the level of subdivision to display in real time interactively");
        uiDefButS(block, NUM, B_DIFF, "",                               120,114, 44, 19, &me->subdivr, 0, 6, 0, 0, "Defines the level of subdivision to apply during rendering");
-       uiDefButS(block, TOG|BIT|8, B_MAKEDISP, "Optimal",      10, 94,154,19, &me->flag, 0, 0, 0, 0, "Only draws optimal wireframe");
+       uiDefButS(block, TOG|BIT|8, B_SUBSURFTYPE, "Optimal",   10, 94,154,19, &me->flag, 0, 0, 0, 0, "Only draws optimal wireframe");
 
        uiBlockBeginAlign(block);
 
@@ -698,11 +709,11 @@ static void editing_panel_mesh_type(Object *ob, Mesh *me)
        /* decimator */
        if(G.obedit==NULL) {
                int tottria= decimate_count_tria(ob);
-               DispList *dl;
+               Mesh *me = ob->data;
 
-               // wacko, wait for new displist system (ton)
-               if( (dl=ob->disp.first) && dl->mesh);
-               else decim_faces= tottria;
+               if (!me->decimated) {
+                       decim_faces= tottria;
+               }
 
                uiBlockBeginAlign(block);
                uiBlockSetCol(block, TH_BUT_SETTING1);
@@ -833,6 +844,7 @@ static void load_buts_vfont(char *name)
 
        text_to_curve(OBACT, 0);
        makeDispList(OBACT);
+       BIF_undo_push("Load vector font");
        allqueue(REDRAWVIEW3D, 0);
        allqueue(REDRAWBUTSEDIT, 0);
 }
@@ -905,6 +917,7 @@ void do_fontbuts(unsigned short event)
                                cu->vfont= vf;
                                text_to_curve(ob, 0);
                                makeDispList(ob);
+                               BIF_undo_push("Set vector font");
                                allqueue(REDRAWVIEW3D, 0);
                                allqueue(REDRAWBUTSEDIT, 0);
                        }
@@ -1072,22 +1085,33 @@ void do_curvebuts(unsigned short event)
                        allqueue(REDRAWVIEW3D, 0);
                }
                break;
+       case B_SUBSURFTYPE:
+                       /* Icky, find better system */
+               if(ob->type==OB_MESH && G.obedit && ob->data==G.obedit->data) {
+                       if(G.editMesh->derived) {
+                               G.editMesh->derived->release(G.editMesh->derived);
+                               G.editMesh->derived= NULL;
+                       }
+               }
+               /* fallthrough */
        case B_MAKEDISP:
-               if(ob->type==OB_FONT) text_to_curve(ob, 0);
-               makeDispList(ob);
-               if(ob!=G.obedit) { // subsurf with linked dupli will crash
-                       /* we need signal to send to other users of same data to recalc... */
-                       base= FIRSTBASE;
-                       while(base) {
-                               if(base->lay & G.vd->lay) {
-                                       if(base->object->data==ob->data && base->object!=ob)
-                                               makeDispList(base->object);
+               if(G.vd) {
+                       if(ob->type==OB_FONT) text_to_curve(ob, 0);
+                       makeDispList(ob);
+                       if(ob!=G.obedit) { // subsurf with linked dupli will crash
+                               /* we need signal to send to other users of same data to recalc... */
+                               base= FIRSTBASE;
+                               while(base) {
+                                       if(base->lay & G.vd->lay) {
+                                               if(base->object->data==ob->data && base->object!=ob)
+                                                       makeDispList(base->object);
+                                       }
+                                       base= base->next;
                                }
-                               base= base->next;
                        }
+                       allqueue(REDRAWVIEW3D, 0);
+                       allqueue(REDRAWINFO, 1);        /* 1, because header->win==0! */
                }
-               allqueue(REDRAWVIEW3D, 0);
-               allqueue(REDRAWINFO, 1);        /* 1, because header->win==0! */
                break;
 
        case B_SUBDIVCURVE:
@@ -1096,8 +1120,7 @@ void do_curvebuts(unsigned short event)
        case B_SPINNURB:
                /* bad bad bad!!! use brackets!!! In case you wondered:
                  {==,!=} goes before & goes before || */
-               if( (G.obedit==0) ||
-                   (G.obedit->type!=OB_SURF) ||
+               if( (G.obedit==NULL) || (G.obedit->type!=OB_SURF) || (G.vd==NULL) ||
                        ((G.obedit->lay & G.vd->lay) == 0) ) return;
                spinNurb(0, 0);
                countall();
@@ -1164,23 +1187,23 @@ static void editing_panel_curve_tools(Object *ob, Curve *cu)
        if(ob->type==OB_CURVE) {
                uiDefBut(block, LABEL, 0, "Convert",    463,173,72, 18, 0, 0, 0, 0, 0, "");
                uiBlockBeginAlign(block);
-               uiDefBut(block, BUT,B_CONVERTPOLY,"Poly",               467,152,72, 18, 0, 0, 0, 0, 0, "");
-               uiDefBut(block, BUT,B_CONVERTBEZ,"Bezier",              467,132,72, 18, 0, 0, 0, 0, 0, "");
-               uiDefBut(block, BUT,B_CONVERTNURB,"Nurb",               467,112,72, 18, 0, 0, 0, 0, 0, "");
+               uiDefBut(block, BUT,B_CONVERTPOLY,"Poly",               467,152,72, 18, 0, 0, 0, 0, 0, "Converts selected into regular Polygon vertices");
+               uiDefBut(block, BUT,B_CONVERTBEZ,"Bezier",              467,132,72, 18, 0, 0, 0, 0, 0, "Converts selected to Bezier triples");
+               uiDefBut(block, BUT,B_CONVERTNURB,"Nurb",               467,112,72, 18, 0, 0, 0, 0, 0, "Converts selected to Nurbs Points");
        }
        uiBlockBeginAlign(block);
-       uiDefBut(block, BUT,B_UNIFU,"Uniform U",        565,152,102, 18, 0, 0, 0, 0, 0, "");
-       uiDefBut(block, BUT,B_UNIFV,"V",                        670,152,50, 18, 0, 0, 0, 0, 0, "");
-       uiDefBut(block, BUT,B_ENDPU,"Endpoint U",       565,132,102, 18, 0, 0, 0, 0, 0, "");
-       uiDefBut(block, BUT,B_ENDPV,"V",                        670,132,50, 18, 0, 0, 0, 0, 0, "");
-       uiDefBut(block, BUT,B_BEZU,"Bezier U",          565,112,102, 18, 0, 0, 0, 0, 0, "");
-       uiDefBut(block, BUT,B_BEZV,"V",                         670,112,50, 18, 0, 0, 0, 0, 0, "");
+       uiDefBut(block, BUT,B_UNIFU,"Uniform U",        565,152,102, 18, 0, 0, 0, 0, 0, "Nurbs only; interpolated result doesn't go to end points in U");
+       uiDefBut(block, BUT,B_UNIFV,"V",                        670,152,50, 18, 0, 0, 0, 0, 0, "Nurbs only; interpolated result doesn't go to end points in V");
+       uiDefBut(block, BUT,B_ENDPU,"Endpoint U",       565,132,102, 18, 0, 0, 0, 0, 0, "Nurbs only; interpolated result is forced to end points in U");
+       uiDefBut(block, BUT,B_ENDPV,"V",                        670,132,50, 18, 0, 0, 0, 0, 0, "Nurbs only; interpolated result is forced to end points in V");
+       uiDefBut(block, BUT,B_BEZU,"Bezier U",          565,112,102, 18, 0, 0, 0, 0, 0, "Nurbs only; make knots array mimic a Bezier in U");
+       uiDefBut(block, BUT,B_BEZV,"V",                         670,112,50, 18, 0, 0, 0, 0, 0, "Nurbs only; make knots array mimic a Bezier in V");
        uiBlockEndAlign(block);
 
-       uiDefBut(block, BUT,B_SETWEIGHT,"Set Weight",   465,11,95,49, 0, 0, 0, 0, 0, "");
+       uiDefBut(block, BUT,B_SETWEIGHT,"Set Weight",   465,11,95,49, 0, 0, 0, 0, 0, "Nurbs only; set weight for select points");
 
        uiBlockBeginAlign(block);
-       uiDefButF(block, NUM,0,"Weight:",               565,36,102,22, &editbutweight, 0.01, 100.0, 10, 0, "");
+       uiDefButF(block, NUM,0,"Weight:",               565,36,102,22, &editbutweight, 0.01, 100.0, 10, 0, "The weight you can assign");
        uiDefBut(block, BUT,B_SETW1,"1.0",              670,36,50,22, 0, 0, 0, 0, 0, "");
        uiDefBut(block, BUT,B_SETW2,"sqrt(2)/4",565,11,55,20, 0, 0, 0, 0, 0, "");
        uiDefBut(block, BUT,B_SETW3,"0.25",             620,11,45,20, 0, 0, 0, 0, 0, "");
@@ -1193,13 +1216,13 @@ static void editing_panel_curve_tools(Object *ob, Curve *cu)
                if(nu) {
                        uiBlockBeginAlign(block);
                        sp= &(nu->orderu);
-                       uiDefButS(block, NUM, B_SETORDER, "Order U:", 565,90,102, 19, sp, 2.0, 6.0, 0, 0, "");
+                       uiDefButS(block, NUM, B_SETORDER, "Order U:", 565,90,102, 19, sp, 2.0, 6.0, 0, 0, "Nurbs only; the amount of control points involved");
                        sp= &(nu->orderv);
-                       uiDefButS(block, NUM, B_SETORDER, "V:",         670,90,50, 19, sp, 2.0, 6.0, 0, 0, "");
+                       uiDefButS(block, NUM, B_SETORDER, "V:",         670,90,50, 19, sp, 2.0, 6.0, 0, 0, "Nurbs only; the amount of control points involved");
                        sp= &(nu->resolu);
-                       uiDefButS(block, NUM, B_MAKEDISP, "Resol U:", 565,70,102, 19, sp, 1.0, 128.0, 0, 0, "");
+                       uiDefButS(block, NUM, B_MAKEDISP, "Resol U:", 565,70,102, 19, sp, 1.0, 1024.0, 0, 0, "The amount of new points interpolated per control vertex pair");
                        sp= &(nu->resolv);
-                       uiDefButS(block, NUM, B_MAKEDISP, "V:",         670,70,50, 19, sp, 1.0, 128.0, 0, 0, "");
+                       uiDefButS(block, NUM, B_MAKEDISP, "V:",         670,70,50, 19, sp, 1.0, 1024.0, 0, 0, "The amount of new points interpolated per control vertex pair");
                }
        }
 
@@ -1213,9 +1236,9 @@ static void editing_panel_curve_tools1(Object *ob, Curve *cu)
        block= uiNewBlock(&curarea->uiblocks, "editing_panel_curve_tools1", UI_EMBOSS, UI_HELV, curarea->win);
        if(uiNewPanel(curarea, block, "Curve Tools1", "Editing", 960, 0, 318, 204)==0) return;
 
-       uiDefBut(block, BUT, B_SUBDIVCURVE, "Subdivide", 400,180,150,20, 0, 0, 0, 0, 0, "");
+       uiDefBut(block, BUT, B_SUBDIVCURVE, "Subdivide", 400,180,150,20, 0, 0, 0, 0, 0, "Subdivide selected");
        if(ob->type==OB_SURF) {
-               uiDefBut(block, BUT, B_SPINNURB, "Spin",         400,160,150,20, 0, 0, 0, 0, 0, "");
+               uiDefBut(block, BUT, B_SPINNURB, "Spin",         400,160,150,20, 0, 0, 0, 0, 0, "Spin selected 360 degrees");
        }
        uiBlockBeginAlign(block);
        uiDefBut(block, BUT,B_HIDE,             "Hide",                 400,120,150,18, 0, 0, 0, 0, 0, "Hides selected faces");
@@ -1223,7 +1246,7 @@ static void editing_panel_curve_tools1(Object *ob, Curve *cu)
        uiDefBut(block, BUT,B_SELSWAP,  "Select Swap",  400,80,150,18, 0, 0, 0, 0, 0, "Selects unselected faces, and deselects selected faces");
        uiBlockEndAlign(block);
 
-       uiDefButF(block, NUM,   REDRAWVIEW3D, "NSize:", 400, 40, 150, 19, &editbutsize, 0.001, 1.0, 10, 0, "");
+       uiDefButF(block, NUM,   REDRAWVIEW3D, "NSize:", 400, 40, 150, 19, &editbutsize, 0.001, 1.0, 10, 0, "Normal size for drawing");
 }
 
 /* for curve, surf and font! */
@@ -1234,9 +1257,9 @@ static void editing_panel_curve_type(Object *ob, Curve *cu)
        block= uiNewBlock(&curarea->uiblocks, "editing_panel_curve_type", UI_EMBOSS, UI_HELV, curarea->win);
        if(uiNewPanel(curarea, block, "Curve and Surface", "Editing", 320, 0, 318, 204)==0) return;
 
-       uiDefButS(block, TOG|BIT|5, 0, "UV Orco",                                       600,160,150,19, &cu->flag, 0, 0, 0, 0, "");
+       uiDefButS(block, TOG|BIT|5, 0, "UV Orco",                                       600,160,150,19, &cu->flag, 0, 0, 0, 0, "Forces to use UV coordinates for texture mapping 'orco'");
        if(ob->type==OB_SURF)
-               uiDefButS(block, TOG|BIT|6, REDRAWVIEW3D, "No Puno Flip",       600,140,150,19, &cu->flag, 0, 0, 0, 0, "");
+               uiDefButS(block, TOG|BIT|6, REDRAWVIEW3D, "No Puno Flip",       600,140,150,19, &cu->flag, 0, 0, 0, 0, "Don't flip vertex normals while render");
 
        uiBlockBeginAlign(block);
        uiDefBut(block, BUT,B_DOCENTRE, "Centre",                                       600, 115, 150, 19, 0, 0, 0, 0, 0, "Shifts object data to be centered about object's origin");
@@ -1256,35 +1279,38 @@ static void editing_panel_curve_type(Object *ob, Curve *cu)
                if(ob->type==OB_CURVE) {
                        extern float prlen;             // buttons_object.c, should be moved....
                        char str[32];
+                       
+                       sprintf(str, "%.4f", prlen);
+                       uiDefBut(block, BUT, B_PRINTLEN,                "PrintLen",     600,135,75,19, 0, 0, 0, 0, 0, "");
+                       uiDefBut(block, LABEL, 0, str,                                          675,135,75,19, 0, 1.0, 0, 0, 0, "");
+                       
                        uiBlockBeginAlign(block);
                        uiDefButS(block, NUM, B_RECALCPATH, "PathLen:",                 600,50,150,19, &cu->pathlen, 1.0, 9000.0, 0, 0, "If no speed Ipo was set, the amount of frames of the path");
                        uiDefButS(block, TOG|BIT|3, B_RECALCPATH, "CurvePath",  600,30,75,19 , &cu->flag, 0, 0, 0, 0, "Enables curve to become translation path");
                        uiDefButS(block, TOG|BIT|4, REDRAWVIEW3D, "CurveFollow",675,30,75,19, &cu->flag, 0, 0, 0, 0, "Makes curve path children to rotate along path");
                        uiDefButS(block, TOG|BIT|7, B_CURVECHECK, "CurveStretch", 600,10,150,19, &cu->flag, 0, 0, 0, 0, "Option for curve-deform: makes deformed child to stretch along entire path");
+                       uiDefButS(block, TOG|BIT|8, REDRAWVIEW3D, "PathDist Offs", 600,-10,150,19, &cu->flag, 0, 0, 0, 0, "Children will use TimeOffs value as path distance offset");
 
                        uiBlockEndAlign(block);
-                       sprintf(str, "%.4f", prlen);
-                       uiDefBut(block, BUT, B_PRINTLEN,                "PrintLen",     600,-10,75,19, 0, 0, 0, 0, 0, "");
-                       uiDefBut(block, LABEL, 0, str,                                          675,-10,75,19, 0, 1.0, 0, 0, 0, "");
                }
 
                uiBlockBeginAlign(block);
-               uiDefButS(block, NUM, B_MAKEDISP, "DefResolU:", 760,160,120,19, &cu->resolu, 1.0, 128.0, 0, 0, "");
-               uiDefBut(block, BUT, B_SETRESOLU, "Set",                880,160,30,19, 0, 0, 0, 0, 0, "");
+               uiDefButS(block, NUM, B_MAKEDISP, "DefResolU:", 760,160,120,19, &cu->resolu, 1.0, 1024.0, 0, 0, "Default resolution");
+               uiDefBut(block, BUT, B_SETRESOLU, "Set",                880,160,30,19, 0, 0, 0, 0, 0, "Set resolution for interpolation");
 
                uiBlockBeginAlign(block);
-               uiDefButF(block, NUM, B_MAKEDISP, "Width:",             760,90,150,19, &cu->width, 0.0, 2.0, 1, 0, "");
-               uiDefButF(block, NUM, B_MAKEDISP, "Ext1:",              760,70,150,19, &cu->ext1, 0.0, 5.0, 10, 0, "");
-               uiDefButF(block, NUM, B_MAKEDISP, "Ext2:",              760,50,150,19, &cu->ext2, 0.0, 2.0, 1, 0, "");
-               uiDefButS(block, NUM, B_MAKEDISP, "BevResol:",  760,30,150,19, &cu->bevresol, 0.0, 10.0, 0, 0, "");
+               uiDefButF(block, NUM, B_MAKEDISP, "Width:",             760,90,150,19, &cu->width, 0.0, 2.0, 1, 0, "Make interpolated result thinner or fatter");
+               uiDefButF(block, NUM, B_MAKEDISP, "Ext1:",              760,70,150,19, &cu->ext1, 0.0, 5.0, 10, 0, "Extrude depth");
+               uiDefButF(block, NUM, B_MAKEDISP, "Ext2:",              760,50,150,19, &cu->ext2, 0.0, 2.0, 1, 0, "Extrude beveling depth");
+               uiDefButS(block, NUM, B_MAKEDISP, "BevResol:",  760,30,150,19, &cu->bevresol, 0.0, 10.0, 0, 0, "Amount of bevels");
                uiDefIDPoinBut(block, test_obcurpoin_but, B_MAKEDISP, "BevOb:",         760,10,150,19, &cu->bevobj, "Curve object name that defines the bevel shape");
                uiDefIDPoinBut(block, test_obcurpoin_but, B_MAKEDISP, "TaperOb:",               760,-10,150,19, &cu->taperobj, "Curve object name that defines the taper (width)");
 
                uiBlockBeginAlign(block);
                uiBlockSetCol(block, TH_BUT_SETTING1);
-               uiDefButS(block, TOG|BIT|2, B_MAKEDISP, "Back", 760,130,50,19, &cu->flag, 0, 0, 0, 0, "");
-               uiDefButS(block, TOG|BIT|1, B_MAKEDISP, "Front",810,130,50,19, &cu->flag, 0, 0, 0, 0, "");
-               uiDefButS(block, TOG|BIT|0, B_CU3D, "3D",               860,130,50,19, &cu->flag, 0, 0, 0, 0, "");
+               uiDefButS(block, TOG|BIT|2, B_MAKEDISP, "Back", 760,130,50,19, &cu->flag, 0, 0, 0, 0, "Draw filled back for curves");
+               uiDefButS(block, TOG|BIT|1, B_MAKEDISP, "Front",810,130,50,19, &cu->flag, 0, 0, 0, 0, "Draw filled front for curves");
+               uiDefButS(block, TOG|BIT|0, B_CU3D, "3D",               860,130,50,19, &cu->flag, 0, 0, 0, 0, "Allow Curve Object to be 3d, it doesn't fill then");
 
 
        }
@@ -1306,7 +1332,10 @@ static void editing_panel_camera_type(Object *ob, Camera *cam)
        block= uiNewBlock(&curarea->uiblocks, "editing_panel_camera_type", UI_EMBOSS, UI_HELV, curarea->win);
        if(uiNewPanel(curarea, block, "Camera", "Editing", 320, 0, 318, 204)==0) return;
 
-       uiDefButF(block, NUM,REDRAWVIEW3D, "Lens:", 470,178,160,20, &cam->lens, 1.0, 250.0, 100, 0, "Specify the lens of the camera");
+       if(cam->type==CAM_ORTHO)
+               uiDefButF(block, NUM,REDRAWVIEW3D, "Scale:", 470,178,160,20, &cam->ortho_scale, 0.01, 1000.0, 50, 0, "Specify the ortho scaling of the used camera");
+       else
+               uiDefButF(block, NUM,REDRAWVIEW3D, "Lens:", 470,178,160,20, &cam->lens, 1.0, 250.0, 100, 0, "Specify the lens of the camera");
 
        uiBlockBeginAlign(block);
        uiDefButF(block, NUM,REDRAWVIEW3D, "ClipSta:", 470,147,160,20, &cam->clipsta, 0.001*grid, 100.0*grid, 10, 0, "Specify the startvalue of the the field of view");
@@ -1315,10 +1344,10 @@ static void editing_panel_camera_type(Object *ob, Camera *cam)
 
        uiDefButF(block, NUM,REDRAWVIEW3D, "DrawSize:", 470,90,160,20, &cam->drawsize, 0.1*grid, 10.0, 10, 0, "Specify the drawsize of the camera");
 
-       uiDefButS(block, TOG, REDRAWVIEW3D, "Ortho", 470,49,61,40, &cam->type, 0, 0, 0, 0, "Render orthogonally");
+       uiDefButS(block, TOG, REDRAWVIEW3D, "Ortho",            470,29,61,60, &cam->type, 0, 0, 0, 0, "Render orthogonally");
        uiBlockBeginAlign(block);
-       uiDefButS(block, TOG|BIT|0,REDRAWVIEW3D, "ShowLimits", 533,69,97,20, &cam->flag, 0, 0, 0, 0, "Draw the field of view");
-       uiDefButS(block, TOG|BIT|1,REDRAWVIEW3D, "Show Mist", 533,49,97,20, &cam->flag, 0, 0, 0, 0, "Draw a line that indicates the mist area");
+       uiDefButS(block, TOG|BIT|0,REDRAWVIEW3D, "ShowLimits", 533,59,97,30, &cam->flag, 0, 0, 0, 0, "Draw the field of view");
+       uiDefButS(block, TOG|BIT|1,REDRAWVIEW3D, "Show Mist",  533,29,97,30, &cam->flag, 0, 0, 0, 0, "Draw a line that indicates the mist area");
        uiBlockEndAlign(block);
 }
 
@@ -1326,18 +1355,47 @@ static void editing_panel_camera_type(Object *ob, Camera *cam)
 static void editing_panel_camera_yafraydof(Object *ob, Camera *cam)
 {
        uiBlock *block;
+       char *mst1, *mst2;
 
        block= uiNewBlock(&curarea->uiblocks, "editing_panel_camera_yafraydof", UI_EMBOSS, UI_HELV, curarea->win);
        uiNewPanelTabbed("Camera", "Editing");
        if(uiNewPanel(curarea, block, "Yafray DoF", "Editing", 320, 0, 318, 204)==0) return;
 
-       uiDefButF(block, NUM, REDRAWVIEW3D, "DoFDist:", 470, 147, 160, 20, &cam->YF_dofdist, 0.0, 5000.0, 100, 0, "Sets distance to point of focus (use camera 'ShowLimits' to make visible in 3Dview)");
-       uiDefButF(block, NUM, REDRAWVIEW3D, "Aperture:", 470, 125, 160, 20, &cam->YF_aperture, 0.0, 2.0, 0, 0, "Sets lens aperture, the larger, the more blur (use small values, 0 is no DoF)");
+       uiDefButF(block, NUM, REDRAWVIEW3D, "DoFDist:", 10, 147, 180, 20, &cam->YF_dofdist, 0.0, 5000.0, 50, 0, "Sets distance to point of focus (use camera 'ShowLimits' to make visible in 3Dview)");
+       uiDefButF(block, NUM, B_DIFF, "Aperture:", 10, 125, 180, 20, &cam->YF_aperture, 0.0, 2.0, 1, 0, "Sets lens aperture, the larger, the more blur (use small values, 0 is no DoF)");
 
-       uiDefButS(block, TOG|BIT|2, 0, "Random sampling", 470, 90, 160, 20, &cam->flag, 0, 0, 0, 0, "Use noisy random Lens sampling instead of QMC");
+       uiDefButS(block, TOG|BIT|2, B_DIFF, "Random sampling", 10, 90, 180, 20, &cam->flag, 0, 0, 0, 0, "Use noisy random Lens sampling instead of QMC");
+
+       uiDefBut(block, LABEL, 0, "Bokeh", 10, 60, 180, 19, 0, 0.0, 0.0, 0, 0, "");
+       mst1 = "Bokeh Type%t|Disk1%x0|Disk2%x1|Triangle%x2|Square%x3|Pentagon%x4|Hexagon%x5|Ring%x6";
+       uiDefButS(block, MENU, B_REDR, mst1, 10, 40, 89, 20, &cam->YF_bkhtype, 0.0, 0.0, 0, 0, "Sets Bokeh type");
+       
+       if ((cam->YF_bkhtype!=0) && (cam->YF_bkhtype!=6)) {
+               mst2 = "Bokeh Bias%t|Uniform%x0|Center%x1|Edge%x2";
+               uiDefButS(block, MENU, B_REDR, mst2, 100, 40, 90, 20, &cam->YF_bkhbias, 0.0, 0.0, 0, 0, "Sets Bokeh bias");
+               if (cam->YF_bkhtype>1)
+                       uiDefButF(block, NUM, B_DIFF, "Rotation:", 10, 15, 180, 20, &cam->YF_bkhrot, 0.0, 360.0, 100, 0, "Shape rotation amount in degrees");
+       }
 
 }
 
+/* **************************** CAMERA *************************** */
+
+void do_cambuts(unsigned short event)
+{
+       Object *ob;
+       Camera *cam;
+       
+       ob= OBACT;
+       if (ob==0) return;
+       cam= ob->data;
+
+       switch(event) {
+       case 0:
+               ;
+               break;
+       }
+}
 
 /* *************************** MBALL ******************************** */
 
@@ -1362,17 +1420,17 @@ static void editing_panel_mball_type(Object *ob, MetaBall *mb)
        mb= ob->data;
 
        uiBlockBeginAlign(block);
-       uiDefButF(block, NUMSLI, B_RECALCMBALL, "Wiresize:",    470,178,250,19, &mb->wiresize, 0.05, 1.0, 0, 0, "");
-       uiDefButF(block, NUMSLI, 0, "Rendersize:",                      470,158,250,19, &mb->rendersize, 0.05, 1.0, 0, 0, "");
-       uiDefButF(block, NUMSLI, B_RECALCMBALL, "Threshold:", 470,138,250,19, &mb->thresh, 0.0001, 5.0, 0, 0, "");
+       uiDefButF(block, NUM, B_RECALCMBALL, "Wiresize:", 470,178,250,19, &mb->wiresize, 0.05, 1.0, 1, 0, "Polygonization resolution in 3d window");
+       uiDefButF(block, NUM, 0, "Rendersize:", 470,158,250,19, &mb->rendersize, 0.05, 1.0, 1, 0, "Polygonization resolution in rendering");
+       uiDefButF(block, NUM, B_RECALCMBALL, "Threshold:", 470,138,250,19, &mb->thresh, 0.0001, 5.0, 1, 0, "Defines influence of meta elements");
 
        uiBlockBeginAlign(block);
        uiBlockSetCol(block, TH_BUT_SETTING1);
-       uiDefBut(block, LABEL, 0, "Update:",            471,108,120,19, 0, 0, 0, 0, 0, "");
-       uiDefButS(block, ROW, B_DIFF, "Always", 471, 85, 120, 19, &mb->flag, 0.0, 0.0, 0, 0, "");
-       uiDefButS(block, ROW, B_DIFF, "Half Res",       471, 65, 120, 19, &mb->flag, 0.0, 1.0, 0, 0, "");
-       uiDefButS(block, ROW, B_DIFF, "Fast",           471, 45, 120, 19, &mb->flag, 0.0, 2.0, 0, 0, "");
-       uiDefButS(block, ROW, B_DIFF, "Never",          471, 25, 120, 19, &mb->flag, 0.0, 3.0, 0, 0, "");
+       uiDefBut(block, LABEL, 0, "Update:", 471,108,120,19, 0, 0, 0, 0, 0, "");
+       uiDefButS(block, ROW, B_DIFF, "Always", 471, 85, 120, 19, &mb->flag, 0.0, 0.0, 0, 0, "While editing, always updates");
+       uiDefButS(block, ROW, B_DIFF, "Half Res", 471, 65, 120, 19, &mb->flag, 0.0, 1.0, 0, 0, "While editing, updates in half resolution");
+       uiDefButS(block, ROW, B_DIFF, "Fast", 471, 45, 120, 19, &mb->flag, 0.0, 2.0, 0, 0, "While editing, updates without polygonization");
+       uiDefButS(block, ROW, B_DIFF, "Never", 471, 25, 120, 19, &mb->flag, 0.0, 3.0, 0, 0, "While editing, doesn't update");
 
 }
 
@@ -1386,25 +1444,28 @@ static void editing_panel_mball_tools(Object *ob, MetaBall *mb)
 
        if(ob==G.obedit && lastelem) {
                uiBlockBeginAlign(block);
-               uiDefButF(block, NUMSLI, B_RECALCMBALL, "Stiffness:", 750,178,250,19, &lastelem->s, 0.0, 10.0, 0, 0, "");
+               uiDefButF(block, NUM, B_RECALCMBALL, "Stiffness:", 750,178,250,19, &lastelem->s, 0.0, 10.0, 1, 0, "Stiffness for active meta");
                if(lastelem->type!=MB_BALL)
-               uiDefButF(block, NUMSLI, B_RECALCMBALL, "dx:",          750,158,250,19, &lastelem->expx, 0.0, 20.0, 0, 0, "");
+               uiDefButF(block, NUM, B_RECALCMBALL, "dx:", 750,158,250,19, &lastelem->expx, 0.0, 20.0, 1, 0, "X size for active meta");
                if((lastelem->type!=MB_BALL)&&(lastelem->type!=MB_TUBE))
-               uiDefButF(block, NUMSLI, B_RECALCMBALL, "dy:",          750,138,250,19, &lastelem->expy, 0.0, 20.0, 0, 0, "");
+               uiDefButF(block, NUM, B_RECALCMBALL, "dy:", 750,138,250,19, &lastelem->expy, 0.0, 20.0, 1, 0, "Y size for active meta");
 
                if((lastelem->type==MB_CUBE)||(lastelem->type==MB_ELIPSOID))
-               uiDefButF(block, NUMSLI, B_RECALCMBALL, "dz:",          750,118,250,19, &lastelem->expz, 0.0, 20.0, 0, 0, "");
+               uiDefButF(block, NUM, B_RECALCMBALL, "dz:", 750,118,250,19, &lastelem->expz, 0.0, 20.0, 1, 0, "Z size for active meta");
                uiBlockEndAlign(block);
 
-               uiDefButS(block, ROW, B_RECALCMBALL, "Ball",                    753,83,60,19, &lastelem->type, 1.0, 0.0, 0, 0, "");
+               uiDefButS(block, ROW, B_RECALCMBALL, "Ball", 753,83,60,19, &lastelem->type, 1.0, 0.0, 0, 0, "Draw active meta as Ball");
                uiBlockBeginAlign(block);
-               uiDefButS(block, ROW, B_RECALCMBALL, "Tube",                    753,62,60,19, &lastelem->type, 1.0, 4.0, 0, 0, "");
-               uiDefButS(block, ROW, B_RECALCMBALL, "Plane",                   814,62,60,19, &lastelem->type, 1.0, 5.0, 0, 0, "");
-               uiDefButS(block, ROW, B_RECALCMBALL, "Elipsoid",                876,62,60,19, &lastelem->type, 1.0, 6.0, 0, 0, "");
-               uiDefButS(block, ROW, B_RECALCMBALL, "Cube",                    938,62,60,19, &lastelem->type, 1.0, 7.0, 0, 0, "");
+               uiDefButS(block, ROW, B_RECALCMBALL, "Tube", 753,62,60,19, &lastelem->type, 1.0, 4.0, 0, 0, "Draw active meta as Ball");
+               uiDefButS(block, ROW, B_RECALCMBALL, "Plane", 814,62,60,19, &lastelem->type, 1.0, 5.0, 0, 0, "Draw active meta as Plane");
+               uiDefButS(block, ROW, B_RECALCMBALL, "Elipsoid", 876,62,60,19, &lastelem->type, 1.0, 6.0, 0, 0, "Draw active meta as Ellipsoid");
+               uiDefButS(block, ROW, B_RECALCMBALL, "Cube", 938,62,60,19, &lastelem->type, 1.0, 7.0, 0, 0, "Draw active meta as Cube");
                uiBlockEndAlign(block);
 
-               uiDefButS(block, TOG|BIT|1, B_RECALCMBALL, "Negative",753,16,60,19, &lastelem->flag, 0, 0, 0, 0, "");
+               uiBlockBeginAlign(block);
+               uiDefButS(block, TOG|BIT|1, B_RECALCMBALL, "Negative",753,16,125,19, &lastelem->flag, 0, 0, 0, 0, "Make active meta creating holes");
+               uiDefButS(block, TOG|BIT|2, B_RECALCMBALL, "Hide",878,16,125,19, &lastelem->flag, 0, 0, 0, 0, "Make active meta invisible");
+               uiBlockEndAlign(block);
 
        }
 
@@ -1426,6 +1487,7 @@ void do_latticebuts(unsigned short event)
                if(ob) {
                        if(ob==G.obedit) resizelattice(editLatt);
                        else resizelattice(ob->data);
+                       ob->softflag |= OB_SB_REDO;
                }
                allqueue(REDRAWVIEW3D, 0);
                break;
@@ -1451,7 +1513,7 @@ static void editing_panel_lattice_type(Object *ob, Lattice *lt)
        uiBlock *block;
 
        block= uiNewBlock(&curarea->uiblocks, "editing_panel_lattice_type", UI_EMBOSS, UI_HELV, curarea->win);
-       if(uiNewPanel(curarea, block, "Latice", "Editing", 320, 0, 318, 204)==0) return;
+       if(uiNewPanel(curarea, block, "Lattice", "Editing", 320, 0, 318, 204)==0) return;
 
 
        uiSetButLock(lt->key!=0, "Not with VertexKeys");
@@ -1776,14 +1838,14 @@ static void editing_panel_armature_bones(Object *ob, bArmature *arm)
 
                        uiDefBut(block, LABEL, 0, "child of", bx+107,by,73,18, NULL, 0.0, 0.0, 0.0, 0.0, "");
 
-                       boneString = malloc((BLI_countlist(&G.edbo) * 64)+64);
+                       boneString = MEM_mallocN((BLI_countlist(&G.edbo) * 64)+64, "Bone str");
                        build_bonestring (boneString, curBone);
 
                        curBone->parNr = editbone_to_parnr(curBone->parent);
                        but = uiDefButI(block, MENU,REDRAWVIEW3D, boneString, bx+180,by,120,18, &curBone->parNr, 0.0, 0.0, 0.0, 0.0, "Parent");
                        uiButSetFunc(but, parnr_to_editbone_cb, curBone, NULL);
 
-                       free(boneString);
+                       MEM_freeN(boneString);
 
                        /* IK to parent flag */
                        if (curBone->parent){
@@ -1882,7 +1944,8 @@ void do_meshbuts(unsigned short event)
                        allqueue(REDRAWBUTSEDIT, 0);
                        break;
                case B_MAKESTICKY:
-                       make_sticky();
+                       RE_make_sticky();
+                       allqueue(REDRAWBUTSEDIT, 0);
                        break;
                
                case B_MAKEEDGES:
@@ -2095,24 +2158,74 @@ static void editing_panel_mesh_tools1(Object *ob, Mesh *me)
        if(uiNewPanel(curarea, block, "Mesh Tools 1", "Editing", 960, 0, 318, 204)==0) return;
 
        uiBlockBeginAlign(block);
-       uiDefBut(block, BUT,B_DOCENTRE, "Centre",               1091, 200, 166, 19, 0, 0, 0, 0, 0, "Shifts object data to be centered about object's origin");
-       uiDefBut(block, BUT,B_HIDE,             "Hide",                 1091, 180,  77, 19, 0, 0, 0, 0, 0, "Hides selected faces");
-       uiDefBut(block, BUT,B_REVEAL,   "Reveal",               1171, 180,  86, 19, 0, 0, 0, 0, 0, "Reveals selected faces");
-       uiDefBut(block, BUT,B_SELSWAP,  "Select Swap",  1091, 160, 166, 19, 0, 0, 0, 0, 0, "Selects unselected faces, and deselects selected faces");
+       uiDefBut(block, BUT,B_DOCENTRE, "Centre",       955, 200, 160, 19, 0, 0, 0, 0, 0, "Shifts object data to be centered about object's origin");
+       uiDefBut(block, BUT,B_HIDE,             "Hide",         1115, 200,  160, 19, 0, 0, 0, 0, 0, "Hides selected faces");
+       uiDefBut(block, BUT,B_SELSWAP,  "Select Swap",  955, 180, 160, 19, 0, 0, 0, 0, 0, "Selects unselected faces, and deselects selected faces");
+       uiDefBut(block, BUT,B_REVEAL,   "Reveal",               1115, 180,  160, 19, 0, 0, 0, 0, 0, "Reveals selected faces");
        uiBlockEndAlign(block);
 
        uiBlockBeginAlign(block);
-       uiDefButF(block, NUM,             REDRAWVIEW3D, "NSize:",               1090, 131, 166, 19, &editbutsize, 0.001, 2.0, 10, 0, "Sets the length to use when displaying face normals");
-       uiDefButI(block, TOG|BIT|6, REDRAWVIEW3D, "Draw Normals",       1090,110,166,19, &G.f, 0, 0, 0, 0, "Displays face normals as lines");
-       uiDefButI(block, TOG|BIT|7, REDRAWVIEW3D, "Draw Faces",         1090,88,166,19, &G.f, 0, 0, 0, 0, "Displays all faces as shades");
-       uiDefButI(block, TOG|BIT|18, B_DRAWEDGES, "Draw Edges",         1090,66,166,19, &G.f, 0, 0, 0, 0, "Displays selected edges using hilights");
-       uiDefButI(block, TOG|BIT|19, B_DRAWCREASES, "Draw Creases",     1090,44,166,19, &G.f, 0, 0, 0, 0, "Displays creased edges using hilights");
-       uiDefButI(block, TOG|BIT|20, REDRAWVIEW3D, "Draw Seams",        1090,22,166,19, &G.f, 0, 0, 0, 0, "Displays UV unwrapping seams");
-       uiDefButI(block, TOG|BIT|11, 0, "All Edges",                            1090, 0,166,19, &G.f, 0, 0, 0, 0, "Displays all edges in object mode without optimization");
+       uiDefButF(block, NUM,             REDRAWVIEW3D, "NSize:",       955, 131, 150, 19, &editbutsize, 0.001, 2.0, 10, 0, "Sets the length to use when displaying face normals");
+       uiDefButI(block, TOG|BIT|6, REDRAWVIEW3D, "Draw Normals",       955,110,150,19, &G.f, 0, 0, 0, 0, "Displays face normals as lines");
+       uiDefButI(block, TOG|BIT|7, REDRAWVIEW3D, "Draw Faces",         955,88,150,19, &G.f, 0, 0, 0, 0, "Displays all faces as shades");
+       uiDefButI(block, TOG|BIT|18, REDRAWVIEW3D, "Draw Edges",        955,66,150,19, &G.f, 0, 0, 0, 0, "Displays selected edges using hilights");
+       uiDefButI(block, TOG|BIT|19, REDRAWVIEW3D, "Draw Creases",      955,44,150,19, &G.f, 0, 0, 0, 0, "Displays creases created for subsurf weighting");
+       uiDefButI(block, TOG|BIT|20, REDRAWVIEW3D, "Draw Seams",        955,22,150,19, &G.f, 0, 0, 0, 0, "Displays UV unwrapping seams");
+       uiDefButI(block, TOG|BIT|11, 0, "All Edges",                    955, 0,150,19, &G.f, 0, 0, 0, 0, "Displays all edges in object mode without optimization");
+       uiBlockEndAlign(block);
+       
+       /* Measurement drawing options */
+       uiBlockBeginAlign(block);
+       uiDefButI(block, TOG|BIT|22, REDRAWVIEW3D, "Edge Length",       1125,131,150,19, &G.f, 0, 0, 0, 0, "Displays selected edge lengths");
+       uiDefButI(block, TOG|BIT|24, REDRAWVIEW3D, "Edge Angles",       1125,110,150,19,  &G.f, 0, 0, 0, 0, "Displays the angles in the selected edges in degrees");
+       uiDefButI(block, TOG|BIT|23, REDRAWVIEW3D, "Face Area",         1125,88,150,19, &G.f, 0, 0, 0, 0, "Displays the area of selected faces");
        uiBlockEndAlign(block);
 
 }
 
+char *get_vertexgroup_menustr(Object *ob)
+{
+       bDeformGroup *dg;
+       int defCount, min, index;
+       char (*qsort_ptr)[32] = NULL;
+       char *s, *menustr;
+       
+       defCount=BLI_countlist(&ob->defbase);
+       
+       if (!defCount) min=0;
+       else min=1;
+       
+       if (defCount > 0) {
+               /*
+                * This will hold the group names temporarily
+                * so we can sort them
+                */
+               qsort_ptr = MEM_callocN (defCount * sizeof (qsort_ptr[0]),
+                                                                "qsort_ptr");
+               for (index = 1, dg = ob->defbase.first; dg; index++, dg=dg->next) {
+                       snprintf (qsort_ptr[index - 1], sizeof (qsort_ptr[0]),
+                                         "%s%%x%d|", dg->name, index);
+               }
+               
+               qsort (qsort_ptr, defCount, sizeof (qsort_ptr[0]),
+                          ( int (*)(const void *, const void *) ) strcmp);
+       }
+       
+       s= menustr = MEM_callocN((32 * defCount)+30, "menustr");        // plus 30 for when defCount==0
+       if(defCount) {
+               for (index = 0; index < defCount; index++) {
+                       int cnt= sprintf (s, "%s", qsort_ptr[index]);
+                       if (cnt>0) s+= cnt;
+               }
+       }
+       else strcpy(menustr, "No Vertex Groups in Object");
+       
+       if (qsort_ptr)
+               MEM_freeN (qsort_ptr);
+       
+       return menustr;
+}
+
 static void editing_panel_links(Object *ob)
 {
        uiBlock *block;
@@ -2212,52 +2325,20 @@ static void editing_panel_links(Object *ob)
                uiBut *but;
                int     defCount;
                bDeformGroup    *defGroup;
-               char *s, *menustr;
-               bDeformGroup *dg;
-               int min, index;
-               char (*qsort_ptr)[32] = NULL;
-
+       
                uiDefBut(block, LABEL,0,"Vertex Groups",
                                 143,153,130,20, 0, 0, 0, 0, 0, "");
 
                defCount=BLI_countlist(&ob->defbase);
 
-               if (!defCount) min=0;
-               else min=1;
-
-               if (defCount > 0) {
-                       /*
-                        * This will hold the group names temporarily
-                        * so we can sort them
-                        */
-                       qsort_ptr = MEM_callocN (defCount * sizeof (qsort_ptr[0]),
-                                                                        "qsort_ptr");
-                       for (index = 1, dg = ob->defbase.first; dg; index++, dg=dg->next) {
-                               snprintf (qsort_ptr[index - 1], sizeof (qsort_ptr[0]),
-                                                 "%s%%x%d|", dg->name, index);
-                       }
-
-                       qsort (qsort_ptr, defCount, sizeof (qsort_ptr[0]),
-                                  ( int (*)(const void *, const void *) ) strcmp);
-               }
-
-               s= menustr = MEM_callocN((32 * defCount)+20, "menustr");
-               for (index = 0; index < defCount; index++) {
-                       int cnt= sprintf (s, "%s", qsort_ptr[index]);
-                       if (cnt>0) s+= cnt;
-               }
-
-               if (qsort_ptr)
-                 MEM_freeN (qsort_ptr);
-
                uiBlockBeginAlign(block);
-               if (defCount)
-                       uiDefButS(block, MENU, REDRAWBUTSEDIT, menustr,
-                                         143, 132,18,21, &ob->actdef, min, defCount, 0, 0,
-                                         "Browses available vertex groups");
-
-               MEM_freeN (menustr);
-
+               if (defCount) {
+                       char *menustr= get_vertexgroup_menustr(ob);
+                       
+                       uiDefButS(block, MENU, REDRAWBUTSEDIT, menustr, 143, 132,18,21, &ob->actdef, 1, defCount, 0, 0, "Browses available vertex groups");
+                       MEM_freeN (menustr);
+               }
+               
                if (ob->actdef){
                        defGroup = BLI_findlink(&ob->defbase, ob->actdef-1);
                        but= uiDefBut(block, TEX,REDRAWBUTSEDIT,"",             161,132,140-18,21, defGroup->name, 0, 32, 0, 0, "Displays current vertex group name. Click to change. (Match bone name for deformation.)");
@@ -2292,6 +2373,7 @@ void do_fpaintbuts(unsigned short event)
        Mesh *me;
        Object *ob;
        extern TFace *lasttface; /* caches info on tface bookkeeping ?*/
+       extern VPaint Gvp;         /* from vpaint */
 
        ob= OBACT;
        if(ob==0) return;
@@ -2375,54 +2457,129 @@ void do_fpaintbuts(unsigned short event)
                        allqueue(REDRAWBUTSEDIT, 0);
                }
                break;
+       case B_WEIGHT0_0:
+               editbutvweight = 0.0f;
+               allqueue(REDRAWBUTSEDIT, 0);
+               break;
+
+       case B_WEIGHT1_4:
+               editbutvweight = 0.25f;
+               allqueue(REDRAWBUTSEDIT, 0);
+               break;
+       case B_WEIGHT1_2:
+               editbutvweight = 0.5f;
+               allqueue(REDRAWBUTSEDIT, 0);
+               break;
+       case B_WEIGHT3_4:
+               editbutvweight = 0.75f;
+               allqueue(REDRAWBUTSEDIT, 0);
+               break;
+       case B_WEIGHT1_0:
+               editbutvweight = 1.0f;
+               allqueue(REDRAWBUTSEDIT, 0);
+               break;
+               
+       case B_OPA0_0:
+               Gvp.a = 0.0f;
+               allqueue(REDRAWBUTSEDIT, 0);
+               break;
+       case B_OPA1_4:
+               Gvp.a = 0.25f;
+               allqueue(REDRAWBUTSEDIT, 0);
+               break;
+       case B_OPA1_2:
+               Gvp.a = 0.5f;
+               allqueue(REDRAWBUTSEDIT, 0);
+               break;
+       case B_OPA3_4:
+               Gvp.a = 0.75f;
+               allqueue(REDRAWBUTSEDIT, 0);
+               break;
+       case B_OPA1_0:
+               Gvp.a = 1.0f;
+               allqueue(REDRAWBUTSEDIT, 0);
+               break;
+               
+
        }
 }
 
 
-/* -------------------- MODE: vpaint faceselect ------------------- */
+/* -------------------- MODE: vpaint  ------------------- */
 
 static void editing_panel_mesh_paint(void)
 {
        extern VPaint Gvp;         /* from vpaint */
        uiBlock *block;
-
+       
        block= uiNewBlock(&curarea->uiblocks, "editing_panel_mesh_paint", UI_EMBOSS, UI_HELV, curarea->win);
        if(uiNewPanel(curarea, block, "Paint", "Editing", 640, 0, 318, 204)==0) return;
+       
+       
+       if(G.f & ( G_WEIGHTPAINT))
+       {
+               Object *ob;
+           ob= OBACT;
+       if(ob==NULL) return;
 
-    uiBlockBeginAlign(block);
-       uiDefButF(block, NUMSLI, 0, "R ",                       979,160,194,19, &Gvp.r, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of red used for painting");
-       uiDefButF(block, NUMSLI, 0, "G ",                       979,140,194,19, &Gvp.g, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of green used for painting");
-       uiDefButF(block, NUMSLI, 0, "B ",                       979,120,194,19, &Gvp.b, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of blue used for painting");
-       uiBlockEndAlign(block);
-
-       uiDefButF(block, NUMSLI, 0, "Opacity ",         979,100,194,19, &Gvp.a, 0.0, 1.0, 0, 0, "The amount of pressure on the brush");
-       uiDefButF(block, NUMSLI, 0, "Size ",            979,80,194,19, &Gvp.size, 2.0, 64.0, 0, 0, "The size of the brush");
-
-       uiDefButF(block, COL, B_REDR, "",               1176,99,28,80, &(Gvp.r), 0, 0, 0, B_VPCOLSLI, "");
-       uiBlockBeginAlign(block);
-       uiDefButS(block, ROW, B_DIFF, "Mix",                    1212,160,63,19, &Gvp.mode, 1.0, 0.0, 0, 0, "Mix the vertex colours");
-       uiDefButS(block, ROW, B_DIFF, "Add",                    1212,140,63,19, &Gvp.mode, 1.0, 1.0, 0, 0, "Add the vertex colour");
-       uiDefButS(block, ROW, B_DIFF, "Sub",                    1212, 120,63,19, &Gvp.mode, 1.0, 2.0, 0, 0, "Subtract from the vertex colour");
-       uiDefButS(block, ROW, B_DIFF, "Mul",                    1212, 100,63,19, &Gvp.mode, 1.0, 3.0, 0, 0, "Multiply the vertex colour");
-       uiDefButS(block, ROW, B_DIFF, "Filter",         1212, 80,63,19, &Gvp.mode, 1.0, 4.0, 0, 0, "Mix the colours with an alpha factor");
-
-       uiBlockBeginAlign(block);
-       uiDefButS(block, TOG|BIT|1, 0, "Area",          979,50,81,19, &Gvp.flag, 0, 0, 0, 0, "Set the area the brush covers");
-       uiDefButS(block, TOG|BIT|2, 0, "Soft",          1061,50,112,19, &Gvp.flag, 0, 0, 0, 0, "Use a soft brush");
-       uiDefButS(block, TOG|BIT|3, 0, "Normals",       1174,50,102,19, &Gvp.flag, 0, 0, 0, 0, "Use vertex normal for painting");
-
-       uiBlockBeginAlign(block);
-       uiDefBut(block, BUT, B_VPGAMMA, "Set",  979,30,81,19, 0, 0, 0, 0, 0, "Apply Mul and Gamma to vertex colours");
-       uiDefButF(block, NUM, B_DIFF, "Mul:",           1061,30,112,19, &Gvp.mul, 0.1, 50.0, 10, 0, "Set the number to multiply vertex colours with");
-       uiDefButF(block, NUM, B_DIFF, "Gamma:",         1174,30,102,19, &Gvp.gamma, 0.1, 5.0, 10, 0, "Change the clarity of the vertex colours");
-       uiBlockEndAlign(block);
-
-       uiDefBut(block, BUT, B_SET_VCOL, "Set VertCol", 979,5,81,20, 0, 0, 0, 0, 0, "Set Vertex colour of selection to current (Shift+K)");
-
+               uiBlockBeginAlign(block);
+               uiDefButF(block, NUMSLI, REDRAWVIEW3D, "Weight:",979,160,194,19, &editbutvweight, 0, 1, 10, 0, "Sets the current vertex group's bone deformation strength");
+               uiDefBut(block, BUT, B_WEIGHT0_0 , "0",                 979,140,40,19, 0, 0, 0, 0, 0, "");
+               uiDefBut(block, BUT, B_WEIGHT1_4 , "1/4",                       1020,140,40,19, 0, 0, 0, 0, 0, "");
+               uiDefBut(block, BUT, B_WEIGHT1_2 , "1/2",                       1060,140,40,19, 0, 0, 0, 0, 0, "");
+               uiDefBut(block, BUT, B_WEIGHT3_4 , "3/4",                       1100,140,40,19, 0, 0, 0, 0, 0, "");
+               uiDefBut(block, BUT, B_WEIGHT1_0 , "1",                 1140,140,33,19, 0, 0, 0, 0, 0, "");
+               
+               uiDefButF(block, NUMSLI, 0, "Opacity ",         979,120,194,19, &Gvp.a, 0.0, 1.0, 0, 0, "The amount of pressure on the brush");
+               uiDefBut(block, BUT, B_OPA0_0 , "0",                    979,100,40,19, 0, 0, 0, 0, 0, "");
+               uiDefBut(block, BUT, B_OPA1_4 , "1/4",                  1020,100,40,19, 0, 0, 0, 0, 0, "");
+               uiDefBut(block, BUT, B_OPA1_2 , "1/2",                  1060,100,40,19, 0, 0, 0, 0, 0, "");
+               uiDefBut(block, BUT, B_OPA3_4 , "3/4",                  1100,100,40,19, 0, 0, 0, 0, 0, "");
+               uiDefBut(block, BUT, B_OPA1_0 , "1",                    1140,100,33,19, 0, 0, 0, 0, 0, "");
+               uiDefButF(block, NUMSLI, 0, "Size ",            979,80,194,19, &Gvp.size, 2.0, 64.0, 0, 0, "The size of the brush");
+               uiBlockEndAlign(block);
+               if(ob){
+               uiBlockBeginAlign(block);
+       uiDefButBitC(block, TOG, OB_DRAWWIRE, REDRAWVIEW3D, "Wire",     979,40,194,19   , &ob->dtx, 0, 0, 0, 0, "Displays the active object's wireframe in shaded drawing modes");
+               uiBlockEndAlign(block);
+               }
+       }
+       else{
+               uiBlockBeginAlign(block);
+               uiDefButF(block, NUMSLI, 0, "R ",                       979,160,194,19, &Gvp.r, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of red used for painting");
+               uiDefButF(block, NUMSLI, 0, "G ",                       979,140,194,19, &Gvp.g, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of green used for painting");
+               uiDefButF(block, NUMSLI, 0, "B ",                       979,120,194,19, &Gvp.b, 0.0, 1.0, B_VPCOLSLI, 0, "The amount of blue used for painting");
+               uiBlockEndAlign(block);
+               uiDefButF(block, NUMSLI, 0, "Opacity ",         979,100,194,19, &Gvp.a, 0.0, 1.0, 0, 0, "The amount of pressure on the brush");
+               uiDefButF(block, NUMSLI, 0, "Size ",            979,80,194,19, &Gvp.size, 2.0, 64.0, 0, 0, "The size of the brush");
+               
+               uiDefButF(block, COL, B_REDR, "",               1176,99,28,80, &(Gvp.r), 0, 0, 0, B_VPCOLSLI, "");
+               uiBlockBeginAlign(block);
+               uiDefButS(block, ROW, B_DIFF, "Mix",                    1212,160,63,19, &Gvp.mode, 1.0, 0.0, 0, 0, "Mix the vertex colours");
+               uiDefButS(block, ROW, B_DIFF, "Add",                    1212,140,63,19, &Gvp.mode, 1.0, 1.0, 0, 0, "Add the vertex colour");
+               uiDefButS(block, ROW, B_DIFF, "Sub",                    1212, 120,63,19, &Gvp.mode, 1.0, 2.0, 0, 0, "Subtract from the vertex colour");
+               uiDefButS(block, ROW, B_DIFF, "Mul",                    1212, 100,63,19, &Gvp.mode, 1.0, 3.0, 0, 0, "Multiply the vertex colour");
+               uiDefButS(block, ROW, B_DIFF, "Filter",         1212, 80,63,19, &Gvp.mode, 1.0, 4.0, 0, 0, "Mix the colours with an alpha factor");
+               
+               uiBlockBeginAlign(block);
+               uiDefButS(block, TOG|BIT|1, 0, "Area",          979,50,81,19, &Gvp.flag, 0, 0, 0, 0, "Vertex paint evaluates the area of the face the brush covers (otherwise vertices only)");
+               uiDefButS(block, TOG|BIT|2, 0, "Soft",          1061,50,112,19, &Gvp.flag, 0, 0, 0, 0, "Use a soft brush");
+               uiDefButS(block, TOG|BIT|3, 0, "Normals",       1174,50,102,19, &Gvp.flag, 0, 0, 0, 0, "Vertex paint applies the vertex normal before painting");
+               
+               uiBlockBeginAlign(block);
+               uiDefBut(block, BUT, B_VPGAMMA, "Set",  979,30,81,19, 0, 0, 0, 0, 0, "Apply Mul and Gamma to vertex colours");
+               uiDefButF(block, NUM, B_DIFF, "Mul:",           1061,30,112,19, &Gvp.mul, 0.1, 50.0, 10, 0, "Set the number to multiply vertex colours with");
+               uiDefButF(block, NUM, B_DIFF, "Gamma:",         1174,30,102,19, &Gvp.gamma, 0.1, 5.0, 10, 0, "Change the clarity of the vertex colours");
+               uiBlockEndAlign(block);
+               
+               uiDefBut(block, BUT, B_SET_VCOL, "Set VertCol", 979,5,81,20, 0, 0, 0, 0, 0, "Set Vertex colour of selection to current (Shift+K)");
+       }
+       
 }
 
 static void editing_panel_mesh_texface(void)
 {
+       extern VPaint Gvp;         /* from vpaint */
        uiBlock *block;
        extern TFace *lasttface;
 
@@ -2457,12 +2614,16 @@ static void editing_panel_mesh_texface(void)
                uiDefButC(block, ROW, REDRAWVIEW3D, "Alpha",    720,80,60,19, &lasttface->transp, 2.0, 2.0, 0, 0, "Render polygon transparent, depending on alpha channel of the texture");
 
                uiBlockSetCol(block, TH_AUTO);
+
+               uiBlockBeginAlign(block);
+               uiDefButF(block, COL, B_VPCOLSLI, "",                   769,40,40,28, &(Gvp.r), 0, 0, 0, 0, "");
+               uiDefBut(block, BUT, B_SET_VCOL, "Set VertCol", 809,40,103,28, 0, 0, 0, 0, 0, "Set Vertex colour of selection to current (Shift+K)");
+
                uiBlockBeginAlign(block);
                uiDefBut(block, BUT, B_COPY_TF_MODE, "Copy DrawMode", 600,7,117,28, 0, 0, 0, 0, 0, "Copy the drawmode from active face to selected faces");
                uiDefBut(block, BUT, B_COPY_TF_UV, "Copy UV+tex",         721,7,85,28, 0, 0, 0, 0, 0, "Copy UV information and textures from active face to selected faces");
                uiDefBut(block, BUT, B_COPY_TF_COL, "Copy VertCol",       809,7,103,28, 0, 0, 0, 0, 0, "Copy vertex colours from active face to selected faces");
        }
-
 }
 
 void do_uvautocalculationbuts(unsigned short event)
@@ -2535,7 +2696,7 @@ static void editing_panel_mesh_uvautocalculation(void)
 
        uiBlockBeginAlign(block);
        uiDefBut(block, BUT, B_UVAUTO_CUBE,"Cube",315,row,200,butH, 0, 0, 0, 0, 0, "Applies cube UV mapping");
-       uiDefButF(block, NUM,B_UVAUTO_CUBESIZE ,"Size:",315,row-butHB,200,butH, &uv_calc_cubesize, 0.0001, 100.0, 10, 0, "Defines the cubemap size");
+       uiDefButF(block, NUM,B_UVAUTO_CUBESIZE ,"Size:",315,row-butHB,200,butH, &uv_calc_cubesize, 0.0001, 100.0, 10, 3, "Defines the cubemap size");
        uiBlockEndAlign(block);
        row-= 2*butHB+butS;
 
@@ -2546,7 +2707,7 @@ static void editing_panel_mesh_uvautocalculation(void)
 
        uiBlockBeginAlign(block);
        uiDefBut(block, BUT, B_UVAUTO_CYLINDER,"Cylinder",315,row,200,butH, 0, 0, 0, 0, 0, "Applies cylindrical UV mapping");
-       uiDefButF(block, NUM,B_UVAUTO_CYLRADIUS ,"Radius:",315,row-butHB,200,butH, &uv_calc_radius, 0.1, 100.0, 10, 0, "Defines the radius of the UV mapping cylinder");
+       uiDefButF(block, NUM,B_UVAUTO_CYLRADIUS ,"Radius:",315,row-butHB,200,butH, &uv_calc_radius, 0.1, 100.0, 10, 3, "Defines the radius of the UV mapping cylinder");
        uiBlockEndAlign(block);
        row-= 2*butHB+butS;