Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Poirier <theeth@yahoo.com>2009-12-01 21:26:18 +0300
committerMartin Poirier <theeth@yahoo.com>2009-12-01 21:26:18 +0300
commit9f251ce3016b5b37e294c35f695e2b6345937764 (patch)
tree3d5c44d8a22a480b187c1bebc36775e77c8805a7 /source/blender/editors/transform/transform.c
parentd7877d360a12d3ad6497a80c4ab4522fe3a2665d (diff)
Additive snap for Transform. Easy snapping between two vertices, in the middle of three faces, ...
A to add the current snapping point to the list Alt-A to remove the last one The resulting snapping point is the average of all snap points in the list (and the one under the mouse pointer, if valid). Snapping between two verts is a matter of moving over the first, pressing A, moving over the other, confirming transform.
Diffstat (limited to 'source/blender/editors/transform/transform.c')
-rw-r--r--source/blender/editors/transform/transform.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 2e1922d8a07..cbcb3953f49 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -517,6 +517,8 @@ static char *transform_to_undostr(TransInfo *t)
#define TFM_MODAL_PLANE_Y 13
#define TFM_MODAL_PLANE_Z 14
#define TFM_MODAL_CONS_OFF 15
+#define TFM_MODAL_ADD_SNAP 16
+#define TFM_MODAL_REMOVE_SNAP 17
/* called in transform_ops.c, on each regeneration of keymaps */
void transform_modal_keymap(wmKeyConfig *keyconf)
@@ -537,6 +539,8 @@ void transform_modal_keymap(wmKeyConfig *keyconf)
{TFM_MODAL_PLANE_Y, "PLANE_Y", 0, "Orientation Y plane", ""},
{TFM_MODAL_PLANE_Z, "PLANE_Z", 0, "Orientation Z plane", ""},
{TFM_MODAL_CONS_OFF, "CONS_OFF", 0, "Remove Constraints", ""},
+ {TFM_MODAL_ADD_SNAP, "ADD_SNAP", 0, "Add Snap Point", ""},
+ {TFM_MODAL_REMOVE_SNAP, "REMOVE_SNAP", 0, "Remove Last Snap Point", ""},
{0, NULL, 0, NULL, NULL}};
wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Transform Modal Map");
@@ -558,6 +562,9 @@ void transform_modal_keymap(wmKeyConfig *keyconf)
WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_CLICK, KM_ANY, 0, TFM_MODAL_SNAP_TOGGLE);
+ WM_modalkeymap_add_item(keymap, AKEY, KM_PRESS, 0, 0, TFM_MODAL_ADD_SNAP);
+ WM_modalkeymap_add_item(keymap, AKEY, KM_PRESS, KM_ALT, 0, TFM_MODAL_REMOVE_SNAP);
+
/* assign map to operators */
WM_modalkeymap_assign(keymap, "TFM_OT_transform");
WM_modalkeymap_assign(keymap, "TFM_OT_translate");
@@ -743,6 +750,14 @@ int transformEvent(TransInfo *t, wmEvent *event)
t->redraw = 1;
}
break;
+ case TFM_MODAL_ADD_SNAP:
+ addSnapPoint(t);
+ t->redraw = 1;
+ break;
+ case TFM_MODAL_REMOVE_SNAP:
+ removeSnapPoint(t);
+ t->redraw = 1;
+ break;
default:
handled = 0;
break;