mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-12-25 22:25:46 +00:00
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.
This commit is contained in:
parent
0611568d3e
commit
1ea1408ac4
1 changed files with 47 additions and 10 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue