Adding last view feature for PAD0
authorJoilnen Leite <joilnen.leite@gmail.com>
Mon, 29 Sep 2008 00:44:33 +0000 (00:44 +0000)
committerJoilnen Leite <joilnen.leite@gmail.com>
Mon, 29 Sep 2008 00:44:33 +0000 (00:44 +0000)
source/blender/makesdna/DNA_view3d_types.h
source/blender/src/space.c
source/blender/src/toets.c

index b30a7162b9388cb06afec862655b79a484883dec..8e8bab0dd11314f94d1732600b968c7371fbe18c 100644 (file)
@@ -144,6 +144,11 @@ typedef struct View3D {
        
        void *properties_storage;       /* Nkey panel stores stuff here, not in file */
        struct bGPdata *gpd;            /* Grease-Pencil Data (annotation layers) */
        
        void *properties_storage;       /* Nkey panel stores stuff here, not in file */
        struct bGPdata *gpd;            /* Grease-Pencil Data (annotation layers) */
+
+       /* last view */
+       float lviewquat[4];
+       short lpersp, pad4;
+       int pad5;
 } View3D;
 
 
 } View3D;
 
 
index bc5541f1bcfc0838f8a9b0119d6cadab8c4155d0..772dc27732fdfa47841867f6c79520dbbd714d70 100644 (file)
@@ -1709,6 +1709,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                break;
                        case MIDDLEMOUSE:
                                handle_view_middlemouse();
                                break;
                        case MIDDLEMOUSE:
                                handle_view_middlemouse();
+                               G.vd->view = -1; 
                                break;
                        case RIGHTMOUSE:
                                if((G.obedit) && (G.qual & LR_CTRLKEY)==0) {
                                break;
                        case RIGHTMOUSE:
                                if((G.obedit) && (G.qual & LR_CTRLKEY)==0) {
index df0a292157830d33fa74724ff2c81efef29b2d8b..8b5decdfe94121e0b6fb99a587abaafedfac4a90 100644 (file)
@@ -289,6 +289,7 @@ void persptoetsen(unsigned short event)
                                if(G.vd->persp==V3D_PERSP) G.vd->persp=V3D_ORTHO;
                                else G.vd->persp=V3D_PERSP;
                        }
                                if(G.vd->persp==V3D_PERSP) G.vd->persp=V3D_ORTHO;
                                else G.vd->persp=V3D_PERSP;
                        }
+                       G.vd->lpersp = G.vd->persp; 
                }
                else if(event==PAD0) {
                        if(G.qual==LR_ALTKEY) {
                }
                else if(event==PAD0) {
                        if(G.qual==LR_ALTKEY) {
@@ -317,7 +318,14 @@ void persptoetsen(unsigned short event)
                                G.vd->camera= scene_find_camera(G.scene);
                                handle_view3d_lock();
                        }
                                G.vd->camera= scene_find_camera(G.scene);
                                handle_view3d_lock();
                        }
-                       
+                       if(!G.vd->view) {
+                               QUATCOPY(G.vd->viewquat, G.vd->lviewquat);
+                               G.vd->persp = G.vd->lpersp;
+                       }
+                       else {
+                               QUATCOPY(G.vd->lviewquat, G.vd->viewquat);
+                               G.vd->lpersp = G.vd->persp;
+                       }       
                        if(G.vd->camera && (G.vd->camera != act_cam_orig)) {
                                G.vd->persp= V3D_CAMOB;
                                G.vd->view= 0;
                        if(G.vd->camera && (G.vd->camera != act_cam_orig)) {
                                G.vd->persp= V3D_CAMOB;
                                G.vd->view= 0;
@@ -362,7 +370,7 @@ void persptoetsen(unsigned short event)
                                q1[1]= q1[2]= 0.0;
                                q1[3]= si;
                                QuatMul(G.vd->viewquat, G.vd->viewquat, q1);
                                q1[1]= q1[2]= 0.0;
                                q1[3]= si;
                                QuatMul(G.vd->viewquat, G.vd->viewquat, q1);
-                               G.vd->view= 0;
+                               G.vd->view= -1;
                        }
                        if(event==PAD2 || event==PAD8) {
                                /* horizontal axis */
                        }
                        if(event==PAD2 || event==PAD8) {
                                /* horizontal axis */
@@ -377,7 +385,7 @@ void persptoetsen(unsigned short event)
                                q1[2]*= si;
                                q1[3]*= si;
                                QuatMul(G.vd->viewquat, G.vd->viewquat, q1);
                                q1[2]*= si;
                                q1[3]*= si;
                                QuatMul(G.vd->viewquat, G.vd->viewquat, q1);
-                               G.vd->view= 0;
+                               G.vd->view= -1;
                        }
                }
 
                        }
                }