Added baking for softbodies.
[blender.git] / source / blender / src / space.c
index 54c69657d1adb9bf37fb0b08e6e0c6f5a440c812..dadfbf0f0b23bb3997434082b2ed84f4590926ca 100644 (file)
 #include <config.h>
 #endif
 
-#ifdef WIN32
-#include "BLI_winstuff.h"
-#endif
-
 #include "MEM_guardedalloc.h"
 
 #ifdef INTERNATIONAL
 #include "blendef.h"
 #include "datatoc.h"
 
+#include "BIF_transform.h"
+
+#include "BKE_depsgraph.h"
+
 #include "TPT_DependKludge.h"
 #ifdef NAN_TPT
 #include "BSE_trans_types.h"
@@ -528,7 +528,7 @@ static void align_view_to_selected(View3D *v3d)
        }
 }
 
-void select_children(Object *ob, int recursive)
+static void select_children(Object *ob, int recursive)
 {
        Base *base;
 
@@ -540,7 +540,7 @@ void select_children(Object *ob, int recursive)
                }
 }
 
-void select_parent(void)       /* Makes parent active and de-selected OBACT */
+static void select_parent(void)        /* Makes parent active and de-selected OBACT */
 {
        Base *base, *startbase, *basact=NULL, *oldbasact;
        
@@ -553,16 +553,19 @@ void select_parent(void)  /* Makes parent active and de-selected OBACT */
        while(base) {
                if(base->object==BASACT->object->parent) { basact=base; break; }
                base=base->next;
-               if(base==0) base= FIRSTBASE;
+               if(base==NULL) base= FIRSTBASE;
                if(base==startbase) break;
        }
-       oldbasact = BASACT;
-       BASACT = basact;
-       basact->flag |= SELECT;         
-       
-       basact->object->flag= basact->flag;
-       
-       set_active_base(basact);
+       /* can be NULL if parent in other scene */
+       if(basact) {
+               oldbasact = BASACT;
+               BASACT = basact;
+               basact->flag |= SELECT;         
+               
+               basact->object->flag= basact->flag;
+               
+               set_active_base(basact);
+       }
 }
 
 
@@ -715,7 +718,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
        unsigned short event= evt->event;
        short val= evt->val;
        char ascii= evt->ascii;
-       View3D *v3d= curarea->spacedata.first;
+       View3D *v3d= sa->spacedata.first;
        Object *ob;
        float *curs;
        int doredraw= 0, pupval;
@@ -729,6 +732,9 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                
                if(event==UI_BUT_EVENT) do_butspace(val); // temporal, view3d deserves own queue?
                
+               /* we consider manupilator a button, defaulting to leftmouse */
+               if(event==LEFTMOUSE) if(BIF_do_manipulator(sa)) return;
+               
                /* swap mouse buttons based on user preference */
                if (U.flag & USER_LMOUSESELECT) {
                        if (event==LEFTMOUSE) event = RIGHTMOUSE;
@@ -1050,6 +1056,34 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                do_layer_buttons(11); break;
                        case ACCENTGRAVEKEY:
                                do_layer_buttons(-1); break;
+                       
+                       case SPACEKEY:
+                               if(G.qual == LR_CTRLKEY) {
+                                       val= pupmenu("Manipulator%t|Enable/Disable|Translate|Rotate|Scale|Combo");
+                                       if(val>0) {
+                                               if(val==1) v3d->twflag ^= V3D_USE_MANIPULATOR;
+                                               else {
+                                                       if(val==2) v3d->twtype= V3D_MANIP_TRANSLATE;
+                                                       else if(val==3) v3d->twtype= V3D_MANIP_ROTATE;
+                                                       else if(val==4) v3d->twtype= V3D_MANIP_SCALE;
+                                                       else if(val==5) v3d->twtype= V3D_MANIP_TRANSLATE|V3D_MANIP_ROTATE|V3D_MANIP_SCALE;
+                                                       v3d->twflag |= V3D_USE_MANIPULATOR;
+                                               }
+                                               doredraw= 1;
+                                       }
+                               }
+                               else if(G.qual == LR_ALTKEY) {
+                                       val= pupmenu("Manipulator Orientation%t|Global|Local|Normal");
+                                       if(val>0) {
+                                               if(val==1) v3d->twmode= V3D_MANIP_GLOBAL;
+                                               else if(val==2) v3d->twmode= V3D_MANIP_LOCAL;
+                                               else if(val==3) v3d->twmode= V3D_MANIP_NORMAL;
+                                               v3d->twflag |= V3D_USE_MANIPULATOR;
+                                               doredraw= 1;
+                                       }
+                               }
+
+                               break;
                                
                        case AKEY:
                                if(G.qual & LR_CTRLKEY) apply_object(); // also with shift!
@@ -1176,7 +1210,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                }
                                else if (G.qual==LR_SHIFTKEY) {
                                        if (G.obedit && G.obedit->type==OB_MESH) {
-                                               transform('e');
+                                               Transform(TFM_CREASE, CTX_EDGE);
                                        }
                                }
                                break;
