Animation stop seems to explode. Like, badly. Commented out until a fix can be found.

Signed-off-by: Beeks <HgDelirium@gmail.com>
This commit is contained in:
Beeks
2010-09-12 19:41:20 -04:00
parent 02b619fa9f
commit 974fbb1a29
3 changed files with 23 additions and 4 deletions

View File

@@ -21,9 +21,10 @@ We will handle drag-and-drop in the future. Reminder - Look in llPreviewGesture
#define AO_DEBUG #define AO_DEBUG
//static variables //static variables
std::list<std::string> LLAO::mStandOverrides; std::list<std::string> LLAO::mStandOverrides;
LLSD LLAO::mAnimationOverrides; LLSD LLAO::mAnimationOverrides;
S32 LLAO::mAnimationIndex; S32 LLAO::mAnimationIndex;
LLUUID LLAO::mLastAnimation;
std::map<LLUUID,LLUUID> LLAO::mOverrides; std::map<LLUUID,LLUUID> LLAO::mOverrides;
LLFloaterAO* LLFloaterAO::sInstance; LLFloaterAO* LLFloaterAO::sInstance;
@@ -190,6 +191,7 @@ void LLAO::setup()
mPeriod = gSavedSettings.getF32("AO.Period"); mPeriod = gSavedSettings.getF32("AO.Period");
mTimer = new LLAOStandTimer(mPeriod); mTimer = new LLAOStandTimer(mPeriod);
mAnimationIndex = 0; mAnimationIndex = 0;
mLastAnimation = LLUUID::null;
gSavedSettings.getControl("AO.Enabled")->getSignal()->connect(boost::bind(&handleAOEnabledChanged, _1)); gSavedSettings.getControl("AO.Enabled")->getSignal()->connect(boost::bind(&handleAOEnabledChanged, _1));
gSavedSettings.getControl("AO.Period")->getSignal()->connect(boost::bind(&handleAOPeriodChanged, _1)); gSavedSettings.getControl("AO.Period")->getSignal()->connect(boost::bind(&handleAOPeriodChanged, _1));
} }

View File

@@ -30,7 +30,7 @@ public:
//Animation LLSD for full animation options -HgB //Animation LLSD for full animation options -HgB
static LLSD mAnimationOverrides; static LLSD mAnimationOverrides;
static S32 mAnimationIndex; static S32 mAnimationIndex;
static LLUUID mLastAnimation;
static BOOL isEnabled(){ return mEnabled; } static BOOL isEnabled(){ return mEnabled; }
static BOOL isStand(LLUUID _id); static BOOL isStand(LLUUID _id);
static BOOL isVoice(LLUUID _id); static BOOL isVoice(LLUUID _id);

View File

@@ -5718,6 +5718,11 @@ BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset)
} }
if (LLAO::mAnimationOverrides[ao_id].size() > 0) if (LLAO::mAnimationOverrides[ao_id].size() > 0)
{ {
if (LLAO::mLastAnimation.notNull())
{
gAgent.sendAnimationRequest(LLAO::mLastAnimation, ANIM_REQUEST_STOP);
stopMotion(LLAO::mLastAnimation, true);
}
LLAO::mAnimationIndex++; LLAO::mAnimationIndex++;
if (LLAO::mAnimationOverrides[ao_id].size() <= LLAO::mAnimationIndex) if (LLAO::mAnimationOverrides[ao_id].size() <= LLAO::mAnimationIndex)
{ {
@@ -5727,6 +5732,7 @@ BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset)
llinfos << "Switching to anim #" << LLAO::mAnimationIndex << ": " << LLAO::mAnimationOverrides[ao_id][LLAO::mAnimationIndex] << llendl; llinfos << "Switching to anim #" << LLAO::mAnimationIndex << ": " << LLAO::mAnimationOverrides[ao_id][LLAO::mAnimationIndex] << llendl;
gAgent.sendAnimationRequest(new_anim, ANIM_REQUEST_START); gAgent.sendAnimationRequest(new_anim, ANIM_REQUEST_START);
startMotion(new_anim, time_offset); startMotion(new_anim, time_offset);
LLAO::mLastAnimation = new_anim;
} }
/*if(LLAO::mOverrides.find(id) != LLAO::mOverrides.end()) /*if(LLAO::mOverrides.find(id) != LLAO::mOverrides.end())
{ {
@@ -5823,6 +5829,7 @@ BOOL LLVOAvatar::stopMotion(const LLUUID& id, BOOL stop_immediate)
LLUUID new_anim = LLAO::getAssetIDByName(LLAO::mAnimationOverrides[ao_id][LLAO::mAnimationIndex]); LLUUID new_anim = LLAO::getAssetIDByName(LLAO::mAnimationOverrides[ao_id][LLAO::mAnimationIndex]);
gAgent.sendAnimationRequest(new_anim, ANIM_REQUEST_STOP); gAgent.sendAnimationRequest(new_anim, ANIM_REQUEST_STOP);
stopMotion(new_anim, stop_immediate); stopMotion(new_anim, stop_immediate);
LLAO::mLastAnimation.setNull();
} }
/*if( (LLAO::mOverrides.find(id) != LLAO::mOverrides.end()) /*if( (LLAO::mOverrides.find(id) != LLAO::mOverrides.end())
&& (id != LLAO::mOverrides[id]) ) && (id != LLAO::mOverrides[id]) )
@@ -5831,10 +5838,20 @@ BOOL LLVOAvatar::stopMotion(const LLUUID& id, BOOL stop_immediate)
stopMotion(LLAO::mOverrides[id], stop_immediate); stopMotion(LLAO::mOverrides[id], stop_immediate);
}*/ }*/
} }
/*else if this code ever works without crashing the viewer -HgB
{
if (LLAO::mLastAnimation.notNull())
{
gAgent.sendAnimationRequest(LLAO::mLastAnimation, ANIM_REQUEST_STOP);
stopMotion(LLAO::mLastAnimation, true);
LLAO::mLastAnimation.setNull();
}
}*/
// </edit> // </edit>
gAgent.onAnimStop(id); gAgent.onAnimStop(id);
} }
if (id == ANIM_AGENT_WALK) if (id == ANIM_AGENT_WALK)
{ {
LLCharacter::stopMotion(ANIM_AGENT_FEMALE_WALK, stop_immediate); LLCharacter::stopMotion(ANIM_AGENT_FEMALE_WALK, stop_immediate);