1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-29 03:33:48 +00:00

anim editor: allow to select anim by name (no more hammering PgUp/PgDown!)

This commit is contained in:
fgenesis 2022-11-18 01:52:46 +01:00
parent 92ab459736
commit ed98a3328e
4 changed files with 34 additions and 0 deletions

View file

@ -277,6 +277,7 @@ void AnimationEditor::applyState()
addAction(MakeFunctionEvent(AnimationEditor, prevAnim), KEY_PGUP, 0); addAction(MakeFunctionEvent(AnimationEditor, prevAnim), KEY_PGUP, 0);
addAction(MakeFunctionEvent(AnimationEditor, nextAnim), KEY_PGDN, 0); addAction(MakeFunctionEvent(AnimationEditor, nextAnim), KEY_PGDN, 0);
addAction(MakeFunctionEvent(AnimationEditor, selectAnim), KEY_F9, 0);
addAction(MakeFunctionEvent(AnimationEditor, animateOrStop), KEY_RETURN, 0); addAction(MakeFunctionEvent(AnimationEditor, animateOrStop), KEY_RETURN, 0);
addAction(MakeFunctionEvent(AnimationEditor, toggleRenderBorders), KEY_B, 0); addAction(MakeFunctionEvent(AnimationEditor, toggleRenderBorders), KEY_B, 0);
@ -1394,6 +1395,23 @@ void AnimationEditor::prevAnim()
} }
} }
void AnimationEditor::selectAnim()
{
if (dsq->isNested()) return;
std::string name = dsq->getUserInputString("Select anim name:");
if (name.empty())
return;
if(editSprite->selectAnimation(name.c_str()))
{
currentKey = 0;
rebuildKeyframeWidgets();
}
else
dsq->screenMessage("No such anim name");
}
void AnimationEditor::reverseAnim() void AnimationEditor::reverseAnim()
{ {
if (dsq->isNested()) return; if (dsq->isNested()) return;

View file

@ -60,6 +60,7 @@ public:
void nextAnim(); void nextAnim();
void prevAnim(); void prevAnim();
void selectAnim();
void quit(); void quit();

View file

@ -1243,6 +1243,20 @@ void SkeletalSprite::firstAnimation()
animLayers[0].currentAnimation = 0; animLayers[0].currentAnimation = 0;
} }
bool SkeletalSprite::selectAnimation(const char* name)
{
for(size_t i = 0; i < animations.size(); ++i)
{
if(animations[i].name == name)
{
stopAnimation();
animLayers[0].currentAnimation = i;
return true;
}
}
return false;
}
void SkeletalSprite::lastAnimation() void SkeletalSprite::lastAnimation()
{ {
stopAnimation(); stopAnimation();

View file

@ -277,6 +277,7 @@ public:
void prevAnimation(); void prevAnimation();
void lastAnimation(); void lastAnimation();
void firstAnimation(); void firstAnimation();
bool selectAnimation(const char *name);
void updateSelectedBoneColor(); void updateSelectedBoneColor();