Commit: 15a9579a03f1ca65df477a1a39dbaef572ff3e9f Author: Campbell Barton Date: Fri Oct 2 21:15:28 2020 +1000 Branches: master https://developer.blender.org/rB15a9579a03f1ca65df477a1a39dbaef572ff3e9f
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. =================================================================== M source/blender/blenloader/intern/readfile.c M source/blender/blenloader/intern/versioning_userdef.c =================================================================== 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)) { _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs