Fix T59155: Can't select light in-front of other objects

Enable depth picking by default.

This adds new 'gpu_flag' since it's not so relevant to add GPU drawing
options into uiflag & uiflag2.

This resets the recently added smooth edge flag.
This commit is contained in:
Campbell Barton 2019-03-15 10:57:48 +11:00
parent 18e0c5ea5b
commit ee3d8cafdd
Notes: blender-bot 2023-03-24 17:05:22 +01:00
Referenced by issue #59155, Cannot select a light before objects. Selection priority issue.
5 changed files with 22 additions and 15 deletions

View File

@ -476,10 +476,6 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
GP_PAINT_DEPRECATED_0);
}
if (!USER_VERSION_ATLEAST(280, 46)) {
userdef->uiflag2 |= USER_EDIT_MODE_SMOOTH_WIRE;
}
/**
* Include next version bump.
*/

View File

@ -197,7 +197,7 @@ static void EDIT_MESH_engine_init(void *vedata)
geom_sh_code[0] = NULL;
}
const char *use_geom_def = use_geom_shader ? "#define USE_GEOM_SHADER\n" : "";
const char *use_smooth_def = (U.uiflag2 & USER_EDIT_MODE_SMOOTH_WIRE) ? "#define USE_SMOOTH_WIRE\n" : "";
const char *use_smooth_def = (U.gpu_flag & USER_GPU_FLAG_NO_EDIT_MODE_SMOOTH_WIRE) ? "" : "#define USE_SMOOTH_WIRE\n";
sh_data->overlay_face = GPU_shader_create_from_arrays({
.vert = (const char *[]){lib, datatoc_edit_mesh_overlay_vert_glsl, NULL},
.frag = (const char *[]){datatoc_gpu_shader_3D_smooth_color_frag_glsl, NULL},

View File

@ -944,7 +944,7 @@ int view3d_opengl_select(
rcti rect;
int hits = 0;
const bool use_obedit_skip = (OBEDIT_FROM_VIEW_LAYER(vc->view_layer) != NULL) && (vc->obedit == NULL);
const bool is_pick_select = (U.gpu_select_pick_deph != 0);
const bool is_pick_select = (U.gpu_flag & USER_GPU_FLAG_NO_DEPT_PICK) == 0;
const bool do_passes = (
(is_pick_select == false) &&
(select_mode == VIEW3D_SELECT_PICK_NEAREST));

View File

@ -573,7 +573,9 @@ typedef struct UserDef {
/** #eUserpref_UI_Flag. */
int uiflag;
/** #eUserpref_UI_Flag2. */
int uiflag2;
char uiflag2;
char gpu_flag;
char _pad8[2];
/* Experimental flag for app-templates to make changes to behavior
* which are outside the scope of typical preferences. */
short app_flag;
@ -664,8 +666,7 @@ typedef struct UserDef {
char ipo_new;
/** Handle types for newly added keyframes. */
char keyhandles_new;
char gpu_select_pick_deph;
char _pad11[2];
char _pad11[3];
/** #eZoomFrame_Mode. */
char view_frame_type;
@ -896,14 +897,21 @@ typedef enum eUserpref_UI_Flag {
USER_HIDE_SYSTEM_BOOKMARKS = (1u << 31),
} eUserpref_UI_Flag;
/** #UserDef.uiflag2 */
/** #UserDef.uiflag2
*
* \note don't add new flags here, use 'uiflag' which has flags free. */
typedef enum eUserpref_UI_Flag2 {
USER_UIFLAG2_DEPRECATED_0 = (1 << 0),
USER_UIFLAG2_DEPRECATED_0 = (1 << 0), /* cleared */
USER_REGION_OVERLAP = (1 << 1),
USER_TRACKPAD_NATURAL = (1 << 2),
USER_EDIT_MODE_SMOOTH_WIRE = (1 << 3),
USER_UIFLAG2_DEPRECATED_3 = (1 << 3), /* dirty */
} eUserpref_UI_Flag2;
typedef enum eUserpref_GPU_Flag {
USER_GPU_FLAG_NO_DEPT_PICK = (1 << 0),
USER_GPU_FLAG_NO_EDIT_MODE_SMOOTH_WIRE = (1 << 1),
} eUserpref_GPU_Flag;
/** #UserDef.tablet_api */
typedef enum eUserpref_TableAPI {
USER_TABLET_AUTOMATIC = 0,

View File

@ -4428,7 +4428,7 @@ static void rna_def_userdef_system(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
prop = RNA_def_property(srna, "use_edit_mode_smooth_wire", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag2", USER_EDIT_MODE_SMOOTH_WIRE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "gpu_flag", USER_GPU_FLAG_NO_EDIT_MODE_SMOOTH_WIRE);
RNA_def_property_ui_text(prop, "Edit-Mode Smooth Wires",
"Enable Edit-Mode edge smoothing, reducing aliasing, requires restart");
RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
@ -4516,8 +4516,11 @@ static void rna_def_userdef_system(BlenderRNA *brna)
/* Select */
prop = RNA_def_property(srna, "use_select_pick_depth", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "gpu_select_pick_deph", 1);
RNA_def_property_ui_text(prop, "OpenGL Depth Picking", "Use the depth buffer for picking 3D View selection");
RNA_def_property_boolean_negative_sdna(prop, NULL, "gpu_flag", USER_GPU_FLAG_NO_DEPT_PICK);
RNA_def_property_ui_text(
prop, "OpenGL Depth Picking",
"Use the depth buffer for picking 3D View selection "
"(without this the front most object may not be selected first)");
/* Audio */