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

anim edit: slightly more useful border modes

This commit is contained in:
fgenesis 2022-09-24 05:25:54 +02:00
parent cf70cfe48d
commit e35dfb9f68
2 changed files with 44 additions and 19 deletions

View file

@ -220,7 +220,7 @@ void AnimationEditor::applyState()
selectedStripPoint = 0;
mouseSelection = true;
editingFile = "Naija";
renderBorders = false;
renderBorderMode = RENDER_BORDER_MINIMAL;
ae = this;
StateObject::applyState();
boneEdit = 0;
@ -1454,7 +1454,9 @@ void AnimationEditor::toggleRenderBorders()
{
if (dsq->isNested()) return;
renderBorders = !renderBorders;
renderBorderMode = (RenderBorderMode)(renderBorderMode + 1);
if(renderBorderMode > RENDER_BORDER_ALL)
renderBorderMode = RENDER_BORDER_NONE;
updateRenderBorders();
}
@ -1463,14 +1465,44 @@ void AnimationEditor::updateRenderBorders()
if (!editSprite)
return;
// reset
for (size_t i = 0; i < editSprite->bones.size(); ++i)
{
Bone *b = editSprite->bones[i];
b->renderBorder = renderBorders;
b->renderCenter = renderBorders;
b->renderBorder = false;
b->renderCenter = false;
b->borderAlpha = 0.8f;
b->renderBorderColor = Vector(1,1,1);
}
if(renderBorderMode == RENDER_BORDER_NONE)
return;
else
{
Animation *a = editSprite->getCurrentAnimation();
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);
}
}
}
if(renderBorderMode == RENDER_BORDER_ALL)
{
for (size_t i = 0; i < editSprite->bones.size(); ++i)
{
Bone *b = editSprite->bones[i];
b->renderBorder = true;
b->renderCenter = true;
}
}
}
void AnimationEditor::updateEditingBone()
@ -1541,21 +1573,7 @@ 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()

View file

@ -138,7 +138,14 @@ public:
void toggleRenderBorders();
void updateRenderBorders();
bool renderBorders;
enum RenderBorderMode
{
RENDER_BORDER_NONE,
RENDER_BORDER_MINIMAL,
RENDER_BORDER_ALL, // must be last
};
RenderBorderMode renderBorderMode;
void updateEditingBone();
void showAllBones();
void incrTimelineUnit();