mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-15 22:19:07 +00:00
Animation editor: Add D, Shift+D, Ctrl+Shift+D key combos to flip bone rotation.
This commit is contained in:
parent
fdae0fe9a4
commit
4d7af56b95
2 changed files with 54 additions and 0 deletions
|
@ -263,6 +263,7 @@ void AnimationEditor::applyState()
|
||||||
|
|
||||||
addAction(MakeFunctionEvent(AnimationEditor, clearRot), KEY_R, 0);
|
addAction(MakeFunctionEvent(AnimationEditor, clearRot), KEY_R, 0);
|
||||||
addAction(MakeFunctionEvent(AnimationEditor, clearPos), KEY_P, 0);
|
addAction(MakeFunctionEvent(AnimationEditor, clearPos), KEY_P, 0);
|
||||||
|
addAction(MakeFunctionEvent(AnimationEditor, flipRot), KEY_D, 0);
|
||||||
addAction(MakeFunctionEvent(AnimationEditor, toggleHideBone), KEY_N, 0);
|
addAction(MakeFunctionEvent(AnimationEditor, toggleHideBone), KEY_N, 0);
|
||||||
addAction(MakeFunctionEvent(AnimationEditor, copy), KEY_C, 0);
|
addAction(MakeFunctionEvent(AnimationEditor, copy), KEY_C, 0);
|
||||||
addAction(MakeFunctionEvent(AnimationEditor, paste), KEY_V, 0);
|
addAction(MakeFunctionEvent(AnimationEditor, paste), KEY_V, 0);
|
||||||
|
@ -1155,6 +1156,58 @@ void AnimationEditor::clearRot()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AnimationEditor::flipRot()
|
||||||
|
{
|
||||||
|
if (dsq->isNested()) return;
|
||||||
|
|
||||||
|
updateEditingBone();
|
||||||
|
if (editingBone)
|
||||||
|
{
|
||||||
|
if (!core->getShiftState())
|
||||||
|
{
|
||||||
|
BoneKeyframe *b = editSprite->getCurrentAnimation()->getKeyframe(currentKey)->getBoneKeyframe(editingBone->boneIdx);
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
b->rot = -b->rot;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BoneKeyframe *bcur = editSprite->getCurrentAnimation()->getKeyframe(currentKey)->getBoneKeyframe(editingBone->boneIdx);
|
||||||
|
if (bcur)
|
||||||
|
{
|
||||||
|
int rotdiff = editingBone->rotation.z - bcur->rot;
|
||||||
|
if (!core->getCtrlState())
|
||||||
|
{
|
||||||
|
for (int i = 0; i < editSprite->getCurrentAnimation()->getNumKeyframes(); ++i)
|
||||||
|
{
|
||||||
|
BoneKeyframe *b = editSprite->getCurrentAnimation()->getKeyframe(i)->getBoneKeyframe(editingBone->boneIdx);
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
b->rot = -b->rot;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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 = -b->rot;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AnimationEditor::clearPos()
|
void AnimationEditor::clearPos()
|
||||||
{
|
{
|
||||||
if (dsq->isNested()) return;
|
if (dsq->isNested()) return;
|
||||||
|
|
|
@ -189,6 +189,7 @@ public:
|
||||||
|
|
||||||
void clearRot();
|
void clearRot();
|
||||||
void clearPos();
|
void clearPos();
|
||||||
|
void flipRot();
|
||||||
void cycleLerpType();
|
void cycleLerpType();
|
||||||
|
|
||||||
void toggleHideBone();
|
void toggleHideBone();
|
||||||
|
|
Loading…
Reference in a new issue