[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26956] trunk/blender/source/blender/ editors/object/object_shapekey.c: bugfix [#20938] Moving shape keys doest not correct the blend basis.
Campbell Barton
ideasman42 at gmail.com
Tue Feb 16 14:57:23 CET 2010
Revision: 26956
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26956
Author: campbellbarton
Date: 2010-02-16 14:57:23 +0100 (Tue, 16 Feb 2010)
Log Message:
-----------
bugfix [#20938] Moving shape keys doest not correct the blend basis.
Modified Paths:
--------------
trunk/blender/source/blender/editors/object/object_shapekey.c
Modified: trunk/blender/source/blender/editors/object/object_shapekey.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_shapekey.c 2010-02-16 13:13:22 UTC (rev 26955)
+++ trunk/blender/source/blender/editors/object/object_shapekey.c 2010-02-16 13:57:23 UTC (rev 26956)
@@ -356,25 +356,36 @@
if(key) {
KeyBlock *kb, *kb_other;
- kb= BLI_findlink(&key->block, ob->shapenr-1);
+ int shapenr_act= ob->shapenr-1;
+ int shapenr_swap= shapenr_act + type;
+ kb= BLI_findlink(&key->block, shapenr_act);
+ if((type==-1 && kb->prev==NULL) || (type==1 && kb->next==NULL)) {
+ return OPERATOR_CANCELLED;
+ }
+
+ for(kb_other= key->block.first; kb_other; kb_other= kb_other->next) {
+ if(kb_other->relative == shapenr_act) {
+ kb_other->relative += type;
+ }
+ else if(kb_other->relative == shapenr_swap) {
+ kb_other->relative -= type;
+ }
+ }
+
if(type==-1) {
/* move back */
- if(kb->prev) {
- kb_other= kb->prev;
- BLI_remlink(&key->block, kb);
- BLI_insertlinkbefore(&key->block, kb_other, kb);
- ob->shapenr--;
- }
+ kb_other= kb->prev;
+ BLI_remlink(&key->block, kb);
+ BLI_insertlinkbefore(&key->block, kb_other, kb);
+ ob->shapenr--;
}
else {
/* move next */
- if(kb->next) {
- kb_other= kb->next;
- BLI_remlink(&key->block, kb);
- BLI_insertlinkafter(&key->block, kb_other, kb);
- ob->shapenr++;
- }
+ kb_other= kb->next;
+ BLI_remlink(&key->block, kb);
+ BLI_insertlinkafter(&key->block, kb_other, kb);
+ ob->shapenr++;
}
}
More information about the Bf-blender-cvs
mailing list