[Bf-blender-cvs] [526fbdec3b6] master: Transform: Move some hardcoded keyitems to keymap_data in python
Germano Cavalcante
noreply at git.blender.org
Tue Sep 1 14:39:31 CEST 2020
Commit: 526fbdec3b6a0fb574e4d0ebe43eead9c1078e39
Author: Germano Cavalcante
Date: Tue Sep 1 09:37:43 2020 -0300
Branches: master
https://developer.blender.org/rB526fbdec3b6a0fb574e4d0ebe43eead9c1078e39
Transform: Move some hardcoded keyitems to keymap_data in python
Keymaps must be customized by the user.
But this is not the case for hardcoded keymaps.
Also the repetition of hardcoded and user-defined keyitems may induce
the user to think they have made a mistake or it is a bug.
Differential Revision: https://developer.blender.org/D6454
===================================================================
M release/scripts/presets/keyconfig/keymap_data/blender_default.py
M release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
M source/blender/editors/transform/transform.c
M source/blender/editors/transform/transform.h
M source/tools
===================================================================
diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
index 132a711e845..fe3a4f2631b 100644
--- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py
+++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py
@@ -4952,6 +4952,7 @@ def km_transform_modal_map(_params):
("CONFIRM", {"type": 'LEFTMOUSE', "value": 'PRESS', "any": True}, None),
("CONFIRM", {"type": 'RET', "value": 'PRESS', "any": True}, None),
("CONFIRM", {"type": 'NUMPAD_ENTER', "value": 'PRESS', "any": True}, None),
+ ("CONFIRM", {"type": 'SPACE', "value": 'PRESS', "any": True}, None),
("CANCEL", {"type": 'RIGHTMOUSE', "value": 'PRESS', "any": True}, None),
("CANCEL", {"type": 'ESC', "value": 'PRESS', "any": True}, None),
("AXIS_X", {"type": 'X', "value": 'PRESS', "repeat": False}, None),
@@ -4982,11 +4983,18 @@ def km_transform_modal_map(_params):
("PROPORTIONAL_SIZE", {"type": 'TRACKPADPAN', "value": 'ANY'}, None),
("EDGESLIDE_EDGE_NEXT", {"type": 'WHEELDOWNMOUSE', "value": 'PRESS', "alt": True}, None),
("EDGESLIDE_PREV_NEXT", {"type": 'WHEELUPMOUSE', "value": 'PRESS', "alt": True}, None),
+ ("AUTOIK_CHAIN_LEN_UP", {"type": 'PAGE_UP', "value": 'PRESS'}, None),
+ ("AUTOIK_CHAIN_LEN_DOWN", {"type": 'PAGE_DOWN', "value": 'PRESS'}, None),
("AUTOIK_CHAIN_LEN_UP", {"type": 'PAGE_UP', "value": 'PRESS', "shift": True}, None),
("AUTOIK_CHAIN_LEN_DOWN", {"type": 'PAGE_DOWN', "value": 'PRESS', "shift": True}, None),
+ ("AUTOIK_CHAIN_LEN_UP", {"type": 'WHEELDOWNMOUSE', "value": 'PRESS'}, None),
+ ("AUTOIK_CHAIN_LEN_DOWN", {"type": 'WHEELUPMOUSE', "value": 'PRESS'}, None),
("AUTOIK_CHAIN_LEN_UP", {"type": 'WHEELDOWNMOUSE', "value": 'PRESS', "shift": True}, None),
("AUTOIK_CHAIN_LEN_DOWN", {"type": 'WHEELUPMOUSE', "value": 'PRESS', "shift": True}, None),
("INSERTOFS_TOGGLE_DIR", {"type": 'T', "value": 'PRESS', "repeat": False}, None),
+ ("AUTOCONSTRAIN", {"type": 'MIDDLEMOUSE', "value": 'PRESS', "repeat": False}, None),
+ ("CONSTRAINPLANE", {"type": 'LEFT_SHIFT', "value": 'PRESS', "repeat": False}, None),
+ ("CONSTRAINPLANE", {"type": 'RIGHT_SHIFT', "value": 'PRESS', "repeat": False}, None),
])
return keymap
diff --git a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
index c72a7521557..c126b1727fa 100644
--- a/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
+++ b/release/scripts/presets/keyconfig/keymap_data/industry_compatible_data.py
@@ -3894,6 +3894,7 @@ def km_transform_modal_map(_params):
("CONFIRM", {"type": 'LEFTMOUSE', "value": 'PRESS', "any": True}, None),
("CONFIRM", {"type": 'RET', "value": 'PRESS', "any": True}, None),
("CONFIRM", {"type": 'NUMPAD_ENTER', "value": 'PRESS', "any": True}, None),
+ ("CONFIRM", {"type": 'SPACE', "value": 'PRESS', "any": True}, None),
("CANCEL", {"type": 'RIGHTMOUSE', "value": 'PRESS', "any": True}, None),
("CANCEL", {"type": 'ESC', "value": 'PRESS', "any": True}, None),
("AXIS_X", {"type": 'X', "value": 'PRESS'}, None),
@@ -3924,11 +3925,18 @@ def km_transform_modal_map(_params):
("PROPORTIONAL_SIZE", {"type": 'TRACKPADPAN', "value": 'ANY'}, None),
("EDGESLIDE_EDGE_NEXT", {"type": 'WHEELDOWNMOUSE', "value": 'PRESS', "alt": True}, None),
("EDGESLIDE_PREV_NEXT", {"type": 'WHEELUPMOUSE', "value": 'PRESS', "alt": True}, None),
+ ("AUTOIK_CHAIN_LEN_UP", {"type": 'PAGE_UP', "value": 'PRESS'}, None),
+ ("AUTOIK_CHAIN_LEN_DOWN", {"type": 'PAGE_DOWN', "value": 'PRESS'}, None),
("AUTOIK_CHAIN_LEN_UP", {"type": 'PAGE_UP', "value": 'PRESS', "shift": True}, None),
("AUTOIK_CHAIN_LEN_DOWN", {"type": 'PAGE_DOWN', "value": 'PRESS', "shift": True}, None),
+ ("AUTOIK_CHAIN_LEN_UP", {"type": 'WHEELDOWNMOUSE', "value": 'PRESS'}, None),
+ ("AUTOIK_CHAIN_LEN_DOWN", {"type": 'WHEELUPMOUSE', "value": 'PRESS'}, None),
("AUTOIK_CHAIN_LEN_UP", {"type": 'WHEELDOWNMOUSE', "value": 'PRESS', "shift": True}, None),
("AUTOIK_CHAIN_LEN_DOWN", {"type": 'WHEELUPMOUSE', "value": 'PRESS', "shift": True}, None),
("INSERTOFS_TOGGLE_DIR", {"type": 'T', "value": 'PRESS'}, None),
+ ("AUTOCONSTRAIN", {"type": 'MIDDLEMOUSE', "value": 'PRESS'}, None),
+ ("CONSTRAINPLANE", {"type": 'LEFT_SHIFT', "value": 'PRESS', "repeat": False}, None),
+ ("CONSTRAINPLANE", {"type": 'RIGHT_SHIFT', "value": 'PRESS', "repeat": False}, None),
])
return keymap
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 2fa291e7ae4..421a8e2d43e 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -560,94 +560,6 @@ static void viewRedrawPost(bContext *C, TransInfo *t)
#endif
}
-/* ************************** TRANSFORMATIONS **************************** */
-
-static void view_editmove(ushort UNUSED(event))
-{
-#if 0 // TRANSFORM_FIX_ME
- int refresh = 0;
- /* Regular: Zoom in */
- /* Shift: Scroll up */
- /* Ctrl: Scroll right */
- /* Alt-Shift: Rotate up */
- /* Alt-Ctrl: Rotate right */
-
- /* only work in 3D window for now
- * In the end, will have to send to event to a 2D window handler instead
- */
- if (Trans.flag & T_2D_EDIT) {
- return;
- }
-
- switch (event) {
- case WHEELUPMOUSE:
- if (G.qual & LR_SHIFTKEY) {
- if (G.qual & LR_ALTKEY) {
- G.qual &= ~LR_SHIFTKEY;
- persptoetsen(PAD2);
- G.qual |= LR_SHIFTKEY;
- }
- else {
- persptoetsen(PAD2);
- }
- }
- else if (G.qual & LR_CTRLKEY) {
- if (G.qual & LR_ALTKEY) {
- G.qual &= ~LR_CTRLKEY;
- persptoetsen(PAD4);
- G.qual |= LR_CTRLKEY;
- }
- else {
- persptoetsen(PAD4);
- }
- }
- else if (U.uiflag & USER_WHEELZOOMDIR) {
- persptoetsen(PADMINUS);
- }
- else {
- persptoetsen(PADPLUSKEY);
- }
-
- refresh = 1;
- break;
- case WHEELDOWNMOUSE:
- if (G.qual & LR_SHIFTKEY) {
- if (G.qual & LR_ALTKEY) {
- G.qual &= ~LR_SHIFTKEY;
- persptoetsen(PAD8);
- G.qual |= LR_SHIFTKEY;
- }
- else {
- persptoetsen(PAD8);
- }
- }
- else if (G.qual & LR_CTRLKEY) {
- if (G.qual & LR_ALTKEY) {
- G.qual &= ~LR_CTRLKEY;
- persptoetsen(PAD6);
- G.qual |= LR_CTRLKEY;
- }
- else {
- persptoetsen(PAD6);
- }
- }
- else if (U.uiflag & USER_WHEELZOOMDIR) {
- persptoetsen(PADPLUSKEY);
- }
- else {
- persptoetsen(PADMINUS);
- }
-
- refresh = 1;
- break;
- }
-
- if (refresh) {
- setTransformViewMatrices(&Trans);
- }
-#endif
-}
-
/* ************************************************* */
static bool transform_modal_item_poll(const wmOperator *op, int value)
@@ -770,6 +682,17 @@ wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf)
{TFM_MODAL_TRANSLATE, "TRANSLATE", 0, "Move", ""},
{TFM_MODAL_ROTATE, "ROTATE", 0, "Rotate", ""},
{TFM_MODAL_RESIZE, "RESIZE", 0, "Resize", ""},
+
+ {TFM_MODAL_AUTOCONSTRAINT,
+ "AUTOCONSTRAIN",
+ 0,
+ "Automatically detects one direction for constraint",
+ ""},
+ {TFM_MODAL_CONSTRAINTPLANE,
+ "CONSTRAINPLANE",
+ 0,
+ "modifier that enables the plane type constraint",
+ ""},
{0, NULL, 0, NULL, NULL},
};
@@ -778,6 +701,25 @@ wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf)
keymap = WM_modalkeymap_ensure(keyconf, "Transform Modal Map", modal_items);
keymap->poll_modal_item = transform_modal_item_poll;
+ /* Default modal map values:
+ *
+ * \code{.c}
+ * WM_modalkeymap_add_item(keymap, EVT_RETKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_CONFIRM);
+ * WM_modalkeymap_add_item(keymap, EVT_ESCKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_CANCEL);
+ * WM_modalkeymap_add_item(keymap, EVT_PAGEUPKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_AUTOIK_LEN_INC);
+ * WM_modalkeymap_add_item(
+ * keymap, EVT_PAGEDOWNKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_AUTOIK_LEN_DEC);
+ * WM_modalkeymap_add_item(keymap, EVT_GKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_TRANSLATE);
+ * WM_modalkeymap_add_item(keymap, EVT_RKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_ROTATE);
+ * WM_modalkeymap_add_item(keymap, EVT_SKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_RESIZE);
+ * WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_PRESS, KM_ANY, 0, TFM_MODAL_AUTOCONSTRAINT);
+ * WM_modalkeymap_add_item(
+ * keymap, EVT_LEFTSHIFTKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_CONSTRAINTPLANE);
+ * WM_modalkeymap_add_item(
+ * keymap, EVT_RIGHTSHIFTKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_CONSTRAINTPLANE);
+ * \endcode
+ */
+
return keymap;
}
@@ -887,6 +829,7 @@ int transformEvent(TransInfo *t, const wmEvent *event)
handled = true;
}
/* handle modal keymap first */
+ /* enforce redraw of transform when modifiers are used */
else if (event->type == EVT_MODAL_MAP) {
switch (event->val) {
case TFM_MODAL_CANCEL:
@@ -1147,40 +1090,7 @@ int transformEvent(TransInfo *t, const wmEvent *event)
t->redraw |= TREDRAW_SOFT;
}
break;
- /* Those two are only handled in transform's own handler, see T44634! */
- case TFM_MODAL_EDGESLIDE_UP:
- case TFM_MODAL_EDGESLIDE_DOWN:
- default:
- break;
- }
- }
- /* else do non-mapped events */
- else if (event->val == KM_PRESS) {
- switch (event->type) {
- case EVT_ESCKEY:
- case RIGHTMOUSE:
- t->state = TRANS_CANCEL;
- handled = true;
- break;
-
- case EVT_SPACEKEY:
- case EVT_PADENTER:
- case EVT_RETKEY:
- if (event->is_repeat) {
- break;
- }
- t->state = TRANS_CONFIRM;
- handled = true;
-
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list