diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-02-26 12:17:40 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-02-26 13:15:45 +0300 |
commit | 0a87bf67849be91d4b874862815c8ca9e93a4047 (patch) | |
tree | c12214b43e827cb1215ec44b20f03cb08bb427f5 /source/blender/editors/transform/transform_constraints.c | |
parent | 13dd8b69f036980b7ad14b692ad5c1edb11745d0 (diff) |
Transform: don't set the user constraint when it's not set
The orientation for the redo panel would be set even when not used,
add an 'unset' orientation which defaults to global.
Diffstat (limited to 'source/blender/editors/transform/transform_constraints.c')
-rw-r--r-- | source/blender/editors/transform/transform_constraints.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 5bf65c16329..4bed5a3f05c 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -1092,26 +1092,35 @@ void setNearestAxis(TransInfo *t) /*-------------- HELPER FUNCTIONS ----------------*/ -char constraintModeToChar(TransInfo *t) +int constraintModeToIndex(const TransInfo *t) { if ((t->con.mode & CON_APPLY) == 0) { - return '\0'; + return -1; } switch (t->con.mode & (CON_AXIS0 | CON_AXIS1 | CON_AXIS2)) { case (CON_AXIS0): case (CON_AXIS1 | CON_AXIS2): - return 'X'; + return 0; case (CON_AXIS1): case (CON_AXIS0 | CON_AXIS2): - return 'Y'; + return 1; case (CON_AXIS2): case (CON_AXIS0 | CON_AXIS1): - return 'Z'; + return 2; default: - return '\0'; + return -1; } } +char constraintModeToChar(const TransInfo *t) +{ + int index = constraintModeToIndex(t); + if (index == -1) { + return '\0'; + } + BLI_assert((uint)index < 3); + return 'X' + index; +} bool isLockConstraint(TransInfo *t) { |