diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-09-18 18:40:02 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-09-18 18:40:02 +0400 |
commit | 8e93f017ac0200688b237161b6e2aa0fc1efcf58 (patch) | |
tree | 6471481ba752d3dcb0ea13c289530ce2098c4874 /source/blender/blenloader/intern | |
parent | 6d76f140d08ebd2a990989768d1b34127b2a3b8a (diff) |
do_version fix files with bad keyblock uid caused by byg [#31569]
Diffstat (limited to 'source/blender/blenloader/intern')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index a24e1256826..aa80a6bcff5 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2717,6 +2717,16 @@ static void direct_link_lamp(FileData *fd, Lamp *la) /* ************ READ keys ***************** */ +static void do_versions_key_uidgen(Key *key) +{ + KeyBlock *block; + + key->uidgen = 1; + for (block = key->block.first; block; block = block->next) { + block->uid = key->uidgen++; + } +} + static void lib_link_key(FileData *fd, Main *main) { Key *key; @@ -2724,12 +2734,7 @@ static void lib_link_key(FileData *fd, Main *main) for (key = main->key.first; key; key = key->id.next) { /*check if we need to generate unique ids for the shapekeys*/ if (!key->uidgen) { - KeyBlock *block; - - key->uidgen = 1; - for (block=key->block.first; block; block=block->next) { - block->uid = key->uidgen++; - } + do_versions_key_uidgen(key); } if (key->id.flag & LIB_NEED_LINK) { @@ -7974,6 +7979,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } + if (main->versionfile < 263 || (main->versionfile == 263 && main->subversionfile < 20)) { + Key *key; + for (key = main->key.first; key; key = key->id.next) { + do_versions_key_uidgen(key); + } + } + /* WATCH IT!!!: pointers from libdata have not been converted yet here! */ /* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */ |