mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-12-26 14:45:48 +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 xdiff = editingBone->position.x - bcur->x;
|
||||||
int ydiff = editingBone->position.y - bcur->y;
|
int ydiff = editingBone->position.y - bcur->y;
|
||||||
// all bones mode
|
if(!core->getCtrlState())
|
||||||
for (int i = 0; i < editSprite->getCurrentAnimation()->getNumKeyframes(); ++i)
|
|
||||||
{
|
{
|
||||||
BoneKeyframe *b = editSprite->getCurrentAnimation()->getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx);
|
// all bones in one anim mode
|
||||||
if (b)
|
for (int i = 0; i < editSprite->getCurrentAnimation()->getNumKeyframes(); ++i)
|
||||||
{
|
{
|
||||||
b->x += xdiff;
|
BoneKeyframe *b = editSprite->getCurrentAnimation()->getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx);
|
||||||
b->y += ydiff;
|
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)
|
if (bcur)
|
||||||
{
|
{
|
||||||
int rotdiff = editingBone->rotation.z - bcur->rot;
|
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);
|
for (int i = 0; i < editSprite->getCurrentAnimation()->getNumKeyframes(); ++i)
|
||||||
if (b)
|
|
||||||
{
|
{
|
||||||
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