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:
authorGermano Cavalcantemano-wii <germano.costa@ig.com.br>2021-01-11 02:24:46 +0300
committerGermano Cavalcantemano-wii <germano.costa@ig.com.br>2021-01-11 02:24:46 +0300
commit08e44b5e3ebbdc79ca849ce14f4d75a88f72a8b7 (patch)
tree0e51294e37f556fa54c69b362ad2f50409ff4e36 /source/blender/editors
parent9db3d1951da15254efbbcf028176facb78118ec1 (diff)
Fix Increment Snapping Without Constraints in Non-Axis-Aligned Views
The incremental snap was always operating in the local space, which in most cases is the VIEW type orientation. Use only local space when the operation is affected by constraint. Differential Revision: https://developer.blender.org/D10052
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/transform/transform_mode_translate.c6
-rw-r--r--source/blender/editors/transform/transform_snap.c18
-rw-r--r--source/blender/editors/transform/transform_snap.h1
3 files changed, 20 insertions, 5 deletions
diff --git a/source/blender/editors/transform/transform_mode_translate.c b/source/blender/editors/transform/transform_mode_translate.c
index 8597c372537..4b85e8067fd 100644
--- a/source/blender/editors/transform/transform_mode_translate.c
+++ b/source/blender/editors/transform/transform_mode_translate.c
@@ -395,9 +395,9 @@ static void applyTranslation(TransInfo *t, const int UNUSED(mval[2]))
}
float incr_dir[3];
- mul_v3_m3v3(incr_dir, t->spacemtx_inv, global_dir);
- if (!(activeSnap(t) && validSnap(t)) && transform_snap_increment(t, incr_dir)) {
- mul_v3_m3v3(incr_dir, t->spacemtx, incr_dir);
+ copy_v3_v3(incr_dir, global_dir);
+ if (!(activeSnap(t) && validSnap(t)) &&
+ transform_snap_increment_ex(t, (t->con.mode & CON_APPLY) != 0, incr_dir)) {
/* Test for mixed snap with grid. */
float snap_dist_sq = FLT_MAX;
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index e5b16d0ef6e..c19dd4598cf 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -1536,7 +1536,7 @@ static void snap_increment_apply(TransInfo *t,
snap_increment_apply_ex(t, max_index, increment_dist, asp, r_val, r_val);
}
-bool transform_snap_increment(TransInfo *t, float *val)
+bool transform_snap_increment_ex(TransInfo *t, bool use_local_space, float *r_val)
{
if (!activeSnap(t)) {
return false;
@@ -1552,12 +1552,26 @@ bool transform_snap_increment(TransInfo *t, float *val)
return false;
}
+ if (use_local_space) {
+ BLI_assert(t->idx_max == 2);
+ mul_m3_v3(t->spacemtx_inv, r_val);
+ }
+
float increment_dist = (t->modifiers & MOD_PRECISION) ? t->snap[1] : t->snap[0];
+ snap_increment_apply(t, t->idx_max, increment_dist, r_val);
+
+ if (use_local_space) {
+ mul_m3_v3(t->spacemtx, r_val);
+ }
- snap_increment_apply(t, t->idx_max, increment_dist, val);
return true;
}
+bool transform_snap_increment(TransInfo *t, float *r_val)
+{
+ return transform_snap_increment_ex(t, false, r_val);
+}
+
/** \} */
/* -------------------------------------------------------------------- */
diff --git a/source/blender/editors/transform/transform_snap.h b/source/blender/editors/transform/transform_snap.h
index db8ec943bfd..c557368ed17 100644
--- a/source/blender/editors/transform/transform_snap.h
+++ b/source/blender/editors/transform/transform_snap.h
@@ -54,6 +54,7 @@ void snapFrameTransform(struct TransInfo *t,
bool transformModeUseSnap(const TransInfo *t);
+bool transform_snap_increment_ex(TransInfo *t, bool use_local_space, float *r_val);
bool transform_snap_increment(TransInfo *t, float *val);
bool transform_snap_grid(TransInfo *t, float *val);