mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-02-19 03:15:02 +00:00
anim editor: only allow selecting bones from currently active sprite & keyframe
fixes crashing and weird behavior
This commit is contained in:
parent
51cf2f75f5
commit
c9365a3266
1 changed files with 9 additions and 3 deletions
|
@ -1968,9 +1968,14 @@ void AnimationEditor::updateEditingBone()
|
||||||
SkeletalSprite *nearestSpr = NULL;
|
SkeletalSprite *nearestSpr = NULL;
|
||||||
const Vector& p = core->mouse.position;
|
const Vector& p = core->mouse.position;
|
||||||
int page = -1, idx = -1;
|
int page = -1, idx = -1;
|
||||||
for(size_t i = 0; i < NumPages; ++i)
|
// DON'T make this a loop going over all pages. Only use the current page.
|
||||||
|
// Causes problems when editing bones on a foreign sprite since we can't assign a keyframe cleanly.
|
||||||
|
// (Because that sprite may not have enough keyframes, or there is no keyframe at the time we're trying to edit.
|
||||||
|
// The former just crashes; the latter causes weirdness and accidental edits to unrelated/unintended keyframes)
|
||||||
|
//for(size_t i = 0; i < NumPages; ++i)
|
||||||
{
|
{
|
||||||
SkeletalSprite& spr = pages[i].editSprite;
|
//SkeletalSprite& spr = pages[i].editSprite;
|
||||||
|
SkeletalSprite& spr = *getCurrentPageSprite();
|
||||||
if(spr.isLoaded())
|
if(spr.isLoaded())
|
||||||
{
|
{
|
||||||
int k = spr.findSelectableBoneIdxClosestTo(p, true);
|
int k = spr.findSelectableBoneIdxClosestTo(p, true);
|
||||||
|
@ -1983,7 +1988,8 @@ void AnimationEditor::updateEditingBone()
|
||||||
mind = d;
|
mind = d;
|
||||||
nearest = b;
|
nearest = b;
|
||||||
nearestSpr = &spr;
|
nearestSpr = &spr;
|
||||||
page = i;
|
//page = i;
|
||||||
|
page = curPage;
|
||||||
idx = k;
|
idx = k;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue