Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <eiseljulian@gmail.com>2020-01-16 19:24:28 +0300
committerJulian Eisel <eiseljulian@gmail.com>2020-01-16 19:28:39 +0300
commit3cd1c8ccffec516c6ecb6c048dc3aba07d3ad6e5 (patch)
tree0be966a6e56fdc7526054fbc8013b4d3103a322b /source/blender/blenloader
parent09122883b2a198351e4234546230cd03f6d89718 (diff)
Fix failing asserts in versioning with some pre 2.5 files
Old pre 2.5 files may have had non active spaces stored that doen't have a header. The 2.5 versioning only added headers for active spaces, not inactive (so invisible) ones. Newer versioning code assumed there to always be a header though. Inserted a version patch to make sure there's always a header now. Fixes error reported to Debian, https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=949035.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/versioning_280.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 6d4dd98729a..e746bbf1800 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -2828,6 +2828,35 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
+ /* Files stored pre 2.5 (possibly re-saved with newer versions) may have non-visible
+ * spaces without a header (visible/active ones are properly versioned).
+ * Multiple version patches below assume there's always a header though. So inserting this
+ * patch in-between older ones to add a header when needed.
+ *
+ * From here on it should be fine to assume there always is a header.
+ */
+ if (!MAIN_VERSION_ATLEAST(bmain, 283, 1)) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+ for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+ for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+ ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
+ ARegion *ar_header = do_versions_find_region_or_null(regionbase, RGN_TYPE_HEADER);
+
+ if (!ar_header) {
+ /* Headers should always be first in the region list, except if there's also a
+ * tool-header. These were only introduced in later versions though, so should be
+ * fine to always insert headers first. */
+ BLI_assert(!do_versions_find_region_or_null(regionbase, RGN_TYPE_TOOL_HEADER));
+
+ ARegion *ar = do_versions_add_region(RGN_TYPE_HEADER, "footer for text");
+ ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
+ BLI_addhead(regionbase, ar);
+ }
+ }
+ }
+ }
+ }
+
for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {