1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-25 09:44:02 +00:00

anim editor: highlight bspline'd bones

This commit is contained in:
fgenesis 2022-09-24 04:58:14 +02:00
parent cfa5d45932
commit cf70cfe48d
2 changed files with 33 additions and 8 deletions

View file

@ -858,10 +858,10 @@ void AnimationEditor::nextKey()
editSprite->setTime(k->t);
else
currentKey --;
onKeyframeChanged();
}
}
applyBoneToSplineGrid();
}
void AnimationEditor::prevKey()
@ -891,11 +891,11 @@ void AnimationEditor::prevKey()
SkeletalKeyframe *k = editSprite->getCurrentAnimation()->getKeyframe(currentKey);
if (k)
editSprite->setTime(k->t);
onKeyframeChanged();
}
}
}
applyBoneToSplineGrid();
}
@ -1350,7 +1350,7 @@ void AnimationEditor::loadFile()
if (editingStrip)
editStripKey();
applyBoneToSplineGrid();
onKeyframeChanged();
}
void AnimationEditor::goToTitle()
@ -1465,9 +1465,11 @@ void AnimationEditor::updateRenderBorders()
for (size_t i = 0; i < editSprite->bones.size(); ++i)
{
editSprite->bones[i]->renderBorder = renderBorders;
editSprite->bones[i]->renderCenter = renderBorders;
editSprite->bones[i]->borderAlpha = 0.8f;
Bone *b = editSprite->bones[i];
b->renderBorder = renderBorders;
b->renderCenter = renderBorders;
b->borderAlpha = 0.8f;
b->renderBorderColor = Vector(1,1,1);
}
}
@ -1535,6 +1537,27 @@ void AnimationEditor::updateTimelineGrid()
gridsize->setText(os.str());
}
void AnimationEditor::onKeyframeChanged()
{
applyBoneToSplineGrid();
Animation *a = editSprite->getCurrentAnimation();
updateRenderBorders(); // restore default state
for(size_t i = 0; i < a->interpolators.size(); ++i)
{
const BoneGridInterpolator& bgip = a->interpolators[i];
if(Bone *b = editSprite->getBoneByIdx(bgip.idx))
{
b->renderBorder = true;
b->renderCenter = true;
b->borderAlpha = 0.4f;
b->renderBorderColor = Vector(0.2f, 0.9f, 0.2f);
}
}
}
void AnimationEditor::applyBoneToSplineGrid()
{
if(splinegrid && editingBone)

View file

@ -149,6 +149,8 @@ public:
void updateTimelineGrid();
DebugFont *gridsize, *unitsize;
void onKeyframeChanged();
SplineGrid *splinegrid;
void applySplineGridToBone();
void applyBoneToSplineGrid();