Fix #146284: Missing Navigation Bar in Preferences
Follow up to !146169 - Add versioning so the new sidebar shows up in old files. - Remove the hidden flag so it shows up in new Preferences editors. - Add "Sidebar" toggle to the View menu, and expose region toggle. Pull Request: https://projects.blender.org/blender/blender/pulls/146321
This commit is contained in:
committed by
Pablo Vazquez
parent
084aefd0e0
commit
ae7f3a0d18
@@ -87,8 +87,12 @@ class USERPREF_MT_editor_menus(Menu):
|
||||
class USERPREF_MT_view(Menu):
|
||||
bl_label = "View"
|
||||
|
||||
def draw(self, _context):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
view = context.space_data
|
||||
|
||||
layout.prop(view, "show_region_ui")
|
||||
layout.separator()
|
||||
|
||||
layout.menu("INFO_MT_area")
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
/* Blender file format version. */
|
||||
#define BLENDER_FILE_VERSION BLENDER_VERSION
|
||||
#define BLENDER_FILE_SUBVERSION 83
|
||||
#define BLENDER_FILE_SUBVERSION 84
|
||||
|
||||
/* Minimum Blender version that supports reading file written with the current
|
||||
* version. Older Blender versions will test this and cancel loading the file, showing a warning to
|
||||
|
||||
@@ -3339,6 +3339,26 @@ void blo_do_versions_500(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
FOREACH_NODETREE_END;
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 500, 84)) {
|
||||
/* Add sidebar to the preferences editor. */
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
if (sl->spacetype == SPACE_USERPREF) {
|
||||
ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
|
||||
&sl->regionbase;
|
||||
ARegion *new_sidebar = do_versions_add_region_if_not_found(
|
||||
regionbase, RGN_TYPE_UI, "sidebar for preferences", RGN_TYPE_HEADER);
|
||||
if (new_sidebar != nullptr) {
|
||||
new_sidebar->alignment = RGN_ALIGN_LEFT;
|
||||
new_sidebar->flag &= ~RGN_FLAG_HIDDEN;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Always bump subversion in BKE_blender_version.h when adding versioning
|
||||
* code here, and wrap it inside a MAIN_VERSION_FILE_ATLEAST check.
|
||||
|
||||
@@ -53,6 +53,7 @@ static SpaceLink *userpref_create(const ScrArea *area, const Scene * /*scene*/)
|
||||
BLI_addtail(&spref->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_UI;
|
||||
region->alignment = RGN_ALIGN_LEFT;
|
||||
region->flag &= ~RGN_FLAG_HIDDEN;
|
||||
|
||||
/* Use smaller size when opened in area like properties editor. */
|
||||
if (area->winx && area->winx < 3.0f * UI_NAVIGATION_REGION_WIDTH * UI_SCALE_FAC) {
|
||||
|
||||
@@ -7708,6 +7708,8 @@ static void rna_def_space_userpref(BlenderRNA *brna)
|
||||
RNA_def_struct_sdna(srna, "SpaceUserPref");
|
||||
RNA_def_struct_ui_text(srna, "Space Preferences", "Blender preferences space data");
|
||||
|
||||
rna_def_space_generic_show_region_toggles(srna, (1 << RGN_TYPE_UI));
|
||||
|
||||
prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "filter_type");
|
||||
RNA_def_property_enum_items(prop, filter_type_items);
|
||||
|
||||
Reference in New Issue
Block a user