[Bf-blender-cvs] [6aaedc7] master: Refer to Task 43975: Deleting a Shapekey can break the relative pointers

Gaia Clary noreply at git.blender.org
Mon Mar 16 10:03:36 CET 2015


Commit: 6aaedc7cfd3e2efdeb1cf42e8c5c7a1c303e42d8
Author: Gaia Clary
Date:   Thu Mar 12 14:21:41 2015 +0100
Branches: master
https://developer.blender.org/rB6aaedc7cfd3e2efdeb1cf42e8c5c7a1c303e42d8

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

===================================================================

M	source/blender/editors/object/object_shapekey.c

===================================================================

diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c
index 3fe8c86..fb9687d 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--;




More information about the Bf-blender-cvs mailing list