UI: Hide asset shelf by default

Only the pose library enables the asset shelf by default, but Blender
doesn't come with pose assets, they have to be created by the user. So
when entering pose mode with factory settings, the asset shelf will
currently be just a big empty bar. Plus, pose mode is used for posing
without pose assets quite a lot. So hide the asset shelf by default. The
pose library already shows a toggle to hide/unhide it where the previous
pose library UI was for discoverability.
This commit is contained in:
Julian Eisel
2023-09-27 11:52:02 +02:00
parent 2f1b8f59e3
commit 04d22d73f3
2 changed files with 26 additions and 27 deletions

View File

@@ -29,7 +29,7 @@ extern "C" {
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
#define BLENDER_FILE_SUBVERSION 27
#define BLENDER_FILE_SUBVERSION 28
/* 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

View File

@@ -1521,6 +1521,31 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
}
}
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 400, 28)) {
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
const ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
&sl->regionbase;
LISTBASE_FOREACH (ARegion *, region, regionbase) {
if (region->regiontype != RGN_TYPE_ASSET_SHELF) {
continue;
}
RegionAssetShelf *shelf_data = static_cast<RegionAssetShelf *>(region->regiondata);
if (shelf_data && shelf_data->active_shelf) {
AssetShelfSettings &settings = shelf_data->active_shelf->settings;
settings.asset_library_reference.custom_library_index = -1;
settings.asset_library_reference.type = ASSET_LIBRARY_ALL;
}
region->flag |= RGN_FLAG_HIDDEN;
}
}
}
}
}
/**
* Versioning code until next subversion bump goes here.
*
@@ -1533,31 +1558,5 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
*/
{
/* Keep this block, even when empty. */
if (!DNA_struct_member_exists(fd->filesdna,
"AssetShelfSettings",
"AssetLibraryReference",
"asset_library_reference"))
{
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
const ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
&sl->regionbase;
LISTBASE_FOREACH (ARegion *, region, regionbase) {
if (region->regiontype != RGN_TYPE_ASSET_SHELF) {
continue;
}
RegionAssetShelf *shelf_data = static_cast<RegionAssetShelf *>(region->regiondata);
if (shelf_data && shelf_data->active_shelf) {
AssetShelfSettings &settings = shelf_data->active_shelf->settings;
settings.asset_library_reference.custom_library_index = -1;
settings.asset_library_reference.type = ASSET_LIBRARY_ALL;
}
}
}
}
}
}
}
}