Cleanup: move snap with projection check into a function
This commit is contained in:
parent
a287c8d3c1
commit
c1fe582446
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue