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:
authorCampbell Barton <ideasman42@gmail.com>2019-08-26 07:40:00 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-08-26 07:40:00 +0300
commitdb851c78b4b391e4ddeb3350550a0da5194554fd (patch)
treea5f70712a4506216e5ee7d3124540ac08d73e2fb /source/blender/editors/transform/transform_snap.c
parent7b61fe1638051b3b2e296680a000819f31672414 (diff)
Transform: support snapping origins onto the objects geometry
Normally it wouldn't make sense for the object to snap onto it's self, when moving origins this is a common use-case.
Diffstat (limited to 'source/blender/editors/transform/transform_snap.c')
-rw-r--r--source/blender/editors/transform/transform_snap.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index b29edcb00de..14242f6ba40 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -632,12 +632,20 @@ static void initSnappingMode(TransInfo *t)
else if (t->tsnap.applySnap != NULL && // A snapping function actually exist
(obedit_type == -1)) // Object Mode
{
- /* In "Edit Strokes" mode,
- * snap tool can perform snap to selected or active objects (see T49632)
- * TODO: perform self snap in gpencil_strokes */
- t->tsnap.modeSelect = (((t->options & (CTX_GPENCIL_STROKES | CTX_CURSOR)) != 0) ?
- SNAP_ALL :
- SNAP_NOT_SELECTED);
+
+ if (t->options & (CTX_GPENCIL_STROKES | CTX_CURSOR)) {
+ /* In "Edit Strokes" mode,
+ * snap tool can perform snap to selected or active objects (see T49632)
+ * TODO: perform self snap in gpencil_strokes */
+ t->tsnap.modeSelect = SNAP_ALL;
+ }
+ else if (t->flag & T_OBJECT_DATA_IN_OBJECT_MODE) {
+ /* When we're moving the origins, allow snapping onto our own geometry (see T69132). */
+ t->tsnap.modeSelect = SNAP_ALL;
+ }
+ else {
+ t->tsnap.modeSelect = SNAP_NOT_SELECTED;
+ }
}
else {
/* Grid if snap is not possible */