diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-04-23 04:46:52 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-04-23 04:46:52 +0300 |
commit | c3accabef9097c2657e9407c2ef9c9d994c008c3 (patch) | |
tree | 54dc4473c5cb93f12b09d794572445f316591ae8 /source/blender/blenloader/intern/versioning_280.c | |
parent | c632396733ab5b9e338cb532501cc84d19cc67c2 (diff) |
Fix invalid rigid body constraint values during 2.83 development
Own error in cleanup from 5dcb6fb22f3f unintentionally
changed enum values. Although this code violated our own
rules to use explicit values to avoid this happening.
Diffstat (limited to 'source/blender/blenloader/intern/versioning_280.c')
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 52 |
1 files changed, 39 insertions, 13 deletions
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index b90413aa5ca..329767ef202 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -4998,19 +4998,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) } } - /** - * Versioning code until next subversion bump goes here. - * - * \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", #do_versions_theme - * - * \note Keep this message at the bottom of the function. - */ - { - /* Keep this block, even when empty. */ - + if (!MAIN_VERSION_ATLEAST(bmain, 283, 14)) { /* Solidify modifier merge tolerance. */ if (!DNA_struct_elem_find(fd->filesdna, "SolidifyModifierData", "float", "merge_tolerance")) { for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) { @@ -5023,5 +5011,43 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) } } } + + /* Enumerator was incorrect for a time in 2.83 development. + * Note that this only corrects values known to be invalid. */ + for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) { + RigidBodyCon *rbc = ob->rigidbody_constraint; + if (rbc != NULL) { + enum { + INVALID_RBC_TYPE_SLIDER = 2, + INVALID_RBC_TYPE_6DOF_SPRING = 4, + INVALID_RBC_TYPE_MOTOR = 7, + }; + switch (rbc->type) { + case INVALID_RBC_TYPE_SLIDER: + rbc->type = RBC_TYPE_SLIDER; + break; + case INVALID_RBC_TYPE_6DOF_SPRING: + rbc->type = RBC_TYPE_6DOF_SPRING; + break; + case INVALID_RBC_TYPE_MOTOR: + rbc->type = RBC_TYPE_MOTOR; + break; + } + } + } + } + + /** + * Versioning code until next subversion bump goes here. + * + * \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", #do_versions_theme + * + * \note Keep this message at the bottom of the function. + */ + { + /* Keep this block, even when empty. */ } } |