- Removed temporal hack that switched manipulator type on G, R, S hotkeys.
authorTon Roosendaal <ton@blender.org>
Tue, 22 Mar 2005 15:01:36 +0000 (15:01 +0000)
committerTon Roosendaal <ton@blender.org>
Tue, 22 Mar 2005 15:01:36 +0000 (15:01 +0000)
  That was blocking immediate hotkey access for normal blendering.
- New, experimental, hotkey to switch: CTRLKEY! Added code in such a way
  it detects a CTRL key press and release without using it as modifier.
  Pressing CTRL will cycle through the 3 manipulator types.

- Fix for yesterday's commit; click on centerpoint for switching
  orientation happened too on a click for other widgets. Not nice...

source/blender/src/space.c
source/blender/src/transform.c
source/blender/src/transform_manipulator.c

index 469643a85e3ff4c729c95da727ad794052b9a745..3f796a79ff9aab28bc528faec272d8d6fa89a763 100644 (file)
@@ -713,6 +713,7 @@ 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;
@@ -725,6 +726,8 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
        
        if(val) {
 
+               prev_event= event;      // for ctrl/alt/shift event
+               
                if( uiDoBlocks(&curarea->uiblocks, event)!=UI_NOTHING ) event= 0;
                if(event==MOUSEY || event==MOUSEX) return;
                
@@ -1217,13 +1220,6 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                                clear_object('g');
                                        }
                                } else if((G.qual==0)) {
-                                       if(v3d->twflag & V3D_USE_MANIPULATOR) {
-                                               if((v3d->twtype & V3D_MANIPULATOR_TRANSLATE)==0) {
-                                                       v3d->twtype= V3D_MANIPULATOR_TRANSLATE;
-                                                       doredraw= 1;
-                                                       break;
-                                               }
-                                       }
 #ifdef NEWTRANSFORM
                                        Transform(TFM_TRANSLATION);
 #else
@@ -1490,13 +1486,6 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                                        loopoperations(LOOP_CUT);
                                        }
                                        else if((G.qual==0)) {
-                                               if(v3d->twflag & V3D_USE_MANIPULATOR) {
-                                                       if((v3d->twtype & V3D_MANIPULATOR_ROTATE)==0) {
-                                                               v3d->twtype= V3D_MANIPULATOR_ROTATE;
-                                                               doredraw= 1;
-                                                               break;
-                                                       }
-                                               }
 #ifdef NEWTRANSFORM
                                                Transform(TFM_ROTATION);
 #else
@@ -1505,13 +1494,6 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                        }
                                }
                                else if((G.qual==0)) {
-                                       if(v3d->twflag & V3D_USE_MANIPULATOR) {
-                                               if((v3d->twtype & V3D_MANIPULATOR_ROTATE)==0) {
-                                                       v3d->twtype= V3D_MANIPULATOR_ROTATE;
-                                                       doredraw= 1;
-                                                       break;
-                                               }
-                                       }
 #ifdef NEWTRANSFORM
                                        Transform(TFM_ROTATION);
 #else
@@ -1538,13 +1520,6 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                        else if(G.qual==LR_SHIFTKEY)
                                                snapmenu();
                                        else if(G.qual==0) {
-                                               if(v3d->twflag & V3D_USE_MANIPULATOR) {
-                                                       if((v3d->twtype & V3D_MANIPULATOR_SCALE)==0) {
-                                                               v3d->twtype= V3D_MANIPULATOR_SCALE;
-                                                               doredraw= 1;
-                                                               break;
-                                                       }
-                                               }
 #ifdef NEWTRANSFORM
                                                Transform(TFM_RESIZE);
 #else
@@ -1567,13 +1542,6 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                        snapmenu();
                                }
                                else if((G.qual==0)) {
-                                       if(v3d->twflag & V3D_USE_MANIPULATOR) {
-                                               if((v3d->twtype & V3D_MANIPULATOR_SCALE)==0) {
-                                                       v3d->twtype= V3D_MANIPULATOR_SCALE;
-                                                       doredraw= 1;
-                                                       break;
-                                               }
-                                       }
 #ifdef NEWTRANSFORM
                                        Transform(TFM_RESIZE);
 #else
@@ -1825,6 +1793,25 @@ 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_MANIPULATOR_TRANSLATE)
+                                               v3d->twtype= V3D_MANIPULATOR_ROTATE;
+                                       else if(v3d->twtype & V3D_MANIPULATOR_ROTATE)
+                                               v3d->twtype= V3D_MANIPULATOR_SCALE;
+                                       else if(v3d->twtype & V3D_MANIPULATOR_SCALE)
+                                               v3d->twtype= V3D_MANIPULATOR_TRANSLATE;
+                                       doredraw= 1;
+                               }
+                               break;
+                       }
+               }
+       }
        
        if(doredraw) {
                scrarea_queue_winredraw(curarea);
index dff4bc38ffee434679f37499c0af47e53591d839..f82bd9a9fc574a1e49e4b6bc3e82b592b61b31fa 100755 (executable)
@@ -1664,6 +1664,26 @@ void ManipulatorTransform(int mode)
                                ret_val = TRANS_CONFIRM;
                                break;
                        }
