Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-02-16 16:57:23 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-02-16 16:57:23 +0300
commit56b8e37864e4c607b858a154dc8266cde42cde3e (patch)
tree59457785b522fcf78c438033f3b8b1882c0f5266
parenta789942219122f61eac212d366fe10ec1a54d474 (diff)
bugfix [#20938] Moving shape keys doest not correct the blend basis.
-rw-r--r--source/blender/editors/object/object_shapekey.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c
index 933d26041e9..3cf29cd3eaf 100644
--- a/source/blender/editors/object/object_shapekey.c
+++ b/source/blender/editors/object/object_shapekey.c
@@ -356,25 +356,36 @@ static int shape_key_move_exec(bContext *C, wmOperator *op)
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++;
}
}