Fix forced snap status being removed when changing transform mode
The `SNAP_FORCED` setting is set to the operation and not the snap status. Therefore, this option should not be cleared along with the other statuses when resetting snapping. Move then the location of this setting to `TransInfo::modifiers`.
This commit is contained in:
parent
f2538c7173
commit
deaddbdcff
|
@ -1589,7 +1589,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
|
|||
/* Update `ToolSettings` for properties that change during modal. */
|
||||
if (t->flag & T_MODAL) {
|
||||
/* Do we check for parameter? */
|
||||
if (transformModeUseSnap(t) && !(t->tsnap.status & SNAP_FORCED)) {
|
||||
if (transformModeUseSnap(t) && !(t->modifiers & MOD_SNAP_FORCED)) {
|
||||
if (!(t->modifiers & MOD_SNAP) != !(t->tsnap.flag & SCE_SNAP)) {
|
||||
/* Type is #eSnapFlag, but type must match various snap attributes in #ToolSettings. */
|
||||
short *snap_flag_ptr;
|
||||
|
|
|
@ -155,18 +155,18 @@ typedef enum {
|
|||
MOD_SNAP_INVERT = 1 << 3,
|
||||
MOD_CONSTRAINT_SELECT_PLANE = 1 << 4,
|
||||
MOD_NODE_ATTACH = 1 << 5,
|
||||
MOD_SNAP_FORCED = 1 << 6,
|
||||
} eTModifier;
|
||||
ENUM_OPERATORS(eTModifier, MOD_NODE_ATTACH)
|
||||
|
||||
/** #TransSnap.status */
|
||||
typedef enum eTSnap {
|
||||
SNAP_RESETTED = 0,
|
||||
SNAP_FORCED = 1 << 0,
|
||||
SNAP_SOURCE_FOUND = 1 << 1,
|
||||
SNAP_SOURCE_FOUND = 1 << 0,
|
||||
/* Special flag for snap to grid. */
|
||||
SNAP_TARGET_GRID_FOUND = 1 << 2,
|
||||
SNAP_TARGET_FOUND = 1 << 3,
|
||||
SNAP_MULTI_POINTS = 1 << 4,
|
||||
SNAP_TARGET_GRID_FOUND = 1 << 1,
|
||||
SNAP_TARGET_FOUND = 1 << 2,
|
||||
SNAP_MULTI_POINTS = 1 << 3,
|
||||
} eTSnap;
|
||||
ENUM_OPERATORS(eTSnap, SNAP_MULTI_POINTS)
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ bool transformModeUseSnap(const TransInfo *t)
|
|||
|
||||
static bool doForceIncrementSnap(const TransInfo *t)
|
||||
{
|
||||
if (t->tsnap.status & SNAP_FORCED) {
|
||||
if (t->modifiers & MOD_SNAP_FORCED) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -808,7 +808,8 @@ void initSnapping(TransInfo *t, wmOperator *op)
|
|||
if ((prop = RNA_struct_find_property(op->ptr, "snap_point")) &&
|
||||
RNA_property_is_set(op->ptr, prop)) {
|
||||
RNA_property_float_get_array(op->ptr, prop, t->tsnap.snap_target);
|
||||
t->tsnap.status |= SNAP_FORCED | SNAP_TARGET_FOUND;
|
||||
t->modifiers |= MOD_SNAP_FORCED;
|
||||
t->tsnap.status |= SNAP_TARGET_FOUND;
|
||||
}
|
||||
|
||||
/* snap align only defined in specific cases */
|
||||
|
|
Loading…
Reference in New Issue