mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-10-06 14:22:33 +00:00
Animation editor enhancements
Bone positioning now takes into account its parent's absolute rotation, and compensates it. That means bones with rotated parents follow exactly the mouse when dragged, instead of going anywhere except where they should. Repaired selecting bones with the mouse, and made that the default (can be switched to keyboard with M key). The timeline grid size and timestep unit size are now variable, and can be changed with the U, I, O, P keys or the added UI buttons. Bone borders and joint points can be displayed with B key. Removed the ignorebone0 button and related functionality. Minor cosmetical things.
This commit is contained in:
parent
a551d70a6d
commit
eeaa723cd7
6 changed files with 246 additions and 80 deletions
|
@ -1852,25 +1852,28 @@ void SkeletalSprite::setTimeMultiplier(float t, int layer)
|
|||
animLayers[layer].timeMultiplier = t;
|
||||
}
|
||||
|
||||
Bone* SkeletalSprite::getSelectedBone(int ignore, bool mouseBased)
|
||||
Bone* SkeletalSprite::getSelectedBone(bool mouseBased)
|
||||
{
|
||||
if (!loaded) return 0;
|
||||
if (mouseBased)
|
||||
{
|
||||
int closestDist = -1;
|
||||
float closestDist = HUGE_VALF;
|
||||
Bone *b = 0;
|
||||
Vector p = core->mouse.position;
|
||||
for (int i = 0; i < bones.size(); i++)
|
||||
{
|
||||
bones[i]->color = Vector(1,1,1);
|
||||
if (bones[i]->boneIdx != ignore && bones[i]->isCoordinateInside(p))
|
||||
if (bones[i]->renderQuad || core->getShiftState())
|
||||
{
|
||||
int dist = ((bones[i]->position+this->position) - p).getSquaredLength2D();
|
||||
|
||||
if (dist <= closestDist || closestDist == -1)
|
||||
bones[i]->color = Vector(1,1,1);
|
||||
if (bones[i]->renderQuad && bones[i]->isCoordinateInsideWorld(p))
|
||||
{
|
||||
closestDist = dist;
|
||||
b = bones[i];
|
||||
float dist = (bones[i]->getWorldPosition() - p).getSquaredLength2D();
|
||||
if (dist <= closestDist)
|
||||
{
|
||||
closestDist = dist;
|
||||
b = bones[i];
|
||||
selectedBone = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -223,7 +223,7 @@ public:
|
|||
|
||||
void setTimeMultiplier(float t, int layer=0);
|
||||
|
||||
Bone* getSelectedBone(int ignoreBone=-1, bool mouseBased = true);
|
||||
Bone* getSelectedBone(bool mouseBased = true);
|
||||
Animation *getCurrentAnimation(int layer=0);
|
||||
|
||||
|
||||
|
|
|
@ -25,13 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
/*************************************************************************/
|
||||
|
||||
void Vector::rotate2D360(int angle)
|
||||
void Vector::rotate2D360(float angle)
|
||||
{
|
||||
//float len = this->getLength2D();
|
||||
float a = MathFunctions::toRadians(angle);
|
||||
float oldx = x, oldy = y;
|
||||
x = cosf(a)*oldx - sinf(a)*oldy;
|
||||
y = -(sinf(a)*oldx + cosf(a)*oldy);
|
||||
rotate2DRad(angle * (PI / 180.0f));
|
||||
}
|
||||
|
||||
void Vector::rotate2DRad(float rad)
|
||||
|
@ -41,7 +37,6 @@ void Vector::rotate2DRad(float rad)
|
|||
y = sinf(rad)*ox + cosf(rad)*oy;
|
||||
}
|
||||
|
||||
|
||||
Vector getRotatedVector(const Vector &vec, float rot)
|
||||
{
|
||||
#ifdef BBGE_BUILD_OPENGL
|
||||
|
|
|
@ -402,7 +402,7 @@ public:
|
|||
}
|
||||
#endif
|
||||
void rotate2DRad(float rad);
|
||||
void rotate2D360(int angle);
|
||||
void rotate2D360(float angle);
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue