Remove unneeded manipulator functions.
authorMartin Poirier <theeth@yahoo.com>
Sun, 19 Jul 2009 17:42:01 +0000 (17:42 +0000)
committerMartin Poirier <theeth@yahoo.com>
Sun, 19 Jul 2009 17:42:01 +0000 (17:42 +0000)
Disable manipulator drawing while moving. This still use G.moving, but that's acceptable for now (it's sort of a weird display option, after talk with Ton, we couldn't find a good place to set it).

source/blender/editors/include/ED_transform.h
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_ops.c

index de1294c9b2bb1eed9d80388d21f1a8ad1739d101..984def760ae2451545b837aa9c7cd1126cb8b1d5 100644 (file)
@@ -132,8 +132,6 @@ void Properties_Snapping(struct wmOperatorType *ot, short align);
 void Properties_Constraints(struct wmOperatorType *ot);
 
 /* view3d manipulators */
-void initManipulator(int mode);
-void ManipulatorTransform();
 
 int BIF_do_manipulator(struct bContext *C, struct wmEvent *event, struct wmOperator *op);
 void BIF_draw_manipulator(const struct bContext *C);
index d8b62b40dffbbd475ec89f506e86f5ebe7e719ce..0d29f39e478e13fb0621aae1923d7b85e9cfd817 100644 (file)
@@ -1452,202 +1452,6 @@ int transformEnd(bContext *C, TransInfo *t)
        return exit_code;
 }
 
