From b13459f9e585bcb0e4ba61e391e59a888f5042f2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 2 Oct 2020 23:36:05 +1000 Subject: Cleanup: rename main preferences versioning function BLO_version_defaults_userpref_blend -> blo_do_versions_userdef The name was misleading as it was declared along with BLO_update_defaults_startup_blend making it seem these functions were related. In fact preference defaults don't need to be updated as is done for startup.blend since an in-memory blend file isn't used. Rename the function to match other versioning functions called from readfile.c. Also add/update comments on these differences. --- source/blender/blenloader/intern/readfile.c | 2 +- source/blender/blenloader/intern/readfile.h | 3 +++ source/blender/blenloader/intern/versioning_280.c | 4 ++-- source/blender/blenloader/intern/versioning_290.c | 4 ++-- source/blender/blenloader/intern/versioning_defaults.c | 7 +++++++ source/blender/blenloader/intern/versioning_userdef.c | 8 +++++--- 6 files changed, 20 insertions(+), 8 deletions(-) (limited to 'source/blender/blenloader/intern') diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 2ea4206bab3..cf2181c8a27 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -6891,7 +6891,7 @@ static void do_versions_userdef(FileData *UNUSED(fd), BlendFileData *bfd) return; } - BLO_version_defaults_userpref_blend(user); + blo_do_versions_userdef(user); } static void do_versions(FileData *fd, Library *lib, Main *main) diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h index d3372a646a9..4fa41731454 100644 --- a/source/blender/blenloader/intern/readfile.h +++ b/source/blender/blenloader/intern/readfile.h @@ -42,6 +42,7 @@ struct Object; struct OldNewMap; struct PartEff; struct ReportList; +struct UserDef; struct View3D; typedef struct IDNameLib_Map IDNameLib_Map; @@ -189,6 +190,8 @@ void blo_do_version_old_trackto_to_constraints(struct Object *ob); void blo_do_versions_view3d_split_250(struct View3D *v3d, struct ListBase *regions); void blo_do_versions_key_uidgen(struct Key *key); +void blo_do_versions_userdef(struct UserDef *userdef); + void blo_do_versions_pre250(struct FileData *fd, struct Library *lib, struct Main *bmain); void blo_do_versions_250(struct FileData *fd, struct Library *lib, struct Main *bmain); void blo_do_versions_260(struct FileData *fd, struct Library *lib, struct Main *bmain); diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index b7c48234590..ad6066647d6 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -1747,7 +1747,7 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports)) * * \note Be sure to check when bumping the version: * - #blo_do_versions_280 in this file. - * - "versioning_userdef.c", #BLO_version_defaults_userpref_blend + * - "versioning_userdef.c", #blo_do_versions_userdef * - "versioning_userdef.c", #do_versions_theme * * \note Keep this message at the bottom of the function. @@ -5092,7 +5092,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) * * \note Be sure to check when bumping the version: * - #do_versions_after_linking_280 in this file. - * - "versioning_userdef.c", #BLO_version_defaults_userpref_blend + * - "versioning_userdef.c", #blo_do_versions_userdef * - "versioning_userdef.c", #do_versions_theme * * \note Keep this message at the bottom of the function. diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index 48ae5963da8..b9153307d70 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -234,7 +234,7 @@ void do_versions_after_linking_290(Main *bmain, ReportList *UNUSED(reports)) * * \note Be sure to check when bumping the version: * - #blo_do_versions_290 in this file. - * - "versioning_userdef.c", #BLO_version_defaults_userpref_blend + * - "versioning_userdef.c", #blo_do_versions_userdef * - "versioning_userdef.c", #do_versions_theme * * \note Keep this message at the bottom of the function. @@ -773,7 +773,7 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) * Versioning code until next subversion bump goes here. * * \note Be sure to check when bumping the version: - * - "versioning_userdef.c", #BLO_version_defaults_userpref_blend + * - "versioning_userdef.c", #blo_do_versions_userdef * - "versioning_userdef.c", #do_versions_theme * * \note Keep this message at the bottom of the function. diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c index b4bee9a3c7e..9ae02a41759 100644 --- a/source/blender/blenloader/intern/versioning_defaults.c +++ b/source/blender/blenloader/intern/versioning_defaults.c @@ -16,6 +16,13 @@ /** \file * \ingroup blenloader + * + * This file handles updating the `startup.blend`, this is used when reading old files. + * + * Unlike regular versioning this makes changes that ensure the startup file + * has brushes and other presets setup to take advantage of newer features. + * + * To update preference defaults see `userdef_default.c`. */ #include "MEM_guardedalloc.h" diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c index da0dd486646..04302935deb 100644 --- a/source/blender/blenloader/intern/versioning_userdef.c +++ b/source/blender/blenloader/intern/versioning_userdef.c @@ -44,7 +44,9 @@ #include "BKE_keyconfig.h" #include "BKE_main.h" -#include "BLO_readfile.h" /* Own include. */ +#include "BLO_readfile.h" + +#include "readfile.h" /* Own include. */ #include "wm_event_types.h" @@ -244,7 +246,7 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme) * Versioning code until next subversion bump goes here. * * \note Be sure to check when bumping the version: - * - #BLO_version_defaults_userpref_blend in this file. + * - #blo_do_versions_userdef in this file. * - "versioning_{BLENDER_VERSION}.c" * * \note Keep this message at the bottom of the function. @@ -303,7 +305,7 @@ static bool keymap_item_has_invalid_wm_context_data_path(wmKeyMapItem *kmi, } /* patching UserDef struct and Themes */ -void BLO_version_defaults_userpref_blend(UserDef *userdef) +void blo_do_versions_userdef(UserDef *userdef) { /* #UserDef & #Main happen to have the same struct member. */ #define USER_VERSION_ATLEAST(ver, subver) MAIN_VERSION_ATLEAST(userdef, ver, subver) -- cgit v1.2.3