Added baking for softbodies.
[blender.git] / source / blender / src / space.c
index 04f2687aa2b449abf630ac60457df063d3738fa3..dadfbf0f0b23bb3997434082b2ed84f4590926ca 100644 (file)
 
 #include "BIF_transform.h"
 
+#include "BKE_depsgraph.h"
+
 #include "TPT_DependKludge.h"
 #ifdef NAN_TPT
 #include "BSE_trans_types.h"
@@ -713,7 +715,6 @@ void BIF_undo_menu(void)
 
 static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
 {
-       static short prev_event= 0;             // used to detect an alt/ctrl/shift event
        unsigned short event= evt->event;
        short val= evt->val;
        char ascii= evt->ascii;
@@ -729,8 +730,6 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                if( uiDoBlocks(&curarea->uiblocks, event)!=UI_NOTHING ) event= 0;
                if(event==MOUSEY || event==MOUSEX) return;
                
-               prev_event= event;      // for ctrl/alt/shift event
-               
                if(event==UI_BUT_EVENT) do_butspace(val); // temporal, view3d deserves own queue?
                
                /* we consider manupilator a button, defaulting to leftmouse */
@@ -1059,8 +1058,31 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                do_layer_buttons(-1); break;
                        
                        case SPACEKEY:
-                               G.vd->twflag ^= V3D_USE_MANIPULATOR;
-                               doredraw= 1;
+                               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:
@@ -1224,7 +1246,12 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                        if(okee("Clear location")) {
                                                clear_object('g');
                                        }
-                               } else if((G.qual==0)) {
+                               }
+                               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;
@@ -1484,7 +1511,12 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                        if(okee("Clear rotation")) {
                                                clear_object('r');
                                        }
-                               } else if (G.obedit) {
+                               } 
+                               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)                                     
                                                        selectrow_nurb();
@@ -1504,7 +1536,11 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                }
                                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(TFM_SHRINKFATTEN, CTX_NONE);
                                        else if(G.qual==LR_CTRLKEY)
@@ -1767,26 +1803,6 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                        }
                }
        }
-       else {  // val==0, hotkeys for ctrl/alt/shift
-               if(prev_event==event) {
-                       switch(event) {
-                               
-                       case RIGHTCTRLKEY: 
-                       case LEFTCTRLKEY:
-                               if(v3d->twflag & V3D_USE_MANIPULATOR) {
-                                       if(v3d->twtype & V3D_MANIP_SCALE) 
-                                               v3d->twtype= V3D_MANIP_TRANSLATE;
-                                       else if(v3d->twtype & V3D_MANIP_TRANSLATE)
-                                               v3d->twtype= V3D_MANIP_ROTATE;
-                                       else if(v3d->twtype & V3D_MANIP_ROTATE)
-                                               v3d->twtype= V3D_MANIP_SCALE;
-                                       
-                                       doredraw= 1;
-                               }
-                               break;
-                       }
-               }
-       }
        
        if(doredraw) {
                scrarea_queue_winredraw(curarea);
@@ -2502,11 +2518,9 @@ void drawinfospace(ScrArea *sa, void *spacedata)
                                         (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/2),buth,
+                                 (xpos+edgsp+(5*mpref)+(6*midsp)),y4,(mpref),buth,
                                  &(U.tw_hotspot), 4, 40, 0, 0, "Hotspot in pixels for clicking widget handles");
-               uiDefButBitS(block, TOG, U_TW_ABSOLUTE, B_REDRCURW3D, "Fixed Size",
-                                 (xpos+edgsp+(5*mpref)+(6*midsp)+(mpref/2)),y4,(mpref/2),buth,
-                                 &(U.tw_flag), 2, 40, 0, 0, "Size of widget based on fixed window size (1000 pixels)");
+               
                uiBlockEndAlign(block);
                
        } else if (U.userpref == 1) { /* edit methods */
@@ -3372,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)
@@ -3781,7 +3795,7 @@ static void winqreadimagespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                break;
                        case GKEY:
                                if((G.qual==0))
-                                       transform_tface_uv('g');
+                                       transform_tface_uv('g', 0);
                                break;
                        case HKEY:
                                if(G.qual==LR_ALTKEY)
@@ -3829,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))
@@ -4036,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))
@@ -4054,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:
@@ -4469,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);