diff --git a/indra/newview/aoengine.cpp b/indra/newview/aoengine.cpp index 52f42aca30..652fbe141e 100644 --- a/indra/newview/aoengine.cpp +++ b/indra/newview/aoengine.cpp @@ -1793,6 +1793,45 @@ const LLUUID& AOEngine::getAOFolder() const void AOEngine::onRegionChange() { + // do nothing if the AO is off + if(!mEnabled) + { + return; + } + + // catch errors without crashing + if(!mCurrentSet) + { + LL_DEBUGS("AOEngine") << "Current set was NULL" << LL_ENDL; + return; + } + + // sitting needs special attention + if(mCurrentSet->getMotion()==ANIM_AGENT_SIT) + { + // do nothing if sit overrides was disabled + if(!mCurrentSet->getSitOverride()) + { + return; + } + + // do nothing if the last overridden motion wasn't a sit. + // happens when sit override is enabled but there were no + // sit animations added to the set yet + if(mLastOverriddenMotion!=ANIM_AGENT_SIT) + { + return; + } + + // do nothing if smart sit is enabled because we have no + // animation running from the AO + if(mCurrentSet->getSmart()) + { + return; + } + } + + // restart current animation on region crossing gAgent.sendAnimationRequest(mLastMotion,ANIM_REQUEST_START); }