1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-01-24 17:26:41 +00:00

anim editor usability fixes

This commit is contained in:
fgenesis 2025-01-13 04:58:43 +01:00
parent 140aa4d78d
commit 33e0ee3439
2 changed files with 16 additions and 9 deletions

View file

@ -421,7 +421,7 @@ void AnimationEditor::resetScaleOrSave()
notify("Scale copied to clipboard"); notify("Scale copied to clipboard");
} }
else else
getCurrentPageSprite()->scale = Vector(1,1); getSelectedPageSprite()->scale = Vector(1,1);
} }
void AnimationEditor::applyState() void AnimationEditor::applyState()
@ -510,10 +510,10 @@ void AnimationEditor::applyState()
addAction(MakeFunctionEvent(AnimationEditor, showAllBones), KEY_A, 0); addAction(MakeFunctionEvent(AnimationEditor, showAllBones), KEY_A, 0);
addAction(MakeFunctionEvent(AnimationEditor, toggleGradient), KEY_G, 0); addAction(MakeFunctionEvent(AnimationEditor, toggleGradient), KEY_G, 0);
addAction(MakeFunctionEvent(AnimationEditor, decrTimelineUnit), KEY_U, 0); /*addAction(MakeFunctionEvent(AnimationEditor, decrTimelineUnit), KEY_U, 0);
addAction(MakeFunctionEvent(AnimationEditor, incrTimelineUnit), KEY_I, 0); addAction(MakeFunctionEvent(AnimationEditor, incrTimelineUnit), KEY_I, 0);
addAction(MakeFunctionEvent(AnimationEditor, decrTimelineGrid), KEY_O, 0); addAction(MakeFunctionEvent(AnimationEditor, decrTimelineGrid), KEY_O, 0);
addAction(MakeFunctionEvent(AnimationEditor, incrTimelineGrid), KEY_P, 0); addAction(MakeFunctionEvent(AnimationEditor, incrTimelineGrid), KEY_P, 0);*/
addAction(MakeFunctionEvent(AnimationEditor, toggleSplineMode), KEY_W, 0); addAction(MakeFunctionEvent(AnimationEditor, toggleSplineMode), KEY_W, 0);
addAction(MakeFunctionEvent(AnimationEditor, flipH), KEY_F, 0); addAction(MakeFunctionEvent(AnimationEditor, flipH), KEY_F, 0);
@ -913,8 +913,6 @@ void AnimationEditor::update(float dt)
{ {
StateObject::update(dt); StateObject::update(dt);
SkeletalSprite *editSprite = getCurrentPageSprite();
const float tltime = getMouseTimelineTime(); const float tltime = getMouseTimelineTime();
{ {
@ -1001,7 +999,7 @@ void AnimationEditor::update(float dt)
if(splinegrid) if(splinegrid)
ctrlSprite = splinegrid; ctrlSprite = splinegrid;
else else
ctrlSprite = ctrlPressed ? (RenderObject*)getCurrentPageSprite() : (RenderObject*)spriteRoot; ctrlSprite = ctrlPressed ? (RenderObject*)getSelectedPageSprite() : (RenderObject*)spriteRoot;
if (core->mouse.buttons.middle) if (core->mouse.buttons.middle)
{ {
@ -1097,6 +1095,7 @@ void AnimationEditor::update(float dt)
} }
if (!hastime && !isAnimating()) if (!hastime && !isAnimating())
{ {
SkeletalSprite *editSprite = getCurrentPageSprite();
if(Animation *a = editSprite->getCurrentAnimationOrNull()) if(Animation *a = editSprite->getCurrentAnimationOrNull())
{ {
SkeletalKeyframe *k = a->getKeyframe(currentKey); SkeletalKeyframe *k = a->getKeyframe(currentKey);
@ -1826,7 +1825,7 @@ void AnimationEditor::flipH()
{ {
if (dsq->isNested()) return; if (dsq->isNested()) return;
RenderObject *ro = core->getCtrlState() ? (RenderObject*)getCurrentPageSprite() : (RenderObject*)spriteRoot; RenderObject *ro = core->getCtrlState() ? (RenderObject*)getSelectedPageSprite() : (RenderObject*)spriteRoot;
ro->flipHorizontal(); ro->flipHorizontal();
const Vector red(1,0,0), white(1,1,1); const Vector red(1,0,0), white(1,1,1);
@ -1989,7 +1988,7 @@ void AnimationEditor::showAllBones()
{ {
if (dsq->isNested()) return; if (dsq->isNested()) return;
SkeletalSprite *spr = getCurrentPageSprite(); SkeletalSprite *spr = getSelectedPageSprite();
for (size_t i = 0; i < spr->bones.size(); ++i) for (size_t i = 0; i < spr->bones.size(); ++i)
spr->bones[i]->renderQuad = true; spr->bones[i]->renderQuad = true;
} }
@ -2039,6 +2038,8 @@ void AnimationEditor::decrTimelineGrid()
void AnimationEditor::toggleSplineMode() void AnimationEditor::toggleSplineMode()
{ {
if (dsq->isNested()) return;
assistedSplineEdit = !assistedSplineEdit; assistedSplineEdit = !assistedSplineEdit;
updateButtonLabels(); updateButtonLabels();
if(splinegrid) if(splinegrid)
@ -2094,6 +2095,11 @@ SkeletalSprite* AnimationEditor::getCurrentPageSprite() const
return getPageSprite(curPage); return getPageSprite(curPage);
} }
SkeletalSprite * AnimationEditor::getSelectedPageSprite() const
{
return editingBoneSprite ? editingBoneSprite : getCurrentPageSprite();
}
bool AnimationEditor::isAnimating() const bool AnimationEditor::isAnimating() const
{ {
for(size_t i = 0; i < NumPages; ++i) for(size_t i = 0; i < NumPages; ++i)

View file

@ -168,7 +168,8 @@ public:
Animation *getPageAnimation(size_t page) const; Animation *getPageAnimation(size_t page) const;
Animation *getCurrentPageAnimation() const; Animation *getCurrentPageAnimation() const;
SkeletalSprite *getPageSprite(size_t page) const; SkeletalSprite *getPageSprite(size_t page) const;
SkeletalSprite *getCurrentPageSprite() const; SkeletalSprite *getCurrentPageSprite() const; // sprite on active page
SkeletalSprite *getSelectedPageSprite() const; //sprite that belong to selected bone, alternatively sprite on active page
bool isAnimating() const; bool isAnimating() const;
float getAnimTime() const; float getAnimTime() const;