diff --git a/Aquaria/AnimationEditor.cpp b/Aquaria/AnimationEditor.cpp index 0b15386..ed800f6 100644 --- a/Aquaria/AnimationEditor.cpp +++ b/Aquaria/AnimationEditor.cpp @@ -1057,11 +1057,34 @@ void AnimationEditor::applyTranslation() { if (editingBone) { - BoneKeyframe *b = editSprite->getCurrentAnimation()->getKeyframe(currentKey)->getBoneKeyframe(editingBone->boneIdx); - if (b) + if (!core->getShiftState()) { - b->x = editingBone->position.x; - b->y = editingBone->position.y; + // one bone mode + BoneKeyframe *b = editSprite->getCurrentAnimation()->getKeyframe(currentKey)->getBoneKeyframe(editingBone->boneIdx); + if (b) + { + b->x = editingBone->position.x; + b->y = editingBone->position.y; + } + } + else + { + BoneKeyframe *bcur = editSprite->getCurrentAnimation()->getKeyframe(currentKey)->getBoneKeyframe(editingBone->boneIdx); + if (bcur) + { + int xdiff = editingBone->position.x - bcur->x; + int ydiff = editingBone->position.y - bcur->y; + // all bones mode + for (int i = 0; i < editSprite->getCurrentAnimation()->getNumKeyframes(); ++i) + { + BoneKeyframe *b = editSprite->getCurrentAnimation()->getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx); + if (b) + { + b->x += xdiff; + b->y += ydiff; + } + } + } } } } @@ -1149,10 +1172,30 @@ void AnimationEditor::rmbu() { if (editingBone) { - BoneKeyframe *b = editSprite->getCurrentAnimation()->getKeyframe(currentKey)->getBoneKeyframe(editingBone->boneIdx); - if (b) + if (!core->getShiftState()) { - b->rot = int(editingBone->rotation.z); + // one bone mode + BoneKeyframe *b = editSprite->getCurrentAnimation()->getKeyframe(currentKey)->getBoneKeyframe(editingBone->boneIdx); + if (b) + { + b->rot = int(editingBone->rotation.z); + } + } + else + { + BoneKeyframe *bcur = editSprite->getCurrentAnimation()->getKeyframe(currentKey)->getBoneKeyframe(editingBone->boneIdx); + if (bcur) + { + int rotdiff = editingBone->rotation.z - bcur->rot; + for (int i = 0; i < editSprite->getCurrentAnimation()->getNumKeyframes(); ++i) + { + BoneKeyframe *b = editSprite->getCurrentAnimation()->getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx); + if (b) + { + b->rot += rotdiff; + } + } + } } } }