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.
This commit is contained in:
Campbell Barton 2020-10-02 23:36:05 +10:00
parent e255040c77
commit b13459f9e5
8 changed files with 25 additions and 13 deletions

View File

@ -223,13 +223,13 @@ typedef void (*BLOExpandDoitCallback)(void *fdhandle, struct Main *mainvar, void
void BLO_main_expander(BLOExpandDoitCallback expand_doit_func);
void BLO_expand_main(void *fdhandle, struct Main *mainvar);
/* Update defaults in startup.blend & userprefs.blend, without having to save and embed it */
/**
* Update defaults in startup.blend, without having to save and embed it.
* \note defaults for preferences are stored in `userdef_default.c` and can be updated there.
*/
void BLO_update_defaults_startup_blend(struct Main *bmain, const char *app_template);
void BLO_update_defaults_workspace(struct WorkSpace *workspace, const char *app_template);
/* Version patch user preferences. */
void BLO_version_defaults_userpref_blend(struct UserDef *userdef);
/* Disable unwanted experimental feature settings on startup. */
void BLO_sanitize_experimental_features_userpref_blend(struct UserDef *userdef);

View File

@ -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)

View File

@ -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);

View File

@ -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.

View File

@ -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.

View File

@ -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"

View File

@ -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)

View File

@ -65,7 +65,7 @@
* - When loading old files that don't contain newly added struct members (these will be zeroed)
* to set their values use `versioning_{BLENDER_VERSION}.c` source files.
* - For startup file data, to update these defaults use
* #BLO_update_defaults_startup_blend & #BLO_version_defaults_userpref_blend.
* #BLO_update_defaults_startup_blend & #blo_do_versions_userdef.
*/
#include <limits.h>