diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-18 22:13:22 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-19 07:53:38 +0300 |
commit | 9573bf432c4b06d940b4b38cc455826f47518884 (patch) | |
tree | 6e8d4136abfbbd953423b1b6948ab64f11187eee /source/blender/blenloader | |
parent | 638938e5a8c30c405c3b4e96ab4f78095003958b (diff) |
UI: move top-bar into the spaces header
Currently this is only in the 3D viewport however all spaces
that use the tool-system will have this region added.
D4680 by @brecht with own updates.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 523e0b3d340..e43553cd64f 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -591,17 +591,25 @@ static void do_versions_remove_region(ListBase *regionbase, int regiontype) } } -static ARegion *do_versions_find_region(ListBase *regionbase, int regiontype) +static ARegion *do_versions_find_region_or_null(ListBase *regionbase, int regiontype) { for (ARegion *ar = regionbase->first; ar; ar = ar->next) { if (ar->regiontype == regiontype) { return ar; } } - BLI_assert(!"Did not find expected region in versioning"); return NULL; } +static ARegion *do_versions_find_region(ListBase *regionbase, int regiontype) +{ + ARegion *ar = do_versions_find_region_or_null(regionbase, regiontype); + if (ar == NULL) { + BLI_assert(!"Did not find expected region in versioning"); + } + return ar; +} + static ARegion *do_versions_add_region(int regiontype, const char *name) { ARegion *ar = MEM_callocN(sizeof(ARegion), name); @@ -3130,6 +3138,27 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) } } + /* Keep un-versioned until we're finished adding space types. */ + { + 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; + /* All spaces that use tools must be eventually added. */ + if (ELEM(sl->spacetype, SPACE_VIEW3D, SPACE_IMAGE) && + (do_versions_find_region_or_null(regionbase, RGN_TYPE_TOOL_HEADER) == NULL)) { + /* Add tool header. */ + ARegion *ar = do_versions_add_region(RGN_TYPE_TOOL_HEADER, "tool header"); + ar->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; + + ARegion *ar_header = do_versions_find_region(regionbase, RGN_TYPE_HEADER); + BLI_insertlinkbefore(regionbase, ar_header, ar); + } + } + } + } + } + { if (!DNA_struct_elem_find(fd->filesdna, "bSplineIKConstraint", "short", "yScaleMode")) { for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) { |