diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index a76a72d7910..c0a63e9f901 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -29,7 +29,7 @@ extern "C" { /* Blender file format version. */ #define BLENDER_FILE_VERSION BLENDER_VERSION -#define BLENDER_FILE_SUBVERSION 11 +#define BLENDER_FILE_SUBVERSION 12 /* 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 diff --git a/source/blender/blenloader/intern/versioning_400.cc b/source/blender/blenloader/intern/versioning_400.cc index d40bfac27cd..0c272428902 100644 --- a/source/blender/blenloader/intern/versioning_400.cc +++ b/source/blender/blenloader/intern/versioning_400.cc @@ -436,19 +436,7 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain) version_vertex_weight_edit_preserve_threshold_exclusivity(bmain); } - /** - * Versioning code until next subversion bump goes here. - * - * \note Be sure to check when bumping the version: - * - #do_versions_after_linking_400 in this file. - * - "versioning_userdef.c", #blo_do_versions_userdef - * - "versioning_userdef.c", #do_versions_theme - * - * \note Keep this message at the bottom of the function. - */ - { - /* Keep this block, even when empty. */ - + if (!MAIN_VERSION_FILE_ATLEAST(bmain, 400, 12)) { if (!DNA_struct_elem_find(fd->filesdna, "LightProbe", "int", "grid_bake_samples")) { LISTBASE_FOREACH (LightProbe *, lightprobe, &bmain->lightprobes) { lightprobe->grid_bake_samples = 2048; @@ -498,5 +486,36 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain) } } FOREACH_NODETREE_END; + + LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) { + LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { + LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) { + ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase : + &sl->regionbase; + + /* Layout based regions used to also disallow resizing, now these are separate flags. + * Make sure they are set together for old regions. */ + LISTBASE_FOREACH (ARegion *, region, regionbase) { + if (region->flag & RGN_FLAG_DYNAMIC_SIZE) { + region->flag |= RGN_FLAG_NO_USER_RESIZE; + } + } + } + } + } + } + + /** + * Versioning code until next subversion bump goes here. + * + * \note Be sure to check when bumping the version: + * - #do_versions_after_linking_400 in this file. + * - "versioning_userdef.c", #blo_do_versions_userdef + * - "versioning_userdef.c", #do_versions_theme + * + * \note Keep this message at the bottom of the function. + */ + { + /* Keep this block, even when empty. */ } } diff --git a/source/blender/blenloader/intern/versioning_userdef.cc b/source/blender/blenloader/intern/versioning_userdef.cc index 133e4409879..7786923ebd0 100644 --- a/source/blender/blenloader/intern/versioning_userdef.cc +++ b/source/blender/blenloader/intern/versioning_userdef.cc @@ -105,6 +105,11 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme) FROM_DEFAULT_V4_UCHAR(space_node.node_zone_simulation); FROM_DEFAULT_V4_UCHAR(space_action.simulated_frames); } + + if (!USER_VERSION_ATLEAST(400, 12)) { + FROM_DEFAULT_V4_UCHAR(space_node.node_zone_repeat); + } + /** * Versioning code until next subversion bump goes here. * @@ -116,7 +121,6 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme) */ { /* Keep this block, even when empty. */ - FROM_DEFAULT_V4_UCHAR(space_node.node_zone_repeat); } #undef FROM_DEFAULT_V4_UCHAR @@ -830,6 +834,15 @@ void blo_do_versions_userdef(UserDef *userdef) BKE_addon_remove_safe(&userdef->addons, "io_scene_obj"); } + if (!USER_VERSION_ATLEAST(400, 12)) { +#ifdef __APPLE__ + /* Drop OpenGL support on MAC devices as they don't support OpenGL 4.3. */ + if (userdef->gpu_backend == GPU_BACKEND_OPENGL) { + userdef->gpu_backend = GPU_BACKEND_METAL; + } +#endif + } + /** * Versioning code until next subversion bump goes here. * @@ -841,13 +854,6 @@ void blo_do_versions_userdef(UserDef *userdef) */ { /* Keep this block, even when empty. */ - -#ifdef __APPLE__ - /* Drop OpenGL support on MAC devices as they don't support OpenGL 4.3. */ - if (userdef->gpu_backend == GPU_BACKEND_OPENGL) { - userdef->gpu_backend = GPU_BACKEND_METAL; - } -#endif } LISTBASE_FOREACH (bTheme *, btheme, &userdef->themes) { diff --git a/source/blender/editors/screen/area.cc b/source/blender/editors/screen/area.cc index 6b7b9244907..2a3a742a4ee 100644 --- a/source/blender/editors/screen/area.cc +++ b/source/blender/editors/screen/area.cc @@ -1345,8 +1345,8 @@ static void region_rect_recursive( alignment = RGN_ALIGN_NONE; } - /* If both the #ARegion.sizex/y and the #ARegionType.prefsizex/y are 0, - * the region is tagged as too small, even before the layout for dynamic regions is created. + /* If both the #ARegion.sizex/y and the #ARegionType.prefsizex/y are 0, the region is tagged as + * too small, even before the layout for dynamically sized regions is created. * #wm_draw_window_offscreen() allows the layout to be created despite the #RGN_FLAG_TOO_SMALL * flag being set. But there may still be regions that don't have a separate #ARegionType.layout * callback. For those, set a default #ARegionType.prefsizex/y so they can become visible. */ @@ -1364,11 +1364,7 @@ static void region_rect_recursive( ((region->sizex > 1) ? region->sizex + 0.5f : region->type->prefsizex); int prefsizey; - if (region->flag & RGN_FLAG_PREFSIZE_OR_HIDDEN) { - prefsizex = UI_SCALE_FAC * region->type->prefsizex; - prefsizey = UI_SCALE_FAC * region->type->prefsizey; - } - else if (region->regiontype == RGN_TYPE_HEADER) { + if (region->regiontype == RGN_TYPE_HEADER) { prefsizey = ED_area_headersize(); } else if (region->regiontype == RGN_TYPE_TOOL_HEADER) { diff --git a/source/blender/editors/screen/screen_ops.cc b/source/blender/editors/screen/screen_ops.cc index 47e1c459a65..13ebd6f725e 100644 --- a/source/blender/editors/screen/screen_ops.cc +++ b/source/blender/editors/screen/screen_ops.cc @@ -2871,7 +2871,7 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event) else if (rmd->region->flag & RGN_FLAG_HIDDEN) { region_scale_toggle_hidden(C, rmd); } - else if (rmd->region->flag & RGN_FLAG_DYNAMIC_SIZE) { + else if (rmd->region->flag & RGN_FLAG_NO_USER_RESIZE) { rmd->region->sizex = rmd->origval; } } @@ -2913,7 +2913,7 @@ static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event) else if (rmd->region->flag & RGN_FLAG_HIDDEN) { region_scale_toggle_hidden(C, rmd); } - else if (rmd->region->flag & RGN_FLAG_DYNAMIC_SIZE) { + else if (rmd->region->flag & RGN_FLAG_NO_USER_RESIZE) { rmd->region->sizey = rmd->origval; } } diff --git a/source/blender/editors/space_buttons/space_buttons.cc b/source/blender/editors/space_buttons/space_buttons.cc index 4a83aeae3bf..6a5c5d4873b 100644 --- a/source/blender/editors/space_buttons/space_buttons.cc +++ b/source/blender/editors/space_buttons/space_buttons.cc @@ -593,7 +593,7 @@ static void buttons_header_region_message_subscribe(const wmRegionMessageSubscri static void buttons_navigation_bar_region_init(wmWindowManager *wm, ARegion *region) { - region->flag |= RGN_FLAG_PREFSIZE_OR_HIDDEN; + region->flag |= RGN_FLAG_NO_USER_RESIZE; ED_region_panels_init(wm, region); region->v2d.keepzoom |= V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y; diff --git a/source/blender/editors/space_file/space_file.cc b/source/blender/editors/space_file/space_file.cc index c057779bebc..596f4b9d882 100644 --- a/source/blender/editors/space_file/space_file.cc +++ b/source/blender/editors/space_file/space_file.cc @@ -79,14 +79,14 @@ static SpaceLink *file_create(const ScrArea * /*area*/, const Scene * /*scene*/) BLI_addtail(&sfile->regionbase, region); region->regiontype = RGN_TYPE_UI; region->alignment = RGN_ALIGN_TOP; - region->flag = RGN_FLAG_DYNAMIC_SIZE; + region->flag = RGN_FLAG_DYNAMIC_SIZE | RGN_FLAG_NO_USER_RESIZE; /* execute region */ region = static_cast(MEM_callocN(sizeof(ARegion), "execute region for file")); BLI_addtail(&sfile->regionbase, region); region->regiontype = RGN_TYPE_EXECUTE; region->alignment = RGN_ALIGN_BOTTOM; - region->flag = RGN_FLAG_DYNAMIC_SIZE; + region->flag = RGN_FLAG_DYNAMIC_SIZE | RGN_FLAG_NO_USER_RESIZE; /* tools props region */ region = static_cast(MEM_callocN(sizeof(ARegion), "tool props for file")); diff --git a/source/blender/editors/space_userpref/space_userpref.cc b/source/blender/editors/space_userpref/space_userpref.cc index 49d7c30ae88..ae501e10724 100644 --- a/source/blender/editors/space_userpref/space_userpref.cc +++ b/source/blender/editors/space_userpref/space_userpref.cc @@ -66,7 +66,7 @@ static SpaceLink *userpref_create(const ScrArea *area, const Scene * /*scene*/) BLI_addtail(&spref->regionbase, region); region->regiontype = RGN_TYPE_EXECUTE; region->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV; - region->flag |= RGN_FLAG_DYNAMIC_SIZE; + region->flag |= RGN_FLAG_DYNAMIC_SIZE | RGN_FLAG_NO_USER_RESIZE; /* main region */ region = static_cast(MEM_callocN(sizeof(ARegion), "main region for userpref")); diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h index cef47df1653..a7a2ee7e2a5 100644 --- a/source/blender/makesdna/DNA_screen_types.h +++ b/source/blender/makesdna/DNA_screen_types.h @@ -713,16 +713,13 @@ enum { enum { RGN_FLAG_HIDDEN = (1 << 0), RGN_FLAG_TOO_SMALL = (1 << 1), - /** - * Force delayed re-initialization of region size data, so that region size is calculated - * just big enough to show all its content (if enough space is available). - * Note that only ED_region_header supports this right now. - */ + /** Enable dynamically changing the region size in the #ARegionType::layout() callback. */ RGN_FLAG_DYNAMIC_SIZE = (1 << 2), /** Region data is NULL'd on read, never written. */ RGN_FLAG_TEMP_REGIONDATA = (1 << 3), - /** The region must either use its prefsizex/y or be hidden. */ - RGN_FLAG_PREFSIZE_OR_HIDDEN = (1 << 4), + /** Region resizing by the user is disabled, but the region edge can still be dragged to + * hide/unhide the region. */ + RGN_FLAG_NO_USER_RESIZE = (1 << 4), /** Size has been clamped (floating regions only). */ RGN_FLAG_SIZE_CLAMP_X = (1 << 5), RGN_FLAG_SIZE_CLAMP_Y = (1 << 6),