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
path: root/source
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
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')
-rw-r--r--source/blender/editors/transform/transform_conversions.c15
-rw-r--r--source/blender/editors/transform/transform_snap.c20
2 files changed, 23 insertions, 12 deletions
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 4fe79dc3202..dc072d74be6 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -6536,11 +6536,14 @@ static void flush_trans_object_base_deps_flag(Depsgraph *depsgraph, Object *obje
depsgraph, &object->id, DEG_OB_COMP_TRANSFORM, set_trans_object_base_deps_flag_cb, NULL);
}
-static void trans_object_base_deps_flag_finish(ViewLayer *view_layer)
+static void trans_object_base_deps_flag_finish(const TransInfo *t, ViewLayer *view_layer)
{
- for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- if (base->object->id.tag & LIB_TAG_DOIT) {
- base->flag_legacy |= BA_SNAP_FIX_DEPS_FIASCO;
+
+ if ((t->flag & T_OBJECT_DATA_IN_OBJECT_MODE) == 0) {
+ for (Base *base = view_layer->object_bases.first; base; base = base->next) {
+ if (base->object->id.tag & LIB_TAG_DOIT) {
+ base->flag_legacy |= BA_SNAP_FIX_DEPS_FIASCO;
+ }
}
}
}
@@ -6602,7 +6605,7 @@ static void set_trans_object_base_flags(TransInfo *t)
/* Store temporary bits in base indicating that base is being modified
* (directly or indirectly) by transforming objects.
*/
- trans_object_base_deps_flag_finish(view_layer);
+ trans_object_base_deps_flag_finish(t, view_layer);
}
static bool mark_children(Object *ob)
@@ -6670,7 +6673,7 @@ static int count_proportional_objects(TransInfo *t)
/* Store temporary bits in base indicating that base is being modified
* (directly or indirectly) by transforming objects.
*/
- trans_object_base_deps_flag_finish(view_layer);
+ trans_object_base_deps_flag_finish(t, view_layer);
return total;
}
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 */