Fix #31584: Fractional step in value input for Skin Modifier (Event/input problem)
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 12 Jul 2012 14:41:52 +0000 (14:41 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 12 Jul 2012 14:41:52 +0000 (14:41 +0000)
Issue was caused by the code which checked whether snapping should be enabled
on transform init taking into account keymap and special keys state. It was
used for Ctrl-Click on manipulator only.

Check for Ctrl state gave wring result with skin modifier. It was solved
by additional check for which mode transformation is initializing for --
currently manipulator is available for translation/roation/resize only
which doesn't give any keymap issues.

source/blender/editors/transform/transform.c

index 1e9ecdd0e52c28052902342c555936dff8832d0f..b355e1ee436ce43ad3ebf06f8ea9099a8cc8ad40 100644 (file)
@@ -1676,19 +1676,25 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
 
        /* Stupid code to have Ctrl-Click on manipulator work ok */
        if (event) {
-               wmKeyMap *keymap = WM_keymap_active(CTX_wm_manager(C), op->type->modalkeymap);
-               wmKeyMapItem *kmi;
-
-               for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
-                       if (kmi->propvalue == TFM_MODAL_SNAP_INV_ON && kmi->val == KM_PRESS) {
-                               if ((ELEM(kmi->type, LEFTCTRLKEY, RIGHTCTRLKEY) &&   event->ctrl)  ||
-                                   (ELEM(kmi->type, LEFTSHIFTKEY, RIGHTSHIFTKEY) && event->shift) ||
-                                   (ELEM(kmi->type, LEFTALTKEY, RIGHTALTKEY) &&     event->alt)   ||
-                                   ((kmi->type == OSKEY) &&                         event->oskey) )
-                               {
-                                       t->modifiers |= MOD_SNAP_INVERT;
+               /* do this only for translation/rotation/resize due to only this
+                * moded are available from manipulator and doing such check could
+                * lead to keymap conflicts for other modes (see #31584)
+                */
+               if (ELEM3(mode, TFM_TRANSLATION, TFM_ROTATION, TFM_RESIZE)) {
+                       wmKeyMap *keymap = WM_keymap_active(CTX_wm_manager(C), op->type->modalkeymap);
+                       wmKeyMapItem *kmi;
+
+                       for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
+                               if (kmi->propvalue == TFM_MODAL_SNAP_INV_ON && kmi->val == KM_PRESS) {
+                                       if ((ELEM(kmi->type, LEFTCTRLKEY, RIGHTCTRLKEY) &&   event->ctrl)  ||
+                                           (ELEM(kmi->type, LEFTSHIFTKEY, RIGHTSHIFTKEY) && event->shift) ||
+                                           (ELEM(kmi->type, LEFTALTKEY, RIGHTALTKEY) &&     event->alt)   ||
+                                           ((kmi->type == OSKEY) &&                         event->oskey) )
+                                       {
+                                               t->modifiers |= MOD_SNAP_INVERT;
+                                       }
+                                       break;
                                }
-                               break;
                        }
                }