From 1ea1408ac48009c3e94334139bdfc217d15ec541 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Fri, 24 May 2013 03:36:50 +0200 Subject: [PATCH] Animation editor enhancement. New key combo: Pressing Ctrl+Shift while moving/rotating a bone will move/rotate it globally, for all keys in all animations. --- Aquaria/AnimationEditor.cpp | 57 ++++++++++++++++++++++++++++++------- 1 file changed, 47 insertions(+), 10 deletions(-) diff --git a/Aquaria/AnimationEditor.cpp b/Aquaria/AnimationEditor.cpp index ed800f6..105c094 100644 --- a/Aquaria/AnimationEditor.cpp +++ b/Aquaria/AnimationEditor.cpp @@ -1074,14 +1074,33 @@ void AnimationEditor::applyTranslation() { 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) + if(!core->getCtrlState()) { - BoneKeyframe *b = editSprite->getCurrentAnimation()->getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx); - if (b) + // all bones in one anim mode + for (int i = 0; i < editSprite->getCurrentAnimation()->getNumKeyframes(); ++i) { - b->x += xdiff; - b->y += ydiff; + BoneKeyframe *b = editSprite->getCurrentAnimation()->getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx); + if (b) + { + b->x += xdiff; + b->y += ydiff; + } + } + } + else + { + // all bones in all anims mode + for (int a = 0; a < editSprite->animations.size(); ++a) + { + for (int i = 0; i < editSprite->animations[a].getNumKeyframes(); ++i) + { + BoneKeyframe *b = editSprite->animations[a].getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx); + if (b) + { + b->x += xdiff; + b->y += ydiff; + } + } } } } @@ -1187,12 +1206,30 @@ void AnimationEditor::rmbu() if (bcur) { int rotdiff = editingBone->rotation.z - bcur->rot; - for (int i = 0; i < editSprite->getCurrentAnimation()->getNumKeyframes(); ++i) + if (!core->getCtrlState()) { - BoneKeyframe *b = editSprite->getCurrentAnimation()->getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx); - if (b) + for (int i = 0; i < editSprite->getCurrentAnimation()->getNumKeyframes(); ++i) { - b->rot += rotdiff; + BoneKeyframe *b = editSprite->getCurrentAnimation()->getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx); + if (b) + { + b->rot += rotdiff; + } + } + } + else + { + // all bones in all anims mode + for (int a = 0; a < editSprite->animations.size(); ++a) + { + for (int i = 0; i < editSprite->animations[a].getNumKeyframes(); ++i) + { + BoneKeyframe *b = editSprite->animations[a].getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx); + if (b) + { + b->rot += rotdiff; + } + } } } }