+                       if(val) {
+                               switch(event) {
+                               case WHEELDOWNMOUSE:
+                               case PADPLUSKEY:
+                                       if(G.f & G_PROPORTIONAL) {
+                                               Trans.propsize*= 1.1f;
+                                               calculatePropRatio(&Trans);
+                                               Trans.redraw= 1;
+                                       }
+                                       break;
+                               case WHEELUPMOUSE:
+                               case PADMINUS:
+                                       if(G.f & G_PROPORTIONAL) {
+                                               Trans.propsize*= 0.90909090f;
+                                               calculatePropRatio(&Trans);
+                                               Trans.redraw= 1;
+                                       }
+                                       break;
+                               }                       
+                       }
                }
        }
        
index b3a127be6250443f029d48ae26bf0f7b6a547fec..b01533aebc6895db33435e12b33b1f6c1d7bce71 100644 (file)
@@ -1384,15 +1384,17 @@ int BIF_do_manipulator(ScrArea *sa)
                
                /* cycling orientation modus */
                getmouseco_areawin(mval);
-               if(mvalo[0]==mval[0] && mvalo[1]==mval[1]) {
-                       if(v3d->twmode==V3D_MANIPULATOR_GLOBAL)
-                               v3d->twmode= V3D_MANIPULATOR_LOCAL;
-                       else if(v3d->twmode==V3D_MANIPULATOR_LOCAL)
-                               if(G.obedit || G.obpose) v3d->twmode= V3D_MANIPULATOR_NORMAL;
-                               else v3d->twmode= V3D_MANIPULATOR_GLOBAL;
-                       else if(v3d->twmode==V3D_MANIPULATOR_NORMAL)
-                               v3d->twmode= V3D_MANIPULATOR_GLOBAL;
-                       
+               if(val==MAN_ROT_V || val==MAN_SCALE_C || val==MAN_TRANS_C) {
+                       if(mvalo[0]==mval[0] && mvalo[1]==mval[1]) {
+                               if(v3d->twmode==V3D_MANIPULATOR_GLOBAL)
+                                       v3d->twmode= V3D_MANIPULATOR_LOCAL;
+                               else if(v3d->twmode==V3D_MANIPULATOR_LOCAL)
+                                       if(G.obedit || G.obpose) v3d->twmode= V3D_MANIPULATOR_NORMAL;
+                                       else v3d->twmode= V3D_MANIPULATOR_GLOBAL;
+                               else if(v3d->twmode==V3D_MANIPULATOR_NORMAL)
+                                       v3d->twmode= V3D_MANIPULATOR_GLOBAL;
+                               
+                       }
                }
                
        }