From 14884cda1ff5677cacff7a038efa5440f5e15a5c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 13 Apr 2019 20:36:53 +0200 Subject: Gizmo: move transform to a persistent option Based on feedback from animators, this is useful to keep as a view option (as in 2.7x). Now the transform gizmos can be enabled from the popover, the tools still work for location/scale/rotation. The transform tool has been removed. See T63518 --- source/blender/blenkernel/BKE_scene.h | 1 + source/blender/blenkernel/intern/scene.c | 31 +++++++++++++++++-------------- 2 files changed, 18 insertions(+), 14 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index 4e4883222cc..2ab2bd3fbe6 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -128,6 +128,7 @@ float BKE_scene_frame_get(const struct Scene *scene); float BKE_scene_frame_get_from_ctime(const struct Scene *scene, const float frame); void BKE_scene_frame_set(struct Scene *scene, double cfra); +struct TransformOrientationSlot *BKE_scene_orientation_slot_get_from_flag(struct Scene *scene, int slot_index); struct TransformOrientationSlot *BKE_scene_orientation_slot_get(struct Scene *scene, int flag); void BKE_scene_orientation_slot_set_index(struct TransformOrientationSlot *orient_slot, int orientation); int BKE_scene_orientation_slot_get_index(const struct TransformOrientationSlot *orient_slot); diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 644eb704655..630441265e1 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -651,7 +651,6 @@ void BKE_scene_init(Scene *sce) sce->toolsettings->uvcalc_flag = UVCALC_TRANSFORM_CORRECT; sce->toolsettings->unwrapper = 1; sce->toolsettings->select_thresh = 0.01f; - sce->toolsettings->gizmo_flag = SCE_GIZMO_SHOW_TRANSLATE | SCE_GIZMO_SHOW_ROTATE | SCE_GIZMO_SHOW_SCALE; sce->toolsettings->selectmode = SCE_SELECT_VERTEX; sce->toolsettings->uv_selectmode = UV_SELECT_VERTEX; @@ -1347,24 +1346,28 @@ void BKE_scene_frame_set(struct Scene *scene, double cfra) /** \name Scene Orientation Slots * \{ */ -TransformOrientationSlot *BKE_scene_orientation_slot_get(Scene *scene, int flag) +TransformOrientationSlot *BKE_scene_orientation_slot_get(Scene *scene, int slot_index) { - BLI_assert(flag && !(flag & ~(SCE_GIZMO_SHOW_TRANSLATE | SCE_GIZMO_SHOW_ROTATE | SCE_GIZMO_SHOW_SCALE))); - int index = SCE_ORIENT_DEFAULT; - if (flag & SCE_GIZMO_SHOW_TRANSLATE) { - index = SCE_ORIENT_TRANSLATE; + if ((scene->orientation_slots[slot_index].flag & SELECT) == 0) { + slot_index = SCE_ORIENT_DEFAULT; } - else if (flag & SCE_GIZMO_SHOW_ROTATE) { - index = SCE_ORIENT_ROTATE; + return &scene->orientation_slots[slot_index]; +} + +TransformOrientationSlot *BKE_scene_orientation_slot_get_from_flag(Scene *scene, int flag) +{ + BLI_assert(flag && !(flag & ~(V3D_GIZMO_TYPE_MASK_TRANSLATE | V3D_GIZMO_TYPE_MASK_ROTATE | V3D_GIZMO_TYPE_MASK_SCALE))); + int slot_index = SCE_ORIENT_DEFAULT; + if (flag & V3D_GIZMO_TYPE_MASK_TRANSLATE) { + slot_index = SCE_ORIENT_TRANSLATE; } - else if (flag & SCE_GIZMO_SHOW_SCALE) { - index = SCE_ORIENT_SCALE; + else if (flag & V3D_GIZMO_TYPE_MASK_ROTATE) { + slot_index = SCE_ORIENT_ROTATE; } - - if ((scene->orientation_slots[index].flag & SELECT) == 0) { - index = SCE_ORIENT_DEFAULT; + else if (flag & V3D_GIZMO_TYPE_MASK_SCALE) { + slot_index = SCE_ORIENT_SCALE; } - return &scene->orientation_slots[index]; + return BKE_scene_orientation_slot_get(scene, slot_index); } /** -- cgit v1.2.3