@@ -1208,10 +1242,18 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                else if(G.qual & LR_ALTKEY) rem_selected_from_group(); */
                                if((G.qual==LR_SHIFTKEY))
                                        select_group_menu();
-                               else if(G.qual==LR_ALTKEY)
-                                       clear_object('g');
-                               else if((G.qual==0))
-                                       transform('g');
+                               else if(G.qual==LR_ALTKEY) {
+                                       if(okee("Clear location")) {
+                                               clear_object('g');
+                                       }
+                               }
+                               else if(G.qual== (LR_CTRLKEY|LR_ALTKEY)) {
+                                       v3d->twtype= V3D_MANIP_TRANSLATE;
+                                       doredraw= 1;
+                               }
+                               else if((G.qual==0)) {
+                                       Transform(TFM_TRANSLATION, CTX_NONE);
+                               }
                                break;
                        case HKEY:
                                if(G.obedit) {
@@ -1254,6 +1296,14 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                        else if(G.obedit->type==OB_LATTICE) {
                                                if(G.qual==LR_CTRLKEY) add_hook();
                                        }
+                                       else if(G.obedit->type==OB_MBALL) {
+                                               if(G.qual==LR_ALTKEY)
+                                                       reveal_mball();
+                                               else if((G.qual==LR_SHIFTKEY))
+                                                       hide_mball(1);
+                                               else if((G.qual==0)) 
+                                                       hide_mball(0);
+                                       }
                                }
                                else if(G.f & G_FACESELECT)
                                        hide_tface();
@@ -1333,14 +1383,22 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                                selectconnected_posearmature();
                                }
                                else {
-                                       if((G.qual==LR_SHIFTKEY))
-                                               selectlinks_menu();
-                                       else if(G.qual==LR_CTRLKEY)
-                                               make_links_menu();
-                                       else if(G.f & G_FACESELECT)
-                                               select_linked_tfaces();
-                                       else if((G.qual==0))
-                                               make_local();
+                                       if(G.f & G_FACESELECT) {
+                                               if((G.qual==0))
+                                                       select_linked_tfaces(0);
+                                               else if((G.qual==LR_SHIFTKEY))
+                                                       select_linked_tfaces(1);
+                                               else if(G.qual==LR_CTRLKEY)
+                                                       select_linked_tfaces(2);
+                                       }
+                                       else {
+                                               if((G.qual==0))
+                                                       make_local();
+                                               else if((G.qual==LR_SHIFTKEY))
+                                                       selectlinks_menu();
+                                               else if(G.qual==LR_CTRLKEY)
+                                                       make_links_menu();
+                                       }
                                }
                                break;
                        case MKEY:
@@ -1354,7 +1412,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                        else if((G.qual==0) || (G.qual==LR_CTRLKEY)) {
                                                mirrormenu();
                                        }
-                                       if(G.qual & (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY)) {
+                                       if ( G.qual == (LR_SHIFTKEY | LR_ALTKEY | LR_CTRLKEY) ) {
                                                if(G.obedit->type==OB_MESH) select_non_manifold();
                                        }
                                }
@@ -1402,11 +1460,10 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                break;
                        case OKEY:
                                ob= OBACT;
-                               if(G.obedit) {
-                                       extern int prop_mode;
-
+                               if (G.obedit) {
                                        if (G.qual==LR_SHIFTKEY) {
-                                               prop_mode= !prop_mode;
+                                               extern int prop_mode;
+                                               prop_mode = (prop_mode+1)%6;
                                                allqueue(REDRAWHEADERS, 0);
                                        }
                                        else if((G.qual==0)) {
@@ -1419,11 +1476,14 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                                flip_subdivison(ob, -1);
                                        }
                                }
-                               else if(G.qual==LR_ALTKEY) clear_object('o');
+                               else if(G.qual==LR_ALTKEY) {
+                                       if(okee("Clear origin")) {
+                                               clear_object('o');
+                                       }
+                               }
                                break;
 
                        case PKEY:
-                               
                                if(G.obedit) {
                                        if(G.qual==LR_CTRLKEY || G.qual==(LR_SHIFTKEY|LR_CTRLKEY))
                                                make_parent();
@@ -1431,9 +1491,13 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                                separatemenu();
                                        else if ((G.qual==0) && ELEM(G.obedit->type, OB_CURVE, OB_SURF))
                                                separate_nurb();
+                                       else if (G.qual==LR_SHIFTKEY)
+                                               Transform(TFM_PUSHPULL, CTX_NONE);
                                }
                                else if(G.qual==LR_CTRLKEY || G.qual==(LR_SHIFTKEY|LR_CTRLKEY))
                                        make_parent();
+                               else if(G.qual==LR_SHIFTKEY)
+                                       Transform(TFM_PUSHPULL, CTX_NONE);
                                else if(G.qual==LR_ALTKEY)
                                        clear_parent();
                                else if((G.qual==0)) {
@@ -1443,8 +1507,15 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                        case RKEY:
                                if((G.obedit==0) && (G.f & G_FACESELECT) && (G.qual==0))
                                        rotate_uv_tface();
-                               else if(G.qual==LR_ALTKEY)
-                                       clear_object('r');
+                               else if(G.qual==LR_ALTKEY) {
+                                       if(okee("Clear rotation")) {
+                                               clear_object('r');
+                                       }
+                               } 
+                               else if(G.qual== (LR_CTRLKEY|LR_ALTKEY)) {
+                                       v3d->twtype= V3D_MANIP_ROTATE;
+                                       doredraw= 1;
+                               }
                                else if (G.obedit) {
                                        if((G.qual==LR_SHIFTKEY)) {
                                                if ELEM(G.obedit->type,  OB_CURVE, OB_SURF)                                     
@@ -1456,30 +1527,51 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                                if (G.obedit->type==OB_MESH)
                                                        loopoperations(LOOP_CUT);
                                        }
-                                       else if((G.qual==0))
-                                               transform('r');
+                                       else if((G.qual==0)) {
+                                               Transform(TFM_ROTATION, CTX_NONE);
+                                       }
+                               }
+                               else if((G.qual==0)) {
+                                       Transform(TFM_ROTATION, CTX_NONE);
                                }
-                               else if((G.qual==0))
-                                       transform('r');
                                break;
                        case SKEY:
-                               if(G.obedit) {
+                               if(G.qual== (LR_CTRLKEY|LR_ALTKEY)) {
+                                       v3d->twtype= V3D_MANIP_SCALE;
+                                       doredraw= 1;
+                               }
+                               else if(G.obedit) {
                                        if(G.qual==LR_ALTKEY)
-                                               transform('N'); /* scale along normal */
+                                               Transform(TFM_SHRINKFATTEN, CTX_NONE);
                                        else if(G.qual==LR_CTRLKEY)
-                                               transform('S');
+                                               Transform(TFM_SHEAR, CTX_NONE);
+                                       else if(G.qual==(LR_CTRLKEY|LR_ALTKEY))
+                                               Transform(TFM_SHEAR, CTX_NONE);
                                        else if(G.qual==LR_SHIFTKEY)
                                                snapmenu();
-                                       else if((G.qual==0))
-                                               transform('s');
+                                       else if(G.qual==0) {
+                                               Transform(TFM_RESIZE, CTX_NONE);
+                                       }
+                                       else if(G.qual==(LR_SHIFTKEY|LR_CTRLKEY)){
+                                               Transform(TFM_TOSPHERE, CTX_NONE);
+                                       }
+                                       
                                }
                                else if(G.qual==LR_ALTKEY) {
-                                       clear_object('s');
+                                       if(okee("Clear size")) {
+                                               clear_object('s');
+                                       }
                                }
-                               else if((G.qual==LR_SHIFTKEY))
+                               else if(G.qual==LR_SHIFTKEY) {
                                        snapmenu();
-                               else if((G.qual==0))
-                                       transform('s');
+                               }
+                               else if((G.qual==0)) {
+                                       Transform(TFM_RESIZE, CTX_NONE);
+                               }
+                               else if(G.qual==(LR_SHIFTKEY|LR_CTRLKEY))
+                                       Transform(TFM_TOSPHERE, CTX_NONE);
+                               else if(G.qual==(LR_CTRLKEY|LR_ALTKEY))
+                                       Transform(TFM_SHEAR, CTX_NONE);
                                break;
                        case TKEY:
                                if(G.obedit){
@@ -1489,10 +1581,14 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                                countall();
                                                makeDispList(G.obedit);
                                        }
-                                       else if((G.qual==LR_ALTKEY) && G.obedit->type==OB_CURVE)
-                                               clear_tilt();
-                                       else if((G.qual==0))
-                                               transform('t');
+                                       if (G.obedit->type==OB_CURVE) {
+                                               if (G.qual==LR_ALTKEY) {
+                                                       clear_tilt();
+                                               }
+                                               else if (G.qual==0) {
+                                                       Transform(TFM_TILT, CTX_NONE);
+                                               }
+                                       }
                                }
                                else if(G.qual==LR_CTRLKEY) {
                                        make_track();
@@ -1556,7 +1652,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                break;
                        case WKEY:
                                if((G.qual==LR_SHIFTKEY)) {
-                                       transform('w');
+                                       Transform(TFM_WARP, CTX_NONE);
                                }
                                else if(G.qual==LR_ALTKEY) {
                                        /* if(G.obedit && G.obedit->type==OB_MESH) write_videoscape(); */
@@ -1601,6 +1697,8 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                } else if(G.qual==0) {
                                        G.vd->around= V3D_CENTRE;
                                }
+                               handle_view3d_around();
+                               
                                scrarea_queue_headredraw(curarea);
                                break;
                                
@@ -1610,6 +1708,8 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                }       else if(G.qual==0) {
                                        G.vd->around= V3D_CURSOR;
                                }
+                               handle_view3d_around();
+                               
                                scrarea_queue_headredraw(curarea);
                                break;
                        
@@ -1858,7 +1958,9 @@ static void winqreadipospace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                if(in_ipo_buttons()) {
                                        swap_visible_editipo();
                                }
-                               else swap_selectall_editipo();
+                               else {
+                                       swap_selectall_editipo();
+                               }
                                allspace (REMAKEIPO, 0);
                                allqueue (REDRAWNLA, 0);
                                allqueue (REDRAWACTION, 0);
@@ -1971,7 +2073,8 @@ void space_mipmap_button_function(int event) {
        allqueue(REDRAWVIEW3D, 0);
 }
 
-void space_sound_button_function(int event)
+#if 0
+static void space_sound_button_function(int event)
 {
        int a;
        SYS_SystemHandle syshandle;
@@ -1982,6 +2085,7 @@ void space_sound_button_function(int event)
                SYS_WriteCommandLineInt(syshandle, "noaudio", a);
        }
 }
+#endif
 
 #define B_ADD_THEME    3301
 #define B_DEL_THEME    3302
@@ -1999,7 +2103,7 @@ static short th_curcol= TH_BACK;
 static char *th_curcol_ptr= NULL;
 static char th_curcol_arr[4]={0, 0, 0, 255};
 
-void info_user_themebuts(uiBlock *block, short y1, short y2, short y3)
+static void info_user_themebuts(uiBlock *block, short y1, short y2, short y3)
 {
        bTheme *btheme, *bt;
        int spacetype= 0;
@@ -2403,6 +2507,22 @@ void drawinfospace(ScrArea *sa, void *spacedata)
                        "The number of lines scrolled at a time with the mouse wheel"); 
 
 
+               uiDefBut(block, LABEL,0,"3D Transform Widget:",
+                                (xpos+(2*edgsp)+(5*mpref)+(5*midsp)),y6label,mpref,buth,
+                                0, 0, 0, 0, 0, "");
+               uiBlockBeginAlign(block);
+               uiDefButS(block, NUM, B_REDRCURW3D, "Size:",
+                                        (xpos+edgsp+(5*mpref)+(6*midsp)),y5,(mpref/2),buth,
+                                        &(U.tw_size), 2, 40, 0, 0, "Size of widget as percentage of window size");
+               uiDefButS(block, NUM, B_REDRCURW3D, "Handle:",
+                                        (xpos+edgsp+(5*mpref)+(6*midsp)+(mpref/2)),y5,(mpref/2),buth,
+                                        &(U.tw_handlesize), 2, 40, 0, 0, "Size of widget handles as percentage of widget radius");
+               uiDefButS(block, NUM, B_REDRCURW3D, "Hotspot:",
+                                 (xpos+edgsp+(5*mpref)+(6*midsp)),y4,(mpref),buth,
+                                 &(U.tw_hotspot), 4, 40, 0, 0, "Hotspot in pixels for clicking widget handles");
+               
+               uiBlockEndAlign(block);
+               
        } else if (U.userpref == 1) { /* edit methods */
 
 
@@ -2538,12 +2658,10 @@ void drawinfospace(ScrArea *sa, void *spacedata)
                                (xpos+edgsp+(2.2*mpref)+(3*midsp)),y2,mpref+(0.5*mpref)+3,buth,
                                &U.language, 0, 0, 0, 0, "Select interface language");
                                
-                       /* uiDefButBitS(block, TOG, USER_TR_TEXTEDIT, B_SETTRANSBUTS, "FTF All windows",
-                               (xpos+edgsp+(4*mpref)+(4*midsp)),y1,mpref,buth,
+                       uiDefButBitS(block, TOG, USER_USETEXTUREFONT, B_USETEXTUREFONT, "Use Textured Fonts",
+                               (xpos+edgsp+(4*mpref)+(4*midsp)),y2,mpref,buth,
                                &(U.transopts), 0, 0, 0, 0,
-                               "Use FTF drawing for fileselect and textwindow "
-                               "(under construction)");
-                       */
+                               "Use Textured Fonts");
                }
 
 /* end of INTERNATIONAL */
@@ -2674,9 +2792,9 @@ void drawinfospace(ScrArea *sa, void *spacedata)
                        (xpos+edgsp+(4*midsp)+(4*mpref)),y3label,mpref,buth,
                        0, 0, 0, 0, 0, "");
 
-               uiDefButBitI(block, TOG, USER_DISABLE_SOUND, B_SOUNDTOGGLE, "Disable Sound",
+               uiDefButBitI(block, TOG, USER_DISABLE_SOUND, B_SOUNDTOGGLE, "Disable Game Sound",
                        (xpos+edgsp+(4*mpref)+(4*midsp)),y2,mpref,buth,
-                       &(U.gameflags), 0, 0, 0, 0, "Disables sounds from being played");
+                       &(U.gameflags), 0, 0, 0, 0, "Disables sounds from being played in games");
 
                uiDefButBitS(block, TOG, USER_FILTERFILEEXTS, 0, "Filter File Extensions",
                        (xpos+edgsp+(4*mpref)+(4*midsp)),y1,mpref,buth,
@@ -3268,7 +3386,7 @@ static void winqreadseqspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                case GKEY:
                        if(sseq->mainb) break;
                        if((G.qual==0))
-                               transform_seq('g');
+                               transform_seq('g', 0);
                        break;
                case MKEY:
                        if(G.qual==LR_ALTKEY)
@@ -3399,7 +3517,7 @@ static void init_actionspace(ScrArea *sa)
        
 }
 
