Transform Manipulator: fix scale handle selection

The scale handles couldn't be accessed when rotation was enabled and
they pointed away from the view.
This commit is contained in:
Campbell Barton 2018-07-11 18:09:19 +02:00
parent 8bab591758
commit b90646dc0e
Notes: blender-bot 2023-02-14 08:38:14 +01:00
Referenced by issue #55918, Manipulator uses trackball instead of an axis scale
3 changed files with 16 additions and 0 deletions

View File

@ -1248,6 +1248,8 @@ static ManipulatorGroup *manipulatorgroup_init(wmManipulatorGroup *mgroup)
MANIPULATOR_NEW_PRIM(MAN_AXIS_TRANS_YZ, ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE);
MANIPULATOR_NEW_PRIM(MAN_AXIS_TRANS_ZX, ED_MANIPULATOR_PRIMITIVE_STYLE_PLANE);
man->manipulators[MAN_AXIS_ROT_T]->flag |= WM_MANIPULATOR_SELECT_BACKGROUND;
return man;
}

View File

@ -84,6 +84,8 @@ typedef enum eWM_ManipulatorFlag {
* Hide the cursor and lock it's position while interacting with this manipulator.
*/
WM_MANIPULATOR_GRAB_CURSOR = (1 << 6),
/** Don't write into the depth buffer when selecting. */
WM_MANIPULATOR_SELECT_BACKGROUND = (1 << 7),
} eWM_ManipulatorFlag;
/**

View File

@ -460,6 +460,7 @@ static void manipulator_draw_select_3D_loop(const bContext *C, ListBase *visible
/* TODO(campbell): this depends on depth buffer being written to, currently broken for the 3D view. */
bool is_depth_prev = false;
bool is_depth_skip_prev = false;
for (LinkData *link = visible_manipulators->first; link; link = link->next) {
mpr = link->data;
@ -477,6 +478,14 @@ static void manipulator_draw_select_3D_loop(const bContext *C, ListBase *visible
}
is_depth_prev = is_depth;
}
bool is_depth_skip = (mpr->flag & WM_MANIPULATOR_SELECT_BACKGROUND) != 0;
if (is_depth_skip == is_depth_skip_prev) {
/* pass */
}
else {
glDepthMask(!is_depth_skip);
is_depth_skip_prev = is_depth_skip;
}
/* pass the selection id shifted by 8 bits. Last 8 bits are used for selected manipulator part id */
@ -489,6 +498,9 @@ static void manipulator_draw_select_3D_loop(const bContext *C, ListBase *visible
if (is_depth_prev) {
glDisable(GL_DEPTH_TEST);
}
if (is_depth_skip_prev) {
glDepthMask(true);
}
}
static int manipulator_find_intersected_3d_intern(