-/* ************************** Manipulator init and main **************************** */
-
-void initManipulator(int mode)
-{
-       printf("init manipulator mode %d\n", mode);
-
-#if 0 // TRANSFORM_FIX_ME
-       Trans.state = TRANS_RUNNING;
-
-       Trans.options = CTX_NONE;
-
-       Trans.mode = mode;
-
-       /* automatic switch to scaling bone envelopes */
-       if(mode==TFM_RESIZE && t->obedit && t->obedit->type==OB_ARMATURE) {
-               bArmature *arm= t->obedit->data;
-               if(arm->drawtype==ARM_ENVELOPE)
-                       mode= TFM_BONE_ENVELOPE;
-       }
-
-       initTrans(&Trans);                                      // internal data, mouse, vectors
-
-       G.moving |= G_TRANSFORM_MANIP;          // signal to draw manipuls while transform
-       createTransData(&Trans);                        // make TransData structs from selection
-
-       if (Trans.total == 0)
-               return;
-
-       initSnapping(&Trans); // Initialize snapping data AFTER mode flags
-
-       /* EVIL! posemode code can switch translation to rotate when 1 bone is selected. will be removed (ton) */
-       /* EVIL2: we gave as argument also texture space context bit... was cleared */
-       mode = Trans.mode;
-
-       calculatePropRatio(&Trans);
-       calculateCenter(&Trans);
-
-       switch (mode) {
-       case TFM_TRANSLATION:
-               initTranslation(&Trans);
-               break;
-       case TFM_ROTATION:
-               initRotation(&Trans);
-               break;
-       case TFM_RESIZE:
-               initResize(&Trans);
-               break;
-       case TFM_TRACKBALL:
-               initTrackball(&Trans);
-               break;
-       }
-
-       Trans.flag |= T_USES_MANIPULATOR;
-#endif
-}
-
-void ManipulatorTransform()
-{
-#if 0 // TRANSFORM_FIX_ME
-       int mouse_moved = 0;
-       short pmval[2] = {0, 0}, mval[2], val;
-       unsigned short event;
-
-       if (Trans.total == 0)
-               return;
-
-       Trans.redraw = 1; /* initial draw */
-
-       while (Trans.state == TRANS_RUNNING) {
-
-               getmouseco_areawin(mval);
-
-               if (mval[0] != pmval[0] || mval[1] != pmval[1]) {
-                       Trans.redraw = 1;
-               }
-               if (Trans.redraw) {
-                       pmval[0] = mval[0];
-                       pmval[1] = mval[1];
-
-                       //selectConstraint(&Trans);  needed?
-                       if (Trans.transform) {
-                               Trans.transform(&Trans, mval);
-                       }
-                       Trans.redraw = 0;
-               }
-
-               /* essential for idling subloop */
-               if( qtest()==0) PIL_sleep_ms(2);
-
-               while( qtest() ) {
-                       event= extern_qread(&val);
-
-                       switch (event){
-                       case MOUSEX:
-                       case MOUSEY:
-                               mouse_moved = 1;
-                               break;
-                       /* enforce redraw of transform when modifiers are used */
-                       case LEFTCTRLKEY:
-                       case RIGHTCTRLKEY:
-                               if(val) Trans.redraw = 1;
-                               break;
-                       case LEFTSHIFTKEY:
-                       case RIGHTSHIFTKEY:
-                               /* shift is modifier for higher resolution transform, works nice to store this mouse position */
-                               if(val) {
-                                       getmouseco_areawin(Trans.shiftmval);
-                                       Trans.flag |= T_SHIFT_MOD;
-                                       Trans.redraw = 1;
-                               }
-                               else Trans.flag &= ~T_SHIFT_MOD;
-                               break;
-
-                       case ESCKEY:
-                       case RIGHTMOUSE:
-                               Trans.state = TRANS_CANCEL;
-                               break;
-                       case LEFTMOUSE:
-                               if(mouse_moved==0 && val==0) break;
-                               // else we pass on event to next, which cancels
-                       case SPACEKEY:
-                       case PADENTER:
-                       case RETKEY:
-                               Trans.state = TRANS_CONFIRM;
-                               break;
-   //         case NDOFMOTION:
-     //           viewmoveNDOF(1);
-     //           break;
-                       }
-                       if(val) {
-                               switch(event) {
-                               case PADPLUSKEY:
-                                       if(G.qual & LR_ALTKEY && Trans.flag & T_PROP_EDIT) {
-                                               Trans.propsize*= 1.1f;
-                                               calculatePropRatio(&Trans);
-                                       }
-                                       Trans.redraw= 1;
-                                       break;
-                               case PAGEUPKEY:
-                               case WHEELDOWNMOUSE:
-                                       if (Trans.flag & T_AUTOIK) {
-                                               transform_autoik_update(&Trans, 1);
-                                       }
-                                       else if(Trans.flag & T_PROP_EDIT) {
-                                               Trans.propsize*= 1.1f;
-                                               calculatePropRatio(&Trans);
-                                       }
-                                       else view_editmove(event);
-                                       Trans.redraw= 1;
-                                       break;
-                               case PADMINUS:
-                                       if(G.qual & LR_ALTKEY && Trans.flag & T_PROP_EDIT) {
-                                               Trans.propsize*= 0.90909090f;
-                                               calculatePropRatio(&Trans);
-                                       }
-                                       Trans.redraw= 1;
-                                       break;
-                               case PAGEDOWNKEY:
-                               case WHEELUPMOUSE:
-                                       if (Trans.flag & T_AUTOIK) {
-                                               transform_autoik_update(&Trans, -1);
-                                       }
-                                       else if (Trans.flag & T_PROP_EDIT) {
-                                               Trans.propsize*= 0.90909090f;
-                                               calculatePropRatio(&Trans);
-                                       }
-                                       else view_editmove(event);
-                                       Trans.redraw= 1;
-                                       break;
-                               }
-
-                               // Numerical input events
-                               Trans.redraw |= handleNumInput(&(Trans.num), event);
-                       }
-               }
-       }
-
-       if(Trans.state == TRANS_CANCEL) {
-               restoreTransObjects(&Trans);
-       }
-
-       /* free data, reset vars */
-       postTrans(&Trans);
-
-       /* aftertrans does insert ipos and action channels, and clears base flags */
-       special_aftertrans_update(&Trans);
-
-       /* send events out for redraws */
-       viewRedrawPost(&Trans);
-
-       if(Trans.state != TRANS_CANCEL) {
-               BIF_undo_push(transform_to_undostr(&Trans));
-       }
-#endif
-}
-
 /* ************************** TRANSFORM LOCKS **************************** */
 
 static void protectedTransBits(short protectflag, float *vec)
index 6ca4c6203034b597a970d744ef30df29d5426a70..7d6112b03deab36fa737237e4071d5cc1dcb3733 100644 (file)
@@ -36,6 +36,7 @@
 
 #include "BKE_utildefines.h"
 #include "BKE_context.h"
+#include "BKE_global.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
@@ -163,6 +164,7 @@ static void transformops_exit(bContext *C, wmOperator *op)
        saveTransform(C, op->customdata, op);
        MEM_freeN(op->customdata);
        op->customdata = NULL;
+       G.moving = 0;
 }
 
 static int transformops_data(bContext *C, wmOperator *op, wmEvent *event)
@@ -188,6 +190,7 @@ static int transformops_data(bContext *C, wmOperator *op, wmEvent *event)
                }
 
                retval = initTransform(C, t, op, event, mode);
+               G.moving = 1;
 
                /* store data */
                op->customdata = t;