UI: Hide datablocks with dot-prefixed names by default

Currently, it's possible to hide datablocks whose names start with '.'
by disabling 'Show Hidden Files/Data-Blocks'. However, this parameter is
under 'Save & Load' and is meant for filtering IDs when
linking/appending.

The PR introduces a new parameter 'Show Hidden' under the existing
Interface / Display / Search layout that only affects searching.
The new parameter is disabled by default

Ref: https://projects.blender.org/blender/blender/issues/148717
Pull Request: https://projects.blender.org/blender/blender/pulls/151903
This commit is contained in:
Habib Gahbiche 2026-01-14 15:28:26 +01:00
parent 6e544314a6
commit 81f2113c71
6 changed files with 15 additions and 3 deletions

View file

@ -312,7 +312,7 @@ class NodeMenu(Menu):
from nodeitems_builtins import node_tree_group_type
prefs = bpy.context.preferences
show_hidden = prefs.filepaths.show_hidden_files_datablocks
show_hidden = prefs.show_hidden_ids
groups = [
group for group in context.blend_data.node_groups

View file

@ -233,6 +233,7 @@ class USERPREF_PT_interface_display(InterfacePanel, CenterAlignMixIn, Panel):
col = layout.column(heading="Search", align=True)
col.prop(prefs, "use_recent_searches", text="Sort by Most Recent")
col.prop(prefs, "show_hidden_ids", text="Show Hidden")
class USERPREF_PT_interface_text(InterfacePanel, CenterAlignMixIn, Panel):

View file

@ -1732,6 +1732,10 @@ void blo_do_versions_userdef(UserDef *userdef)
userdef, "NODE_AST_compositor", "Utilities");
}
if (!USER_VERSION_ATLEAST(510, 17)) {
userdef->flag |= USER_HIDE_DOT_DATABLOCK;
}
/**
* Always bump subversion in BKE_blender_version.h when adding versioning
* code here, and wrap it inside a USER_VERSION_ATLEAST check.

View file

@ -91,7 +91,7 @@ static bool id_search_allows_id(TemplateID *template_ui, const int flag, ID *id,
}
/* Hide dot prefixed data-blocks, but only if filter does not force them visible. */
if (U.uiflag & USER_HIDE_DOT) {
if (U.flag & USER_HIDE_DOT_DATABLOCK) {
if ((id->name[2] == '.') && (query[0] != '.')) {
return false;
}

View file

@ -57,6 +57,7 @@ enum eUserPref_Flag {
USER_TXT_TABSTOSPACES_DISABLE = (1 << 25),
USER_TOOLTIPS_PYTHON = (1 << 26),
USER_FLAG_UNUSED_27 = (1 << 27), /* dirty */
USER_HIDE_DOT_DATABLOCK = (1 << 28),
};
/** #UserDef.extension_flag */
@ -855,7 +856,8 @@ struct UserDef {
/** #eUserPref_Flag. */
int flag = (USER_AUTOSAVE | USER_TOOLTIPS | USER_RELPATHS | USER_RELEASECONFIRM |
USER_SCRIPT_AUTOEXEC_DISABLE | USER_NONEGFRAMES | USER_FILECOMPRESS);
USER_SCRIPT_AUTOEXEC_DISABLE | USER_NONEGFRAMES | USER_FILECOMPRESS |
USER_HIDE_DOT_DATABLOCK);
/** #eDupli_ID_Flags. */
unsigned int dupflag = USER_DUP_MESH | USER_DUP_CURVE | USER_DUP_SURF | USER_DUP_LATTICE |
USER_DUP_FONT | USER_DUP_MBALL | USER_DUP_LAMP | USER_DUP_ARM |

View file

@ -7616,6 +7616,11 @@ void RNA_def_userdef(BlenderRNA *brna)
RNA_def_property_boolean_negative_sdna(prop, nullptr, "flag", USER_FLAG_RECENT_SEARCHES_DISABLE);
RNA_def_property_ui_text(prop, "Recent Searches", "Sort the recently searched items at the top");
prop = RNA_def_property(srna, "show_hidden_ids", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, nullptr, "flag", USER_HIDE_DOT_DATABLOCK);
RNA_def_property_ui_text(
prop, "Show Hidden", "Show data-blocks with dot-prefixed names in search menus");
/* nested structs */
prop = RNA_def_property(srna, "view", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);