diff options
author | Joshua Leung <aligorith@gmail.com> | 2011-01-03 14:58:19 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2011-01-03 14:58:19 +0300 |
commit | f7857ec81b960b361c81d6619dfaf28f4e8d7ae0 (patch) | |
tree | 6bf4886af55eb8f9acb5a7bdbb7d9440b11228b2 /source/blender/blenloader | |
parent | e7ed8a3be09bb2f30d03e28410cb42099ebfb940 (diff) |
2.4x <-> 2.5 Regression Fixes: Shapekey Problems
This commit partially fixes the problems with Shapekeys from older
files, as seen from the Regression suite (relative.blend and
dolphin.blend in particular).
In older files, keyblock->slidermax was never truly set to 1.0 even
though the UI may have shown such a value (which was bizzarely being
sourced from somewhere else). Hence, after loading the files in 2.5,
the shapekeys wouldn't animate, as the value would get clamped between
0 and 0.
To fix this, I've added a version patch which corrects these
situations in old files, and I've adjusted the slider-RNA code so that
it is not possible to set up such clamping anymore.
TODO:
The fixes detailed here only make it possible for these files to work
again in 2.5. However, I haven't been able to find a way to get the
files to actually work in 2.5 without manually changing the active
shapekey (per object) after loading the files with these patches
applied. Possibly it's just some depsgraph magic needed, unless
there's still some other evil voodoo in the shapekey code
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index b4dfcdfb186..b475050878a 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2456,7 +2456,7 @@ static void direct_link_key(FileData *fd, Key *key) while(kb) { kb->data= newdataadr(fd, kb->data); - + if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) switch_endian_keyblock(key, kb); @@ -11226,6 +11226,20 @@ static void do_versions(FileData *fd, Library *lib, Main *main) /* put compatibility code here until next subversion bump */ { + Key *key; + + /* old files could have been saved with slidermin = slidermax = 0.0, but the UI in + * 2.4x would never reveal this to users as a dummy value always ended up getting used + * instead + */ + for (key = main->key.first; key; key = key->id.next) { + KeyBlock *kb; + + for (kb = key->block.first; kb; kb = kb->next) { + if (IS_EQ(kb->slidermin, kb->slidermax) && IS_EQ(kb->slidermax, 0)) + kb->slidermax = kb->slidermin + 1.0f; + } + } } /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ |