diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-12-19 12:51:04 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-12-19 12:57:51 +0300 |
commit | f7dc6a63fb5a62eb6141fee375e30d94c1d83fa8 (patch) | |
tree | cdf3a5c3d50bc893a98e52c48a7a71a9a70a7c72 /source/blender/editors/transform/transform_orientations.c | |
parent | 231ea39ed154b8284f45e97b10fbb699e79358c3 (diff) |
Gizmo: optional custom orientations for transform
This aims to resolve a conflict where some users want to keep keyboard
axis setting global, even when the orientation is set to something else.
Move/rotate/scale can optionally each have a separate orientation.
Some UI changes will be made next.
Diffstat (limited to 'source/blender/editors/transform/transform_orientations.c')
-rw-r--r-- | source/blender/editors/transform/transform_orientations.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index a21882fc206..04999213c63 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -71,9 +71,12 @@ void BIF_clearTransformOrientation(bContext *C) BLI_freelistN(transform_orientations); - if (scene->orientation_type == V3D_MANIP_CUSTOM) { - scene->orientation_type = V3D_MANIP_GLOBAL; /* fallback to global */ - scene->orientation_index_custom = -1; + for (int i = 0; i < ARRAY_SIZE(scene->orientation_slots); i++) { + TransformOrientationSlot *orient_slot = &scene->orientation_slots[i]; + if (orient_slot->type == V3D_MANIP_CUSTOM) { + orient_slot->type = V3D_MANIP_GLOBAL; /* fallback to global */ + orient_slot->index_custom = -1; + } } } @@ -366,21 +369,8 @@ void BIF_selectTransformOrientation(bContext *C, TransformOrientation *target) BLI_assert(index != -1); - scene->orientation_type = V3D_MANIP_CUSTOM; - scene->orientation_index_custom = index; -} - -/** - * Activate a transform orientation in a 3D view based on an enum value. - * - * \param orientation: If this is #V3D_MANIP_CUSTOM or greater, the custom transform orientation - * with index \a orientation - #V3D_MANIP_CUSTOM gets activated. - */ -void BIF_selectTransformOrientationValue(Scene *scene, int orientation) -{ - const bool is_custom = orientation >= V3D_MANIP_CUSTOM; - scene->orientation_type = is_custom ? V3D_MANIP_CUSTOM : orientation; - scene->orientation_index_custom = is_custom ? (orientation - V3D_MANIP_CUSTOM) : -1; + scene->orientation_slots[SCE_ORIENT_DEFAULT].type = V3D_MANIP_CUSTOM; + scene->orientation_slots[SCE_ORIENT_DEFAULT].index_custom = index; } int BIF_countTransformOrientation(const bContext *C) |