mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-28 19:23:53 +00:00
anim editor: allow to select anim by name (no more hammering PgUp/PgDown!)
This commit is contained in:
parent
92ab459736
commit
ed98a3328e
4 changed files with 34 additions and 0 deletions
|
@ -277,6 +277,7 @@ void AnimationEditor::applyState()
|
|||
|
||||
addAction(MakeFunctionEvent(AnimationEditor, prevAnim), KEY_PGUP, 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, 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()
|
||||
{
|
||||
if (dsq->isNested()) return;
|
||||
|
|
|
@ -60,6 +60,7 @@ public:
|
|||
|
||||
void nextAnim();
|
||||
void prevAnim();
|
||||
void selectAnim();
|
||||
|
||||
void quit();
|
||||
|
||||
|
|
|
@ -1243,6 +1243,20 @@ void SkeletalSprite::firstAnimation()
|
|||
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()
|
||||
{
|
||||
stopAnimation();
|
||||
|
|
|
@ -277,6 +277,7 @@ public:
|
|||
void prevAnimation();
|
||||
void lastAnimation();
|
||||
void firstAnimation();
|
||||
bool selectAnimation(const char *name);
|
||||
void updateSelectedBoneColor();
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue