Manipulator: 3D view navigation improvements

- Highlight's were too intense/distracting
  use more subtle alpha (consistent with the rest of our UI).
- Don't fill center cube (only draw edges).
- Draw widget while interacting since this is helpful in some cases.

Thanks to @jbakker for suggestions.

Also change axis hotspots so the nearest is always selected
for quicker axis picking (relies on dragging any axis to orbit).
This commit is contained in:
Campbell Barton 2017-12-19 15:20:05 +11:00
parent f03660bb84
commit 01850f0928
Notes: blender-bot 2023-02-14 10:14:07 +01:00
Referenced by issue #53488, Initial Blender 101 Design Task
2 changed files with 12 additions and 8 deletions

View File

@ -127,9 +127,9 @@ static void WIDGETGROUP_navigate_setup(const bContext *UNUSED(C), wmManipulatorG
const struct NavigateManipulatorInfo *info = &g_navigate_params[i];
navgroup->mpr_array[i] = WM_manipulator_new(info->manipulator, mgroup, NULL);
wmManipulator *mpr = navgroup->mpr_array[i];
mpr->flag |= WM_MANIPULATOR_GRAB_CURSOR;
copy_v3_fl(mpr->color, 1.0f);
mpr->color[3] = 0.4f;
mpr->flag |= WM_MANIPULATOR_GRAB_CURSOR | WM_MANIPULATOR_DRAW_MODAL;
mpr->color[3] = 0.2f;
mpr->color_hi[3] = 0.4f;
/* may be overwritten later */
mpr->scale_basis = (MANIPULATOR_SIZE * MANIPULATOR_MINI_FAC) / 2;
@ -223,7 +223,8 @@ void VIEW3D_WGT_navigate(wmManipulatorGroupType *wgt)
wgt->idname = "VIEW3D_WGT_navigate";
wgt->flag |= (WM_MANIPULATORGROUPTYPE_PERSISTENT |
WM_MANIPULATORGROUPTYPE_SCALE);
WM_MANIPULATORGROUPTYPE_SCALE |
WM_MANIPULATORGROUPTYPE_DRAW_MODAL_ALL);
wgt->poll = WIDGETGROUP_navigate_poll;
wgt->setup = WIDGETGROUP_navigate_setup;

View File

@ -98,6 +98,7 @@ static void axis_geom_draw(
const float scale_axis = 0.25f;
static const float axis_highlight[4] = {1, 1, 1, 1};
static const float axis_nop[4] = {1, 1, 1, 0};
static const float axis_black[4] = {0, 0, 0, 1};
static float axis_color[3][4];
gpuPushMatrix();
@ -138,7 +139,8 @@ static void axis_geom_draw(
glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
glLineWidth(1.0f);
immUniformColor4fv(axis_highlight);
/* Just draw depth values. */
immUniformColor4fv(axis_nop);
imm_draw_cube_fill_3d(pos_id, center, size);
immUniformColor4fv(axis_black);
madd_v3_v3fl(
@ -224,7 +226,7 @@ static void axis3d_draw_intern(
static void manipulator_axis_draw(const bContext *C, wmManipulator *mpr)
{
const bool is_modal = mpr->state & WM_MANIPULATOR_STATE_MODAL;
const bool is_highlight = (mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT) != 0 && (mpr->highlight_part == 0);
const bool is_highlight = (mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT) != 0;
(void)is_modal;
@ -241,13 +243,14 @@ static int manipulator_axis_test_select(
mul_v2_fl(point_local, 1.0f / mpr->scale_basis);
const float len_sq = len_squared_v2(point_local);
if (len_sq > SQUARE(1.0 + HANDLE_SIZE)) {
if (len_sq > 1.0) {
return -1;
}
int part_best = -1;
int part_index = 1;
float i_best_len_sq = SQUARE(HANDLE_SIZE);
/* Use 'SQUARE(HANDLE_SIZE)' if we want to be able to _not_ focus on one of the axis. */
float i_best_len_sq = FLT_MAX;
for (int i = 0; i < 3; i++) {
for (int is_pos = 0; is_pos < 2; is_pos++) {
float co[2] = {