diff options
author | Gaia Clary <gaia.clary@machinimatrix.org> | 2015-03-12 16:21:41 +0300 |
---|---|---|
committer | Gaia Clary <gaia.clary@machinimatrix.org> | 2015-03-16 12:03:23 +0300 |
commit | 6aaedc7cfd3e2efdeb1cf42e8c5c7a1c303e42d8 (patch) | |
tree | 4f9f9894141b22d34b66f93224b73613ada681a2 /source/blender/editors/object | |
parent | 60df4d10ffb6409e9c386951e5813b0dc37d4781 (diff) |
Refer to Task 43975: Deleting a Shapekey can break the relative pointers
This patch would reassign the relative of all keyblocks to the relative
of the deleted keyblock. And it fixes the misalignement of the index values
after the keyblock is deleted.
Reviewers: campbellbarton
Differential Revision: https://developer.blender.org/D1176
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/object_shapekey.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c index 3fe8c86ef5c..fb9687da6df 100644 --- a/source/blender/editors/object/object_shapekey.c +++ b/source/blender/editors/object/object_shapekey.c @@ -120,9 +120,16 @@ static bool ED_object_shape_key_remove(Main *bmain, Object *ob) kb = BLI_findlink(&key->block, ob->shapenr - 1); if (kb) { - for (rkb = key->block.first; rkb; rkb = rkb->next) - if (rkb->relative == ob->shapenr - 1) + for (rkb = key->block.first; rkb; rkb = rkb->next) { + if (rkb->relative == ob->shapenr - 1) { + /* remap to the 'Basis' */ rkb->relative = 0; + } + else if (rkb->relative >= ob->shapenr) { + /* Fix positional shift of the keys when kb is deleted from the list */ + rkb->relative -= 1; + } + } BLI_remlink(&key->block, kb); key->totkey--; |