diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2019-09-20 16:35:28 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2019-09-20 16:35:28 +0300 |
commit | b20182e334180d751acff4565d2cf061dcb90add (patch) | |
tree | de1e3124d21cc98fce6b46773aff8d2e5c8249b9 /source/blender/blenloader | |
parent | d1cc340e56691cb82e444289415ede24ba4d2bc0 (diff) |
Refactor: Ensure there's always a valid file editor tool region
So far the file browser code had some lazy creation for the tool region,
even though it should always be there. The only reason I can see for
this is compatiblity. So I simply added versioning code to add the
region in case it's not there. Now we should be able to savely assume
the tool region to be there, whithout any unusual lazy-creation.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 477a93f9858..257f43f4b9f 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -3877,6 +3877,17 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) } } } + else if (sl->spacetype == SPACE_FILE) { + ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase; + + if (!do_versions_find_region_or_null(regionbase, RGN_TYPE_TOOLS)) { + ARegion *ar_ui = do_versions_find_region(regionbase, RGN_TYPE_UI); + ARegion *ar_tools = do_versions_add_region(RGN_TYPE_TOOLS, + "versioning file tools region"); + BLI_insertlinkafter(regionbase, ar_ui, ar_tools); + ar_tools->alignment = RGN_ALIGN_LEFT; + } + } } } } |