allow to scale and rotate from edge/vertex slide.
authorCampbell Barton <ideasman42@gmail.com>
Wed, 24 Apr 2013 15:15:01 +0000 (15:15 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 24 Apr 2013 15:15:01 +0000 (15:15 +0000)
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform.h
source/blender/editors/transform/transform_generics.c

index 1b80aa3fb59ae0722f01303f0e9c6abb3c13af93..0e29ba5178044d500c2e727e6d12426af35b38ce 100644 (file)
@@ -908,12 +908,7 @@ int transformEvent(TransInfo *t, const wmEvent *event)
                        case TFM_MODAL_TRANSLATE:
                                /* only switch when... */
                                if (ELEM5(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_EDGE_SLIDE, TFM_VERT_SLIDE)) {
-                                       if (t->mode == TFM_EDGE_SLIDE) {
-                                               freeEdgeSlideVerts(t);
-                                       }
-                                       else if (t->mode == TFM_VERT_SLIDE) {
-                                               freeVertSlideVerts(t);
-                                       }
+                                       resetTransModal(t);
                                        resetTransRestrictions(t);
                                        restoreTransObjects(t);
                                        initTranslation(t);
@@ -928,6 +923,7 @@ int transformEvent(TransInfo *t, const wmEvent *event)
                                else {
                                        if (t->obedit && t->obedit->type == OB_MESH) {
                                                if ((t->mode == TFM_TRANSLATION) && (t->spacetype == SPACE_VIEW3D)) {
+                                                       resetTransModal(t);
                                                        resetTransRestrictions(t);
                                                        restoreTransObjects(t);
 
@@ -963,8 +959,8 @@ int transformEvent(TransInfo *t, const wmEvent *event)
                        case TFM_MODAL_ROTATE:
                                /* only switch when... */
                                if (!(t->options & CTX_TEXTURE) && !(t->options & (CTX_MOVIECLIP | CTX_MASK))) {
-                                       if (ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) {
-                                               
+                                       if (ELEM6(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION, TFM_EDGE_SLIDE, TFM_VERT_SLIDE)) {
+                                               resetTransModal(t);
                                                resetTransRestrictions(t);
                                                
                                                if (t->mode == TFM_ROTATION) {
@@ -982,7 +978,8 @@ int transformEvent(TransInfo *t, const wmEvent *event)
                                break;
                        case TFM_MODAL_RESIZE:
                                /* only switch when... */
-                               if (ELEM3(t->mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL) ) {
+                               if (ELEM5(t->mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL, TFM_EDGE_SLIDE, TFM_VERT_SLIDE)) {
+                                       resetTransModal(t);
                                        resetTransRestrictions(t);
                                        restoreTransObjects(t);
                                        initResize(t);
@@ -1227,6 +1224,7 @@ int transformEvent(TransInfo *t, const wmEvent *event)
                        case GKEY:
                                /* only switch when... */
                                if (ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL) ) {
+                                       resetTransModal(t);
                                        resetTransRestrictions(t);
                                        restoreTransObjects(t);
                                        initTranslation(t);
@@ -1237,6 +1235,7 @@ int transformEvent(TransInfo *t, const wmEvent *event)
                        case SKEY:
                                /* only switch when... */
                                if (ELEM3(t->mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL) ) {
+                                       resetTransModal(t);
                                        resetTransRestrictions(t);
                                        restoreTransObjects(t);
                                        initResize(t);
@@ -1248,7 +1247,7 @@ int transformEvent(TransInfo *t, const wmEvent *event)
                                /* only switch when... */
                                if (!(t->options & CTX_TEXTURE)) {
                                        if (ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) {
-
+                                               resetTransModal(t);
                                                resetTransRestrictions(t);
 
                                                if (t->mode == TFM_ROTATION) {
index 20d5ddd670478cef6cdc0bba82d83a36872e8dbd..ed9657b0586c05ecc79deb19d30227741d2eed7a 100644 (file)
@@ -697,6 +697,7 @@ void setInputPostFct(MouseInput *mi, void   (*post)(struct TransInfo *t, float val
 
 int initTransInfo(struct bContext *C, TransInfo *t, struct wmOperator *op, const struct wmEvent *event);
 void postTrans(struct bContext *C, TransInfo *t);
+void resetTransModal(TransInfo *t);
 void resetTransRestrictions(TransInfo *t);
 
 void drawLine(TransInfo *t, const float center[3], const float dir[3], char axis, short options);
index be82a4e06603ac1acdb79bdbaebac1de311f8a00..a32a6b031b882b56e4e0293813a4933ffc96099c 100644 (file)
@@ -1002,6 +1002,19 @@ void drawLine(TransInfo *t, const float center[3], const float dir[3], char axis
        }
 }
 
+/**
+ * Free data before switching to another mode.
+ */
+void resetTransModal(TransInfo *t)
+{
+       if (t->mode == TFM_EDGE_SLIDE) {
+               freeEdgeSlideVerts(t);
+       }
+       else if (t->mode == TFM_VERT_SLIDE) {
+               freeVertSlideVerts(t);
+       }
+}
+
 void resetTransRestrictions(TransInfo *t)
 {
        t->flag &= ~T_ALL_RESTRICTIONS;