From 9573bf432c4b06d940b4b38cc455826f47518884 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 18 Apr 2019 21:13:22 +0200 Subject: 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. --- source/blender/blenloader/intern/versioning_280.c | 33 +++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'source/blender/blenloader') 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) { -- cgit v1.2.3