GooEngine: Add Disable search on KeyPress option

This commit is contained in:
2024-01-12 14:12:13 +00:00
parent c29114ed9f
commit 7a29ed4f2e
6 changed files with 14 additions and 5 deletions
+1
View File
@@ -2602,6 +2602,7 @@ class USERPREF_PT_experimental_debugging(ExperimentalPanel, Panel):
({"property": "use_viewport_debug"}, None),
({"property": "use_eevee_debug"}, None),
({"property": "disable_material_icon"}, None),
({"property": "disable_search_on_keypress"}, None),
),
)
@@ -10784,7 +10784,7 @@ static int ui_handle_menu_event(bContext *C,
/* Menu search if space-bar or #MenuTypeFlag::SearchOnKeyPress. */
MenuType *mt = WM_menutype_find(menu->menu_idname, true);
if ((mt && bool(mt->flag & MenuTypeFlag::SearchOnKeyPress)) ||
if ((mt && bool(mt->flag & MenuTypeFlag::SearchOnKeyPress) && !bool(U.experimental.disable_search_on_keypress)) ||
event->type == EVT_SPACEKEY) {
if ((level != 0) && (but == nullptr || !menu->menu_idname[0])) {
/* Search parent if the child is open but not activated or not searchable. */
@@ -5970,7 +5970,7 @@ void UI_menutype_draw(bContext *C, MenuType *mt, uiLayout *layout)
}
uiBlock *block = uiLayoutGetBlock(layout);
if (bool(mt->flag & MenuTypeFlag::SearchOnKeyPress)) {
if (bool(mt->flag & MenuTypeFlag::SearchOnKeyPress) && !bool(U.experimental.disable_search_on_keypress)) {
UI_block_flag_enable(block, UI_BLOCK_NO_ACCELERATOR_KEYS);
}
if (mt->listener) {
@@ -626,7 +626,7 @@ static void ui_popup_menu_create_from_menutype(bContext *C,
STRNCPY(handle->menu_idname, mt->idname);
handle->can_refresh = true;
if (bool(mt->flag & MenuTypeFlag::SearchOnKeyPress)) {
if (bool(mt->flag & MenuTypeFlag::SearchOnKeyPress) && !bool(U.experimental.disable_search_on_keypress)) {
ED_workspace_status_text(C, TIP_("Type to search..."));
}
else if (mt->idname[0]) {
+2 -1
View File
@@ -697,6 +697,7 @@ typedef struct UserDef_Experimental {
char use_viewport_debug;
char use_all_linked_data_direct;
char disable_material_icon;
char disable_search_on_keypress;
char SANITIZE_AFTER_HERE;
/* The following options are automatically sanitized (set to 0)
* when the release cycle is not alpha. */
@@ -713,7 +714,7 @@ typedef struct UserDef_Experimental {
char use_shader_node_previews;
char use_extension_repos;
char _pad[1];
/* char _pad[0]; */
/** `makesdna` does not allow empty structs. */
} UserDef_Experimental;
@@ -7028,13 +7028,20 @@ static void rna_def_userdef_experimental(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "disable_material_icon", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "disable_material_icon", 1);
RNA_def_property_boolean_sdna(prop, nullptr, "disable_material_icon", 1);
RNA_def_property_ui_text(
prop,
"Disable Material Icon Rendering",
"If true, Material Preview Icons will NOT be rendered. "
"This can prevent stuttering from opening the material ID menu");
prop = RNA_def_property(srna, "disable_search_on_keypress", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, nullptr, "disable_search_on_keypress", 1);
RNA_def_property_ui_text(
prop,
"Disable Search On Key Press",
"Ignore menus tagged with Search On Key Press, and fallback to using accelerator keys instead");
prop = RNA_def_property(srna, "use_new_curves_tools", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, nullptr, "use_new_curves_tools", 1);