Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform.c
| Context not available. | |||||
| TFM_MODAL_PROPSIZE = 26, | TFM_MODAL_PROPSIZE = 26, | ||||
| /* node editor insert offset (aka auto-offset) direction toggle */ | /* node editor insert offset (aka auto-offset) direction toggle */ | ||||
| TFM_MODAL_INSERTOFS_TOGGLE_DIR = 27, | TFM_MODAL_INSERTOFS_TOGGLE_DIR = 27, | ||||
| TFM_MODAL_NO_MODAL_TRANSFORM = 33, | |||||
| }; | }; | ||||
| /* called in transform_ops.c, on each regeneration of keymaps */ | /* called in transform_ops.c, on each regeneration of keymaps */ | ||||
| Context not available. | |||||
| {TFM_MODAL_EDGESLIDE_DOWN, "EDGESLIDE_PREV_NEXT", 0, "Select previous Edge Slide Edge", ""}, | {TFM_MODAL_EDGESLIDE_DOWN, "EDGESLIDE_PREV_NEXT", 0, "Select previous Edge Slide Edge", ""}, | ||||
| {TFM_MODAL_PROPSIZE, "PROPORTIONAL_SIZE", 0, "Adjust Proportional Influence", ""}, | {TFM_MODAL_PROPSIZE, "PROPORTIONAL_SIZE", 0, "Adjust Proportional Influence", ""}, | ||||
| {TFM_MODAL_INSERTOFS_TOGGLE_DIR, "INSERTOFS_TOGGLE_DIR", 0, "Toggle Direction for Node Auto-offset", ""}, | {TFM_MODAL_INSERTOFS_TOGGLE_DIR, "INSERTOFS_TOGGLE_DIR", 0, "Toggle Direction for Node Auto-offset", ""}, | ||||
| {TFM_MODAL_NO_MODAL_TRANSFORM, "NO_MODAL_TRANSFORM", 0, "allow movements around the scene", ""}, | |||||
| {0, NULL, 0, NULL, NULL} | {0, NULL, 0, NULL, NULL} | ||||
| }; | }; | ||||
| Context not available. | |||||
| /* node editor only */ | /* node editor only */ | ||||
| WM_modalkeymap_add_item(keymap, TKEY, KM_PRESS, 0, 0, TFM_MODAL_INSERTOFS_TOGGLE_DIR); | WM_modalkeymap_add_item(keymap, TKEY, KM_PRESS, 0, 0, TFM_MODAL_INSERTOFS_TOGGLE_DIR); | ||||
| WM_modalkeymap_add_item(keymap, NKEY, KM_PRESS, 0, 0, TFM_MODAL_NO_MODAL_TRANSFORM); | |||||
| return keymap; | return keymap; | ||||
| } | } | ||||
| Context not available. | |||||
| char cmode = constraintModeToChar(t); | char cmode = constraintModeToChar(t); | ||||
| bool handled = false; | bool handled = false; | ||||
| const int modifiers_prev = t->modifiers; | const int modifiers_prev = t->modifiers; | ||||
| if (t->flag & T_TRANSFORM_NO_MODAL) { | |||||
| if (!handled && ELEM(event->val, KM_PRESS, KM_RELEASE) && ELEM(event->type,LEFTMOUSE, RIGHTMOUSE, MIDDLEMOUSE)) { | |||||
| return OPERATOR_PASS_THROUGH; | |||||
| } | |||||
| } | |||||
| t->redraw |= handleMouseInput(t, &t->mouse, event); | t->redraw |= handleMouseInput(t, &t->mouse, event); | ||||
| Context not available. | |||||
| t->state = TRANS_CONFIRM; | t->state = TRANS_CONFIRM; | ||||
| handled = true; | handled = true; | ||||
| break; | break; | ||||
| case TFM_MODAL_NO_MODAL_TRANSFORM: | |||||
| t->flag ^= T_TRANSFORM_NO_MODAL; | |||||
| handled = true; | |||||
| { | |||||
| wmKeyMapItem *kmi; | |||||
| for (kmi = t->keymap->items.first; kmi; kmi = kmi->next) { | |||||
| if (ELEM(kmi->type,LEFTMOUSE,RIGHTMOUSE,MIDDLEMOUSE)) { | |||||
| if (t->flag & T_TRANSFORM_NO_MODAL) { | |||||
| kmi->flag |= KMI_INACTIVE; | |||||
| } else { | |||||
| kmi->flag &= ~KMI_INACTIVE; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| case TFM_MODAL_TRANSLATE: | case TFM_MODAL_TRANSLATE: | ||||
| /* only switch when... */ | /* only switch when... */ | ||||
| if (ELEM(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_EDGE_SLIDE, TFM_VERT_SLIDE)) { | if (ELEM(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_EDGE_SLIDE, TFM_VERT_SLIDE)) { | ||||
| Context not available. | |||||
| int transformEnd(bContext *C, TransInfo *t) | int transformEnd(bContext *C, TransInfo *t) | ||||
| { | { | ||||
| int exit_code = OPERATOR_RUNNING_MODAL; | int exit_code = (t->flag & T_TRANSFORM_NO_MODAL) ? 0 : OPERATOR_RUNNING_MODAL; | ||||
| t->context = C; | t->context = C; | ||||
| if (t->state != TRANS_STARTING && t->state != TRANS_RUNNING) { | if (t->state != TRANS_STARTING && t->state != TRANS_RUNNING) { | ||||
| Context not available. | |||||