Made weight-painting more bearable :)
[blender.git] / source / blender / src / toets.c
index fde39edf64083da706bcfd1b4639b14e2fced19a..d1b0844647e4c8a65e53736c3ac1df4ecfcac59c 100644 (file)
@@ -75,6 +75,7 @@
 #include "BIF_interface.h"
 #include "BIF_poseobject.h"
 #include "BIF_renderwin.h"
+#include "BKE_object.h"
 #include "BIF_screen.h"
 #include "BIF_space.h"
 #include "BIF_toets.h"
@@ -528,7 +529,7 @@ int blenderqread(unsigned short event, short val)
        
        if(val==0) return 1;
        if(event==MOUSEY || event==MOUSEX) return 1;
-       if (G.flags & G_FLAGS_AUTOPLAY) return 1;
+       if (G.flags & G_FILE_AUTOPLAY) return 1;
 
        if (curarea && curarea->spacetype==SPACE_TEXT) textspace= 1;
        else if (curarea && curarea->spacetype==SPACE_SCRIPT) textspace= 1;
@@ -761,15 +762,16 @@ int blenderqread(unsigned short event, short val)
                        Object *ob= OBACT;
                        if(ob) {
                                if(ob->type==OB_ARMATURE) {
-                                       if(G.obpose) exit_posemode(1);
+                                       if(ob->flag & OB_POSEMODE) exit_posemode();
                                        else enter_posemode();
                                }
                                else if(ob->type==OB_MESH) {
                                        if(ob==G.obedit) EM_selectmode_menu();
+                                       else set_wpaint();
                                }
                        }
                }
-               else if(G.qual==LR_SHIFTKEY) {
+               else if(G.qual==LR_SHIFTKEY) {  // ??
                        if(G.obedit)
                                exit_editmode(2); // freedata, and undo
                        if(G.f & G_FACESELECT)
@@ -783,8 +785,6 @@ int blenderqread(unsigned short event, short val)
                        }
                        if(G.f & G_WEIGHTPAINT)
                                set_wpaint();
-                       if(G.obpose)
-                               exit_posemode(1);
                }
                break;
 
@@ -869,7 +869,7 @@ int blenderqread(unsigned short event, short val)
                break;
                
        case SKEY:
-               if(G.obpose==0 && G.obedit==0) {
+               if(G.obedit==NULL) {
                        if(G.qual==LR_CTRLKEY) {
                                strcpy(dir, G.sce);
                                if (untitled(dir)) {
@@ -885,6 +885,8 @@ int blenderqread(unsigned short event, short val)
        
        case TKEY:
                if (G.qual==(LR_SHIFTKEY|LR_ALTKEY|LR_CTRLKEY)) {
+                       Object *ob = OBACT;
+                       int event = pupmenu(ob?"Time%t|draw|recalc ob|recalc data":"Time%t|draw");
                        int a;
                        double delta, stime;
 
@@ -892,19 +894,27 @@ int blenderqread(unsigned short event, short val)
                        
                        stime= PIL_check_seconds_timer();
                        for(a=0; a<100000; a++) {
-                               scrarea_do_windraw(curarea);
+                               if (event==1) {
+                                       scrarea_do_windraw(curarea);
+                               } else if (event==2) {
+                                       ob->recalc |= OB_RECALC_OB;
+                                       object_handle_update(ob);
+                               } else if (event==3) {
+                                       ob->recalc |= OB_RECALC_DATA;
+                                       object_handle_update(ob);
+                               }
 
                                delta= PIL_check_seconds_timer()-stime;
                                if (delta>5.0) break;
                        }
                        
                        waitcursor(0);
-                       notice("FPS: %f (%d iterations)", a/delta, a);
+                       notice("%8.6f s/op - %6.2f ops/s - %d iterations", delta/a, a/delta, a);
                        return 0;
                }
                else if(G.qual==(LR_ALTKEY|LR_CTRLKEY)) {
                        int a;
-                       int event= pupmenu("10 Timer%t|draw|draw+swap|displist|undo");
+                       int event= pupmenu("10 Timer%t|draw|draw+swap|undo");
                        if(event>0) {
                                double stime= PIL_check_seconds_timer();
                                char tmpstr[128];
@@ -918,12 +928,8 @@ int blenderqread(unsigned short event, short val)
                                        } else if (event==2) {
                                                scrarea_do_windraw(curarea);
                                                screen_swapbuffers();
-                                       } else if (event==3) {
-                                               if (OBACT) {
-                                                       makeDispList(OBACT);
-                                               }
                                        }
-                                       else if(event==4) {
+                                       else if(event==3) {
                                                BKE_write_undo("10 timer");
                                        }
                                }