Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-06-13 11:51:52 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-06-13 11:57:09 +0300
commitf234adf65c2ae741f33f2ed4433f2990d8f6de97 (patch)
treeccee8cfdc70f0589ff62ca3ed939760e195cdaa2 /source/blender/editors/space_view3d
parentedd0522e8f6b33a086db8ceba507c8a081d08f73 (diff)
UI: adjust view navigation layout
Button layout now matches T54723.
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r--source/blender/editors/space_view3d/view3d_manipulator_navigate.c73
1 files changed, 36 insertions, 37 deletions
diff --git a/source/blender/editors/space_view3d/view3d_manipulator_navigate.c b/source/blender/editors/space_view3d/view3d_manipulator_navigate.c
index c869e23d552..1f653941443 100644
--- a/source/blender/editors/space_view3d/view3d_manipulator_navigate.c
+++ b/source/blender/editors/space_view3d/view3d_manipulator_navigate.c
@@ -51,11 +51,11 @@
* \{ */
/* Offset from screen edge. */
-#define MANIPULATOR_OFFSET_FAC 2.5
+#define MANIPULATOR_OFFSET_FAC 1.5f
/* Size of main icon. */
#define MANIPULATOR_SIZE 64
/* Factor for size of smaller button. */
-#define MANIPULATOR_MINI_FAC 0.5
+#define MANIPULATOR_MINI_FAC 0.5f
/* How much mini buttons offset from the primary. */
#define MANIPULATOR_MINI_OFFSET_FAC 0.6666f
@@ -297,10 +297,21 @@ static void WIDGETGROUP_navigate_draw_prepare(const bContext *C, wmManipulatorGr
navgroup->state.rv3d.is_camera = (rv3d->persp == RV3D_CAMOB);
navgroup->state.rv3d.viewlock = rv3d->viewlock;
+ const bool show_rotate = (
+ ((rv3d->viewlock & RV3D_LOCKED) == 0) &&
+ (navgroup->state.rv3d.is_camera == false));
+ const bool show_fixed_offset = navgroup->state.rv3d.is_camera;
const float icon_size = MANIPULATOR_SIZE;
- const float icon_offset = (icon_size / 2.0) * MANIPULATOR_OFFSET_FAC * UI_DPI_FAC;
+ const float icon_offset = (icon_size * 0.52f) * MANIPULATOR_OFFSET_FAC * UI_DPI_FAC;
const float icon_offset_mini = icon_size * MANIPULATOR_MINI_OFFSET_FAC * UI_DPI_FAC;
- const float co[2] = {rect_visible.xmax - icon_offset, rect_visible.ymax - icon_offset};
+ const float co_rotate[2] = {
+ rect_visible.xmax - icon_offset,
+ rect_visible.ymax - icon_offset,
+ };
+ const float co[2] = {
+ rect_visible.xmax - ((show_rotate || show_fixed_offset) ? (icon_offset * 2.2f) : (icon_offset_mini * 0.75f)),
+ rect_visible.ymax - icon_offset_mini * 0.66f,
+ };
wmManipulator *mpr;
@@ -309,48 +320,36 @@ static void WIDGETGROUP_navigate_draw_prepare(const bContext *C, wmManipulatorGr
WM_manipulator_set_flag(mpr, WM_MANIPULATOR_HIDDEN, true);
}
- if (((rv3d->viewlock & RV3D_LOCKED) == 0) && (navgroup->state.rv3d.is_camera == false)) {
+ /* RV3D_LOCKED or Camera: only show supported buttons. */
+ if (show_rotate) {
mpr = navgroup->mpr_array[MPR_ROTATE];
- mpr->matrix_basis[3][0] = co[0];
- mpr->matrix_basis[3][1] = co[1];
+ mpr->matrix_basis[3][0] = co_rotate[0];
+ mpr->matrix_basis[3][1] = co_rotate[1];
WM_manipulator_set_flag(mpr, WM_MANIPULATOR_HIDDEN, false);
+ }
- mpr = navgroup->mpr_array[MPR_MOVE];
- mpr->matrix_basis[3][0] = co[0] + icon_offset_mini;
- mpr->matrix_basis[3][1] = co[1] - icon_offset_mini;
- WM_manipulator_set_flag(mpr, WM_MANIPULATOR_HIDDEN, false);
+ int icon_mini_slot = 0;
- mpr = navgroup->mpr_array[MPR_ZOOM];
- mpr->matrix_basis[3][0] = co[0] - icon_offset_mini;
- mpr->matrix_basis[3][1] = co[1] - icon_offset_mini;
- WM_manipulator_set_flag(mpr, WM_MANIPULATOR_HIDDEN, false);
+ mpr = navgroup->mpr_array[MPR_ZOOM];
+ mpr->matrix_basis[3][0] = co[0] - (icon_offset_mini * icon_mini_slot++);
+ mpr->matrix_basis[3][1] = co[1];
+ WM_manipulator_set_flag(mpr, WM_MANIPULATOR_HIDDEN, false);
- mpr = navgroup->mpr_array[rv3d->is_persp ? MPR_ORTHO : MPR_PERSP];
- mpr->matrix_basis[3][0] = co[0] + icon_offset_mini;
- mpr->matrix_basis[3][1] = co[1] + icon_offset_mini;
- WM_manipulator_set_flag(mpr, WM_MANIPULATOR_HIDDEN, false);
+ mpr = navgroup->mpr_array[MPR_MOVE];
+ mpr->matrix_basis[3][0] = co[0] - (icon_offset_mini * icon_mini_slot++);
+ mpr->matrix_basis[3][1] = co[1];
+ WM_manipulator_set_flag(mpr, WM_MANIPULATOR_HIDDEN, false);
+ if ((rv3d->viewlock & RV3D_LOCKED) == 0) {
mpr = navgroup->mpr_array[MPR_CAMERA];
- mpr->matrix_basis[3][0] = co[0] - icon_offset_mini;
- mpr->matrix_basis[3][1] = co[1] + icon_offset_mini;
- WM_manipulator_set_flag(mpr, WM_MANIPULATOR_HIDDEN, false);
- }
- else {
- /* RV3D_LOCKED or Camera: only show supported buttons. */
- mpr = navgroup->mpr_array[MPR_MOVE];
- mpr->matrix_basis[3][0] = co[0] + icon_offset_mini;
- mpr->matrix_basis[3][1] = co[1] + icon_offset_mini;
- WM_manipulator_set_flag(mpr, WM_MANIPULATOR_HIDDEN, false);
-
- mpr = navgroup->mpr_array[MPR_ZOOM];
- mpr->matrix_basis[3][0] = co[0];
- mpr->matrix_basis[3][1] = co[1] + icon_offset_mini;
+ mpr->matrix_basis[3][0] = co[0] - (icon_offset_mini * icon_mini_slot++);
+ mpr->matrix_basis[3][1] = co[1];
WM_manipulator_set_flag(mpr, WM_MANIPULATOR_HIDDEN, false);
- if (navgroup->state.rv3d.is_camera) {
- mpr = navgroup->mpr_array[MPR_CAMERA];
- mpr->matrix_basis[3][0] = co[0] - icon_offset_mini;
- mpr->matrix_basis[3][1] = co[1] + icon_offset_mini;
+ if (navgroup->state.rv3d.is_camera == false) {
+ mpr = navgroup->mpr_array[rv3d->is_persp ? MPR_PERSP : MPR_ORTHO];
+ mpr->matrix_basis[3][0] = co[0] - (icon_offset_mini * icon_mini_slot++);
+ mpr->matrix_basis[3][1] = co[1];
WM_manipulator_set_flag(mpr, WM_MANIPULATOR_HIDDEN, false);
}
}