Two in one:
[blender.git] / source / blender / src / toets.c
index 93d38ad6b348fd7a630fc9107a3b4e615e49c646..355a1535f42dac2242a6241bf76e74cf9f431199 100644 (file)
@@ -79,6 +79,7 @@
 #include "BIF_poseobject.h"
 #include "BIF_previewrender.h"
 #include "BIF_renderwin.h"
+#include "BIF_retopo.h"
 #include "BIF_screen.h"
 #include "BIF_space.h"
 #include "BIF_toets.h"
@@ -86,6 +87,7 @@
 #include "BIF_usiblender.h"
 #include "BIF_writeimage.h"
 
+#include "BDR_sculptmode.h"
 #include "BDR_vpaint.h"
 #include "BDR_editobject.h"
 #include "BDR_editface.h"
@@ -139,8 +141,10 @@ void persptoetsen(unsigned short event)
        }
        else if((G.qual & (LR_SHIFTKEY | LR_CTRLKEY)) && (event != PAD0)) {
                
-               /* indicate that this view is inverted */
-               G.vd->flag2 |= V3D_OPP_DIRECTION_NAME;
+               /* Indicate that this view is inverted,
+                * but only if it actually _was_ inverted (jobbe) */
+               if (event==PAD7 || event == PAD1 || event == PAD3)
+                       G.vd->flag2 |= V3D_OPP_DIRECTION_NAME;
                
                if(event==PAD0) {
                        /* G.vd->persp= 3; */
@@ -201,8 +205,11 @@ void persptoetsen(unsigned short event)
                }
        }
        else {
-               /* indicate that this view is not inverted */
-               G.vd->flag2 &= ~V3D_OPP_DIRECTION_NAME;
+               /* Indicate that this view is not inverted.
+                * Don't do this for PADMINUS/PADPLUSKEY, though. (jobbe)*/
+               if (event != PADMINUS && event != PADPLUSKEY)
+                       G.vd->flag2 &= ~V3D_OPP_DIRECTION_NAME;
+               
 
                if(event==PAD7) {
                        G.vd->viewquat[0]= 1.0;
@@ -300,7 +307,7 @@ void persptoetsen(unsigned short event)
                else if(G.vd->persp<2) {
                        if(event==PAD4 || event==PAD6) {
                                /* z-axis */
-                               phi= (float)(M_PI/24.0);
+                               phi= (float)(M_PI/360.0)*U.pad_rot_angle;
                                if(event==PAD6) phi= -phi;
                                si= (float)sin(phi);
                                q1[0]= (float)cos(phi);
@@ -315,7 +322,7 @@ void persptoetsen(unsigned short event)
                                VECCOPY(q1+1, G.vd->viewinv[0]);
                                
                                Normalise(q1+1);
-                               phi= (float)(M_PI/24.0);
+                               phi= (float)(M_PI/360.0)*U.pad_rot_angle;
                                if(event==PAD2) phi= -phi;
                                si= (float)sin(phi);
                                q1[0]= (float)cos(phi);
@@ -329,6 +336,8 @@ void persptoetsen(unsigned short event)
 
                if(G.vd->persp<2) perspo= G.vd->persp;
        }
+
+       retopo_force_update();
        
        if(preview3d_event) 
                BIF_view3d_previewrender_signal(curarea, PR_DBASE|PR_DISPRECT);
@@ -441,15 +450,16 @@ int blenderqread(unsigned short event, short val)
                break;
        case F3KEY:
                if(G.qual==0) {
-                       BIF_save_rendered_image_fs(0);
+                       BIF_save_rendered_image_fs();
+                       return 0;
+               }
+               else if(G.qual==LR_SHIFTKEY) {
+                       newspace(curarea, SPACE_NODE);
                        return 0;
                }
                else if(G.qual & LR_CTRLKEY) {
                        BIF_screendump(0);
                }
-               else if(G.qual & LR_SHIFTKEY) {
-                       BIF_save_rendered_image_fs(1);
-               }
                break;
        case F4KEY:
                if(G.qual==LR_SHIFTKEY) {
@@ -458,7 +468,7 @@ int blenderqread(unsigned short event, short val)
                        ob= OBACT;
                        if(ob) strcpy(str, ob->id.name);
 
-                       activate_fileselect(FILE_MAIN, "Data Select", str, 0);
+                       activate_fileselect(FILE_MAIN, "Data Select", str, NULL);
                        return 0;
                }
                else if(G.qual==0) {
@@ -647,11 +657,11 @@ int blenderqread(unsigned short event, short val)
                                else if(G.vd) {
                                        /* also when Alt-E */
                                        if(G.obedit==NULL) {
-                                               enter_editmode();
+                                               enter_editmode(EM_WAITCURSOR);
                                                if(G.obedit) BIF_undo_push("Original"); // here, because all over code enter_editmode is abused
                                        }
                                        else
-                                               exit_editmode(2); // freedata, and undo
+                                               exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); // freedata, and undo
                                }
                                return 0;
                        }
@@ -665,25 +675,12 @@ int blenderqread(unsigned short event, short val)
                                }
                                else if(ob->type==OB_MESH) {
                                        if(ob==G.obedit) EM_selectmode_menu();
+                                       else if(G.f & G_SCULPTMODE)
+                                               sculptmode_selectbrush_menu();
                                        else set_wpaint();
                                }
                        }
                }
-               else if(G.qual==LR_SHIFTKEY) {  // ??
-                       if(G.obedit)
-                               exit_editmode(2); // freedata, and undo
-                       if(G.f & G_FACESELECT)
-                               set_faceselect();
-                       if(G.f & G_VERTEXPAINT)
-                               set_vpaint();
-                       if(G.f & G_TEXTUREPAINT) {
-                               G.f &= ~G_TEXTUREPAINT;
-                               allqueue(REDRAWVIEW3D, 0);
-                               allqueue(REDRAWBUTSEDIT, 0);
-                       }
-                       if(G.f & G_WEIGHTPAINT)
-                               set_wpaint();
-               }
                break;
 
        case BACKSPACEKEY:
@@ -705,18 +702,19 @@ int blenderqread(unsigned short event, short val)
                if(G.qual==LR_ALTKEY) {
                        if(G.vd && textspace==0) {
                                if(G.obedit==0) {
-                                       enter_editmode();
+                                       enter_editmode(EM_WAITCURSOR);
                                        BIF_undo_push("Original");
                                }
                                else
-                                       exit_editmode(2); // freedata, and undo
+                                       exit_editmode(EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); // freedata, and undo
                                return 0;
                        }                       
                }
                break;
        case IKEY:
-               if(textediting==0 && textspace==0 && curarea->spacetype!=SPACE_FILE && curarea->spacetype!=SPACE_IMASEL) {
-                       if(G.qual==0) {
+               if(textediting==0 && textspace==0 && !ELEM3(curarea->spacetype, SPACE_FILE, SPACE_IMASEL, SPACE_NODE)) {
+                       if(G.f & G_SCULPTMODE) return 1;
+                       else if(G.qual==0) {
                                common_insertkey();
                                return 0;
                        }