mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-12-25 22:25:46 +00:00
Animation editor enhancement: Move/rotate bones across all keyframes
This commit is contained in:
parent
9eb5b9828a
commit
f9ce5c0172
1 changed files with 50 additions and 7 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue