mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-15 14:09:06 +00:00
animation editor: fixed widescreen bug that caused bones to jump a distance to the left when clicked. reposition mouse only if necessary. one additional output text.
This commit is contained in:
parent
3be5e4e637
commit
a97629b52b
3 changed files with 27 additions and 11 deletions
|
@ -44,15 +44,14 @@ Bone *lastSelectedBone = 0;
|
|||
void AnimationEditor::constrainMouse()
|
||||
{
|
||||
Vector mp=core->mouse.position;
|
||||
if (mp.x < 200) mp.x = 200;
|
||||
if (mp.x > 600) mp.x = 600;
|
||||
if (mp.y < 100) mp.y = 100;
|
||||
if (mp.y > 500) mp.y = 500;
|
||||
core->setMousePosition(mp);
|
||||
bool doit = false;
|
||||
if (mp.x < 200) { mp.x = 200; doit = true; }
|
||||
if (mp.x > 600) { mp.x = 600; doit = true; }
|
||||
if (mp.y < 100) { mp.y = 100; doit = true; }
|
||||
if (mp.y > 500) { mp.y = 500; doit = true; }
|
||||
|
||||
std::ostringstream os;
|
||||
os << "mp(" << mp.x << ", " << mp.y << ")";
|
||||
debugLog(os.str());
|
||||
if(doit)
|
||||
core->setMousePosition(mp);
|
||||
}
|
||||
|
||||
KeyframeWidget::KeyframeWidget(int key) : Quad()
|
||||
|
@ -407,6 +406,11 @@ void AnimationEditor::applyState()
|
|||
text->setFontSize(6);
|
||||
addRenderObject(text, LR_HUD);
|
||||
|
||||
text2 = new DebugFont();
|
||||
text2->position = Vector(200,510);
|
||||
text2->setFontSize(6);
|
||||
addRenderObject(text2, LR_HUD);
|
||||
|
||||
editSprite->setSelectedBone(0);
|
||||
|
||||
dsq->overlay->alpha.interpolateTo(0, 0.5);
|
||||
|
@ -656,13 +660,24 @@ void AnimationEditor::update(float dt)
|
|||
os << " keyTime: " << k->t;
|
||||
}
|
||||
|
||||
Vector ebdata;
|
||||
|
||||
if (editingBone)
|
||||
{
|
||||
os << " bone: " << editingBone->name;
|
||||
|
||||
ebdata.x = editingBone->position.x;
|
||||
ebdata.y = editingBone->position.y;
|
||||
ebdata.z = editingBone->rotation.z;
|
||||
}
|
||||
text->setText(os.str());
|
||||
|
||||
char t2buf[256];
|
||||
sprintf(t2buf, "Bone x: %.3f, y: %.3f, rot: %.3f, idx: %d", ebdata.x, ebdata.y,
|
||||
ebdata.z, editSprite->getSelectedBoneIdx());
|
||||
text2->setText(t2buf);
|
||||
|
||||
|
||||
|
||||
if (core->mouse.buttons.middle)
|
||||
{
|
||||
editSprite->position += core->mouse.change;
|
||||
|
@ -737,7 +752,7 @@ void AnimationEditor::update(float dt)
|
|||
}
|
||||
if (editingBone && boneEdit == 1)
|
||||
{
|
||||
editingBone->position = core->mouse.position - editSprite->position + cursorOffset + core->getVirtualOffX();
|
||||
editingBone->position = core->mouse.position - editSprite->position + cursorOffset;
|
||||
constrainMouse();
|
||||
}
|
||||
if (editingBone && boneEdit == 2)
|
||||
|
|
|
@ -214,7 +214,7 @@ public:
|
|||
SkeletalSprite *editSprite;
|
||||
Bone *editingBone;
|
||||
int boneEdit;
|
||||
DebugFont *text;
|
||||
DebugFont *text, *text2;
|
||||
int ignoreBone;
|
||||
|
||||
void ignoreBone0();
|
||||
|
|
|
@ -243,6 +243,7 @@ public:
|
|||
std::vector<Animation> animations;
|
||||
std::vector<Bone*> bones;
|
||||
|
||||
inline int getSelectedBoneIdx(void) { return selectedBone; }
|
||||
void setSelectedBone(int b);
|
||||
void selectPrevBone();
|
||||
void selectNextBone();
|
||||
|
|
Loading…
Reference in a new issue