Fix #131732: Selection: Selecting in wireframe shading is broken
In the process of fixing, add some convenience functions.
This commit is contained in:
@@ -56,7 +56,7 @@ void Instance::init()
|
||||
state.hide_overlays = (state.v3d->flag2 & V3D_HIDE_OVERLAYS) != 0;
|
||||
state.xray_enabled = XRAY_ACTIVE(state.v3d);
|
||||
state.xray_enabled_and_not_wire = state.xray_enabled && (state.v3d->shading.type > OB_WIRE);
|
||||
state.xray_opacity = XRAY_ALPHA(state.v3d);
|
||||
state.xray_opacity = state.xray_enabled ? XRAY_ALPHA(state.v3d) : 1.0f;
|
||||
|
||||
if (!state.hide_overlays) {
|
||||
state.overlay = state.v3d->overlay;
|
||||
@@ -697,7 +697,12 @@ bool Instance::object_is_in_front(const Object *object, const State &state)
|
||||
|
||||
bool Instance::object_needs_prepass(const ObjectRef &ob_ref, bool in_paint_mode)
|
||||
{
|
||||
if (selection_type_ != SelectionType::DISABLED || state.is_depth_only_drawing) {
|
||||
if (resources.is_selection() && state.is_wireframe_mode && !state.is_solid()) {
|
||||
/* Selection in wireframe mode only use wires unless xray opacity is 1. */
|
||||
return false;
|
||||
}
|
||||
|
||||
if (resources.is_selection() || state.is_depth_only_drawing) {
|
||||
/* Selection and depth picking always need a prepass.
|
||||
* Note that depth writing and depth test might be disable for certain selection mode. */
|
||||
return true;
|
||||
|
||||
@@ -170,6 +170,22 @@ struct State {
|
||||
|
||||
/** Convenience functions. */
|
||||
|
||||
/* Scene geometry is solid. Occlude overlays behind scene geometry. */
|
||||
bool is_solid() const
|
||||
{
|
||||
return xray_opacity == 1.0f;
|
||||
}
|
||||
/* Scene geometry is semi-transparent. Fade overlays behind scene geometry (see #XrayFade). */
|
||||
bool is_xray() const
|
||||
{
|
||||
return (xray_opacity < 1.0f) && (xray_opacity > 0.0f);
|
||||
}
|
||||
/* Scene geometry is fully transparent. Scene geometry does not occlude overlays. */
|
||||
bool is_wire() const
|
||||
{
|
||||
return xray_opacity == 0.0f;
|
||||
}
|
||||
|
||||
bool is_space_v3d() const
|
||||
{
|
||||
return this->space_type == SPACE_VIEW3D;
|
||||
|
||||
Reference in New Issue
Block a user