Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform.c
| Show First 20 Lines • Show All 630 Lines • ▼ Show 20 Lines | switch (value) { | ||||
| } | } | ||||
| case TFM_MODAL_AUTOIK_LEN_INC: | case TFM_MODAL_AUTOIK_LEN_INC: | ||||
| case TFM_MODAL_AUTOIK_LEN_DEC: { | case TFM_MODAL_AUTOIK_LEN_DEC: { | ||||
| if ((t->flag & T_AUTOIK) == 0) { | if ((t->flag & T_AUTOIK) == 0) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| break; | break; | ||||
| } | } | ||||
| case TFM_MODAL_EDIT_SNAPWITH: { | |||||
| if (t->spacetype != SPACE_VIEW3D) { | |||||
| return false; | |||||
| } | |||||
| if (!(t->tsnap.mode & ~(SCE_SNAP_MODE_GRID | SCE_SNAP_MODE_INCREMENT))) { | |||||
| return false; | |||||
| } | |||||
| break; | |||||
| } | |||||
| } | } | ||||
| return true; | return true; | ||||
| } | } | ||||
| /* called in transform_ops.c, on each regeneration of keymaps */ | /* called in transform_ops.c, on each regeneration of keymaps */ | ||||
| wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf) | wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf) | ||||
| { | { | ||||
| static const EnumPropertyItem modal_items[] = { | static const EnumPropertyItem modal_items[] = { | ||||
| Show All 33 Lines | static const EnumPropertyItem modal_items[] = { | ||||
| 0, | 0, | ||||
| "Toggle Direction for Node Auto-Offset", | "Toggle Direction for Node Auto-Offset", | ||||
| ""}, | ""}, | ||||
| {TFM_MODAL_TRANSLATE, "TRANSLATE", 0, "Move", ""}, | {TFM_MODAL_TRANSLATE, "TRANSLATE", 0, "Move", ""}, | ||||
| {TFM_MODAL_ROTATE, "ROTATE", 0, "Rotate", ""}, | {TFM_MODAL_ROTATE, "ROTATE", 0, "Rotate", ""}, | ||||
| {TFM_MODAL_RESIZE, "RESIZE", 0, "Resize", ""}, | {TFM_MODAL_RESIZE, "RESIZE", 0, "Resize", ""}, | ||||
| {TFM_MODAL_AUTOCONSTRAINT, "AUTOCONSTRAIN", 0, "Automatic Constraint", ""}, | {TFM_MODAL_AUTOCONSTRAINT, "AUTOCONSTRAIN", 0, "Automatic Constraint", ""}, | ||||
| {TFM_MODAL_AUTOCONSTRAINTPLANE, "AUTOCONSTRAINPLANE", 0, "Automatic Constraint", ""}, | {TFM_MODAL_AUTOCONSTRAINTPLANE, "AUTOCONSTRAINPLANE", 0, "Automatic Constraint", ""}, | ||||
| {TFM_MODAL_EDIT_SNAPWITH, "EDIT_SNAPWITH", 0, "Edit snap with", ""}, | |||||
| {0, NULL, 0, NULL, NULL}, | {0, NULL, 0, NULL, NULL}, | ||||
| }; | }; | ||||
| wmKeyMap *keymap = WM_modalkeymap_find(keyconf, "Transform Modal Map"); | wmKeyMap *keymap = WM_modalkeymap_find(keyconf, "Transform Modal Map"); | ||||
| keymap = WM_modalkeymap_ensure(keyconf, "Transform Modal Map", modal_items); | keymap = WM_modalkeymap_ensure(keyconf, "Transform Modal Map", modal_items); | ||||
| keymap->poll_modal_item = transform_modal_item_poll; | keymap->poll_modal_item = transform_modal_item_poll; | ||||
| ▲ Show 20 Lines • Show All 407 Lines • ▼ Show 20 Lines | switch (event->val) { | ||||
| initSelectConstraint(t); | initSelectConstraint(t); | ||||
| postSelectConstraint(t); | postSelectConstraint(t); | ||||
| } | } | ||||
| } | } | ||||
| t->redraw |= TREDRAW_HARD; | t->redraw |= TREDRAW_HARD; | ||||
| handled = true; | handled = true; | ||||
| } | } | ||||
| break; | break; | ||||
| case TFM_MODAL_EDIT_SNAPWITH: | |||||
| tranform_snap_snapwith_init(t); | |||||
| break; | |||||
| /* Those two are only handled in transform's own handler, see T44634! */ | /* Those two are only handled in transform's own handler, see T44634! */ | ||||
| case TFM_MODAL_EDGESLIDE_UP: | case TFM_MODAL_EDGESLIDE_UP: | ||||
| case TFM_MODAL_EDGESLIDE_DOWN: | case TFM_MODAL_EDGESLIDE_DOWN: | ||||
| default: | default: | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| /* Else do non-mapped events. */ | /* Else do non-mapped events. */ | ||||
| ▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | switch (event->type) { | ||||
| t->flag &= ~T_ALT_TRANSFORM; | t->flag &= ~T_ALT_TRANSFORM; | ||||
| t->redraw |= TREDRAW_HARD; | t->redraw |= TREDRAW_HARD; | ||||
| handled = true; | handled = true; | ||||
| } | } | ||||
| break; | break; | ||||
| default: { | default: { | ||||
| /* Disable modifiers. */ | /* Disable modifiers. */ | ||||
| int modifiers = t->modifiers; | int modifiers = t->modifiers; | ||||
| modifiers &= ~MOD_CONSTRAINT_SELECT; | modifiers &= ~(MOD_CONSTRAINT_SELECT | MOD_CONSTRAINT_PLANE | MOD_EDIT_SNAPWITH); | ||||
| modifiers &= ~MOD_CONSTRAINT_PLANE; | |||||
| if (modifiers != t->modifiers) { | if (modifiers != t->modifiers) { | ||||
| if (t->modifiers & (MOD_CONSTRAINT_SELECT | MOD_CONSTRAINT_PLANE)) { | if (t->modifiers & (MOD_CONSTRAINT_SELECT | MOD_CONSTRAINT_PLANE)) { | ||||
| postSelectConstraint(t); | postSelectConstraint(t); | ||||
| } | } | ||||
| else { | |||||
| BLI_assert(t->modifiers & MOD_EDIT_SNAPWITH); | |||||
| tranform_snap_snapwith_end(t); | |||||
| } | |||||
| t->modifiers = modifiers; | t->modifiers = modifiers; | ||||
| t->redraw |= TREDRAW_HARD; | t->redraw |= TREDRAW_HARD; | ||||
| handled = true; | handled = true; | ||||
| } | } | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 687 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| void transformApply(bContext *C, TransInfo *t) | void transformApply(bContext *C, TransInfo *t) | ||||
| { | { | ||||
| t->context = C; | t->context = C; | ||||
| if ((t->redraw & TREDRAW_HARD) || (t->draw_handle_apply == NULL && (t->redraw & TREDRAW_SOFT))) { | if ((t->redraw & TREDRAW_HARD) || (t->draw_handle_apply == NULL && (t->redraw & TREDRAW_SOFT))) { | ||||
| selectConstraint(t); | selectConstraint(t); | ||||
| if (t->transform) { | if (t->modifiers & MOD_EDIT_SNAPWITH) { | ||||
| tranform_snap_snapwith_update(t); | |||||
| } | |||||
| else if (t->transform) { | |||||
| t->transform(t, t->mval); /* calls recalcData() */ | t->transform(t, t->mval); /* calls recalcData() */ | ||||
| viewRedrawForce(C, t); | t->redraw |= TREDRAW_SOFT; | ||||
| } | } | ||||
| t->redraw = TREDRAW_NOTHING; | |||||
| } | } | ||||
| else if (t->redraw & TREDRAW_SOFT) { | |||||
| if (t->redraw & TREDRAW_SOFT) { | |||||
| viewRedrawForce(C, t); | viewRedrawForce(C, t); | ||||
| t->redraw = TREDRAW_NOTHING; | |||||
| } | } | ||||
| /* If auto confirm is on, break after one pass */ | /* If auto confirm is on, break after one pass */ | ||||
| if (t->options & CTX_AUTOCONFIRM) { | if (t->options & CTX_AUTOCONFIRM) { | ||||
| t->state = TRANS_CONFIRM; | t->state = TRANS_CONFIRM; | ||||
| } | } | ||||
| t->context = NULL; | t->context = NULL; | ||||
| ▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines | |||||