diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/transform/transform_snap.c | 29 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_snap.h | 2 |
2 files changed, 22 insertions, 9 deletions
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index bebef049718..4ecb9594325 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -61,6 +61,8 @@ #include "transform_convert.h" #include "transform_snap.h" +static bool doForceIncrementSnap(const TransInfo *t); + /* this should be passed as an arg for use in snap functions */ #undef BASACT @@ -133,6 +135,23 @@ bool activeSnap(const TransInfo *t) ((t->modifiers & (MOD_SNAP | MOD_SNAP_INVERT)) == MOD_SNAP_INVERT); } +bool activeSnap_with_project(const TransInfo *t) +{ + if (!t->tsnap.project) { + return false; + } + + if (!activeSnap(t) || (t->flag & T_NO_PROJECT)) { + return false; + } + + if (doForceIncrementSnap(t)) { + return false; + } + + return true; +} + bool transformModeUseSnap(const TransInfo *t) { ToolSettings *ts = t->settings; @@ -299,15 +318,7 @@ eRedrawFlag handleSnapping(TransInfo *t, const wmEvent *event) void applyProject(TransInfo *t) { - if (!t->tsnap.project) { - return; - } - - if (!activeSnap(t) || (t->flag & T_NO_PROJECT)) { - return; - } - - if (doForceIncrementSnap(t)) { + if (!activeSnap_with_project(t)) { return; } diff --git a/source/blender/editors/transform/transform_snap.h b/source/blender/editors/transform/transform_snap.h index c557368ed17..1632b49fbbf 100644 --- a/source/blender/editors/transform/transform_snap.h +++ b/source/blender/editors/transform/transform_snap.h @@ -61,6 +61,8 @@ bool transform_snap_grid(TransInfo *t, float *val); void snapSequenceBounds(TransInfo *t, const int mval[2]); bool activeSnap(const TransInfo *t); +bool activeSnap_with_project(const TransInfo *t); + bool validSnap(const TransInfo *t); void initSnapping(struct TransInfo *t, struct wmOperator *op); |