diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-10-02 14:15:28 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-10-03 00:25:36 +0300 |
commit | 15a9579a03f1ca65df477a1a39dbaef572ff3e9f (patch) | |
tree | db364b3cc4f93811dc7f2f9b3897c67aa3e38219 /source/blender | |
parent | a03bd6460c130b06debfd583252c78d8b8ae73fb (diff) |
Cleanup: centralize versioning
readfile.c's versioning function was only used for 2 variables.
Move versioning into versioning_userdef.c so everything
is done in one function.
Note: DNA_struct_elem_find checks have been replaced with checks for
the next released version.
This is harmless, as only old preferences saved between releases can
have their values overwritten.
Note: userdef versioning should be called from `do_versions_userdef`,
this will be done separately.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 14 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_userdef.c | 13 |
2 files changed, 10 insertions, 17 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 0b247d9a249..c9e279f7588 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -6892,20 +6892,6 @@ static void do_versions_userdef(FileData *fd, BlendFileData *bfd) if (user == NULL) { return; } - - if (!DNA_struct_elem_find(fd->filesdna, "UserDef", "WalkNavigation", "walk_navigation")) { - user->walk_navigation.mouse_speed = 1.0f; - user->walk_navigation.walk_speed = 2.5f; /* m/s */ - user->walk_navigation.walk_speed_factor = 5.0f; - user->walk_navigation.view_height = 1.6f; /* m */ - user->walk_navigation.jump_height = 0.4f; /* m */ - user->walk_navigation.teleport_time = 0.2f; /* s */ - } - - /* tablet pressure threshold */ - if (!DNA_struct_elem_find(fd->filesdna, "UserDef", "float", "pressure_threshold_max")) { - user->pressure_threshold_max = 1.0f; - } } static void do_versions(FileData *fd, Library *lib, Main *main) diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c index ded371aa2d8..da0dd486646 100644 --- a/source/blender/blenloader/intern/versioning_userdef.c +++ b/source/blender/blenloader/intern/versioning_userdef.c @@ -528,9 +528,14 @@ void BLO_version_defaults_userpref_blend(UserDef *userdef) } } - /* NOTE!! from now on use userdef->versionfile and userdef->subversionfile */ -#undef USER_VERSION_ATLEAST -#define USER_VERSION_ATLEAST(ver, subver) MAIN_VERSION_ATLEAST(userdef, ver, subver) + if (!USER_VERSION_ATLEAST(269, 4)) { + userdef->walk_navigation.mouse_speed = 1.0f; + userdef->walk_navigation.walk_speed = 2.5f; /* m/s */ + userdef->walk_navigation.walk_speed_factor = 5.0f; + userdef->walk_navigation.view_height = 1.6f; /* m */ + userdef->walk_navigation.jump_height = 0.4f; /* m */ + userdef->walk_navigation.teleport_time = 0.2f; /* s */ + } if (!USER_VERSION_ATLEAST(271, 5)) { userdef->pie_menu_radius = 100; @@ -599,6 +604,8 @@ void BLO_version_defaults_userpref_blend(UserDef *userdef) if (!USER_VERSION_ATLEAST(280, 33)) { /* Enable GLTF addon by default. */ BKE_addon_ensure(&userdef->addons, "io_scene_gltf2"); + + userdef->pressure_threshold_max = 1.0f; } if (!USER_VERSION_ATLEAST(280, 35)) { |