-void free_actionspace(SpaceAction *saction)
+static void free_actionspace(SpaceAction *saction)
 {
        /* don't free saction itself */
        
@@ -3647,9 +3765,6 @@ static void winqreadimagespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                if(G.qual & LR_SHIFTKEY) mouseco_to_curtile();
                                else gesture();
                                break;
-                       case MIDDLEMOUSE:
-                               image_viewmove();
-                               break;
                        case RIGHTMOUSE:
                                if(G.f & G_FACESELECT)
                                        mouse_select_sima();
@@ -3675,12 +3790,12 @@ static void winqreadimagespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                        toggle_uv_select('f');
                                break;
                        case EKEY :
-                               if (okee("LSCM unwrap"))
+                               if(okee("LSCM Unwrap"))
                                        unwrap_lscm();
                                break;
                        case GKEY:
                                if((G.qual==0))
-                                       transform_tface_uv('g');
+                                       transform_tface_uv('g', 0);
                                break;
                        case HKEY:
                                if(G.qual==LR_ALTKEY)
@@ -3691,8 +3806,12 @@ static void winqreadimagespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                        hide_tface_uv(0);
                                break;
                        case LKEY:
-                               if((G.qual==0))
-                                       select_linked_tface_uv();
+                               if(G.qual==0)
+                                       select_linked_tface_uv(0);
+                               else if(G.qual==LR_SHIFTKEY)
+                                       select_linked_tface_uv(1);
+                               else if(G.qual==LR_CTRLKEY)
+                                       select_linked_tface_uv(2);
                                else if(G.qual==LR_ALTKEY)
                                        unlink_selection();
                                break;
@@ -3724,11 +3843,11 @@ static void winqreadimagespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                break;
                        case RKEY:
                                if((G.qual==0))
-                                       transform_tface_uv('r');
+                                       transform_tface_uv('r', 0);
                                break;
                        case SKEY:
                                if((G.qual==0))
-                                       transform_tface_uv('s');
+                                       transform_tface_uv('s', 0);
                                break;
                        case VKEY:
                                if((G.qual==0))
@@ -3737,7 +3856,11 @@ static void winqreadimagespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                        stitch_uv_tface(1);
                                break;
                        case WKEY:
-                               transform_tface_uv('w');
+                               weld_align_menu_tface_uv();
+                               break;
+                       case PADPERIOD:
+                               if(G.qual==0)
+                                       image_viewcentre();
                                break;
                }
        }       
