Bugfix #24296: AutoIK interactive chain length adjustment feature is missing
authorJoshua Leung <aligorith@gmail.com>
Sun, 17 Oct 2010 11:20:12 +0000 (11:20 +0000)
committerJoshua Leung <aligorith@gmail.com>
Sun, 17 Oct 2010 11:20:12 +0000 (11:20 +0000)
In 2.49, you could adjust the maximum length of Auto-IK Chains by using scrollwheel up/down or page up/down while moving Auto-IK bones. Now this is possible again with those hotkeys, but you need to hold SHIFT to get this to work, otherwise we get a conflict with the hotkeys for proportional edit nowadays.

Was broken when transform tools switched from using hardcoded key mappings to using a modal keymap.

intern/iksolver/intern/IK_Solver.cpp
source/blender/editors/transform/transform.c

index 1add6f638cf34a6cb180f3d9cffa9eb559b65afd..beb82f08ed4ba84c9ab6e643c6eda01764c9bef3 100644 (file)
@@ -45,6 +45,7 @@ public:
        std::list<IK_QTask*> tasks;
 };
 
+// FIXME: locks still result in small "residual" changes to the locked axes...
 IK_QSegment *CreateSegment(int flag, bool translate)
 {
        int ndof = 0;
index 4a95d0ec081f144fc2408eb3adb2e11d81929b9a..ae0bce176c17864b42ca6622c6d0cabd56c6e82b 100644 (file)
@@ -481,6 +481,8 @@ static void view_editmove(unsigned short UNUSED(event))
  * */
 #define TFM_MODAL_PROPSIZE_UP  20
 #define TFM_MODAL_PROPSIZE_DOWN        21
+#define TFM_MODAL_AUTOIK_LEN_INC 22
+#define TFM_MODAL_AUTOIK_LEN_DEC 23
 
 /* called in transform_ops.c, on each regeneration of keymaps */
 wmKeyMap* transform_modal_keymap(wmKeyConfig *keyconf)
@@ -507,6 +509,8 @@ wmKeyMap* transform_modal_keymap(wmKeyConfig *keyconf)
        {NUM_MODAL_INCREMENT_DOWN, "INCREMENT_DOWN", 0, "Numinput Increment Down", ""},
        {TFM_MODAL_PROPSIZE_UP, "PROPORTIONAL_SIZE_UP", 0, "Increase Proportional Influence", ""},
        {TFM_MODAL_PROPSIZE_DOWN, "PROPORTIONAL_SIZE_DOWN", 0, "Decrease Poportional Influence", ""},
+       {TFM_MODAL_AUTOIK_LEN_INC, "AUTOIK_CHAIN_LEN_UP", 0, "Increase Max AutoIK Chain Length", ""},
+       {TFM_MODAL_AUTOIK_LEN_DEC, "AUTOIK_CHAIN_LEN_DOWN", 0, "Decrease Max AutoIK Chain Length", ""},
        {0, NULL, 0, NULL, NULL}};
        
        wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Transform Modal Map");
@@ -541,7 +545,12 @@ wmKeyMap* transform_modal_keymap(wmKeyConfig *keyconf)
        WM_modalkeymap_add_item(keymap, PAGEDOWNKEY, KM_PRESS, 0, 0, TFM_MODAL_PROPSIZE_DOWN);
        WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, 0, 0, TFM_MODAL_PROPSIZE_UP);
        WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, 0, 0, TFM_MODAL_PROPSIZE_DOWN);
-
+       
+       WM_modalkeymap_add_item(keymap, PAGEUPKEY, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_INC);
+       WM_modalkeymap_add_item(keymap, PAGEDOWNKEY, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_DEC);
+       WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_INC);
+       WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_DEC);
+       
        return keymap;
 }
 
@@ -735,6 +744,16 @@ int transformEvent(TransInfo *t, wmEvent *event)
                                }
                                t->redraw |= TREDRAW_HARD;
                                break;
+                       case TFM_MODAL_AUTOIK_LEN_INC:
+                               if (t->flag & T_AUTOIK)
+                                       transform_autoik_update(t, 1);
+                               t->redraw |= TREDRAW_HARD;
+                               break;
+                       case TFM_MODAL_AUTOIK_LEN_DEC:
+                               if (t->flag & T_AUTOIK) 
+                                       transform_autoik_update(t, -1);
+                               t->redraw |= TREDRAW_HARD;
+                               break;
                        default:
                                handled = 0;
                                break;