From 8efdec5aa0994cb9a6d738213e076c0bf286ea6b Mon Sep 17 00:00:00 2001 From: fgenesis Date: Sun, 7 Jul 2024 03:45:47 +0200 Subject: [PATCH] bugfixes --- Aquaria/AnimationEditor.cpp | 14 +++++++++----- BBGE/Interpolators.cpp | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Aquaria/AnimationEditor.cpp b/Aquaria/AnimationEditor.cpp index 2e38a4f..974d2db 100644 --- a/Aquaria/AnimationEditor.cpp +++ b/Aquaria/AnimationEditor.cpp @@ -1005,7 +1005,9 @@ void AnimationEditor::editStripKey() bgGrad->makeVertical(Vector(0.4f, 0.6f, 0.4f), Vector(0.8f, 1, 0.8f)); BoneKeyframe *bk = a->getKeyframe(currentKey)->getBoneKeyframe(editingBone->boneIdx); - assert(bk->controlpoints.size() == interp->bsp.ctrlX() * interp->bsp.ctrlY()); + const size_t totalcp = interp->bsp.ctrlX() * interp->bsp.ctrlY(); + const bool reset = bk->controlpoints.empty(); + bk->controlpoints.resize(totalcp); assert(!splinegrid); splinegrid = new SplineGrid; @@ -1014,10 +1016,12 @@ void AnimationEditor::editStripKey() splinegrid->setTexture(editingBone->texture->name); splinegrid->setWidthHeight(editingBone->width, editingBone->height); splinegrid->position = Vector(400, 300); - //splinegrid->followCamera = 1; - splinegrid->importKeyframe(bk); - //editSprite->addChild(splinegrid, PM_STATIC, RBP_OFF, CHILD_FRONT); - //editSprite->alphaMod = 0.5f; + + if(reset) + splinegrid->resetControlPoints(); + else + splinegrid->importKeyframe(bk); + addRenderObject(splinegrid, LR_PARTICLES_TOP); } else diff --git a/BBGE/Interpolators.cpp b/BBGE/Interpolators.cpp index e53b1dc..ad5aaa9 100644 --- a/BBGE/Interpolators.cpp +++ b/BBGE/Interpolators.cpp @@ -202,7 +202,7 @@ void BSpline2DControlPointGenerator::refresh(const float* knotsx, const float* k Vector* BSpline2DControlPointGenerator::generateControlPoints(const Vector *points2d) { const size_t cpx = interp.x.getNumInputPoints(); - const size_t cpy = interp.x.getNumInputPoints(); + const size_t cpy = interp.y.getNumInputPoints(); // y direction first for(size_t x = 0; x < cpx; ++x)