@@ -3754,13 +3877,13 @@ static void winqreadimagespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                do_imagebuts(val);      // drawimage.c
                break;
        case MIDDLEMOUSE:
-               image_viewmove();
+               if((G.qual==LR_CTRLKEY) || ((U.flag & USER_TWOBUTTONMOUSE) && (G.qual==(LR_ALTKEY|LR_CTRLKEY))))
+                       image_viewmove(1);
+               else
+                       image_viewmove(0);
                break;
-       case WHEELUPMOUSE:
-       case WHEELDOWNMOUSE:
-       case PADPLUSKEY:
-       case PADMINUS:
-               image_viewzoom(event);
+       case WHEELUPMOUSE: case WHEELDOWNMOUSE: case PADPLUSKEY: case PADMINUS:
+               image_viewzoom(event, 0);
                scrarea_queue_winredraw(curarea);
                break;
        case HOMEKEY:
@@ -3927,7 +4050,7 @@ static void winqreadoopsspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                        break;
                case GKEY:
                        if((G.qual==0))
-                               transform_oops('g');
+                               transform_oops('g', 0);
                        break;
                case LKEY:
                        if((G.qual==LR_SHIFTKEY))
@@ -3945,7 +4068,7 @@ static void winqreadoopsspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                        shuffle_oops();
                                }
                        } else if((G.qual==0)) {
-                               transform_oops('s');
+                               transform_oops('s', 0);
                        }
                        break;
                case PKEY:
@@ -3994,7 +4117,7 @@ void init_v2d_oops(ScrArea *sa, SpaceOops *soops)
        
        if(soops->type==SO_OUTLINER) {
                /* outliner space is window size */
-               calc_scrollrcts(v2d, sa->winx, sa->winy);
+               calc_scrollrcts(sa, v2d, sa->winx, sa->winy);
                
                v2d->tot.xmax= 0.0;
                v2d->tot.ymax= 0.0;
@@ -4221,6 +4344,8 @@ void freespacelist(ListBase *lb)
                        SpaceFile *sfile= (SpaceFile*) sl;
                        if(sfile->libfiledata)  
                                BLO_blendhandle_close(sfile->libfiledata);
+                       if(sfile->filelist)
+                               freefilelist(sfile);
                }
                else if(sl->spacetype==SPACE_BUTS) {
                        SpaceButs *buts= (SpaceButs*) sl;
@@ -4358,6 +4483,16 @@ void allqueue(unsigned short event, short val)
 
        sa= G.curscreen->areabase.first;
        while(sa) {
+//#ifdef NAN_DEP_GRAPH
+               /* dependency check.maybe not final pos */
+               if (sa->spacetype==SPACE_VIEW3D) {
+                       if (G.scene->dagisvalid == 0) {
+//                             fprintf(stderr,"building dag \n");
+                               G.scene->theDag = build_dag(G.scene, DAG_RL_ALL_BUT_DATA_MASK);
+                               G.scene->dagisvalid = 1;
+                       }
+               }
+//#endif
                if(event==REDRAWALL) {
                        scrarea_queue_winredraw(sa);
                        scrarea_queue_headredraw(sa);