V2 walk/run animations

This commit is contained in:
Shyotl
2011-03-08 23:22:46 -06:00
parent 4c3a73658c
commit 60f3104eb6
5 changed files with 193 additions and 157 deletions

View File

@@ -995,7 +995,11 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
registerMotion( ANIM_AGENT_EXPRESS_TOOTHSMILE, LLEmote::create );
registerMotion( ANIM_AGENT_EXPRESS_WINK, LLEmote::create );
registerMotion( ANIM_AGENT_EXPRESS_WORRY, LLEmote::create );
registerMotion( ANIM_AGENT_FEMALE_RUN_NEW, LLKeyframeWalkMotion::create ); //v2
registerMotion( ANIM_AGENT_FEMALE_WALK, LLKeyframeWalkMotion::create );
registerMotion( ANIM_AGENT_FEMALE_WALK_NEW, LLKeyframeWalkMotion::create ); //v2
registerMotion( ANIM_AGENT_RUN, LLKeyframeWalkMotion::create );
registerMotion( ANIM_AGENT_RUN_NEW, LLKeyframeWalkMotion::create ); //v2
registerMotion( ANIM_AGENT_STAND, LLKeyframeStandMotion::create );
registerMotion( ANIM_AGENT_STAND_1, LLKeyframeStandMotion::create );
registerMotion( ANIM_AGENT_STAND_2, LLKeyframeStandMotion::create );
@@ -1005,13 +1009,13 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
registerMotion( ANIM_AGENT_TURNLEFT, LLKeyframeWalkMotion::create );
registerMotion( ANIM_AGENT_TURNRIGHT, LLKeyframeWalkMotion::create );
registerMotion( ANIM_AGENT_WALK, LLKeyframeWalkMotion::create );
registerMotion( ANIM_AGENT_WALK_NEW, LLKeyframeWalkMotion::create ); //v2
// motions without a start/stop bit
registerMotion( ANIM_AGENT_BODY_NOISE, LLBodyNoiseMotion::create );
registerMotion( ANIM_AGENT_BREATHE_ROT, LLBreatheMotionRot::create );
registerMotion( ANIM_AGENT_EDITING, LLEditingMotion::create );
registerMotion( ANIM_AGENT_EYE, LLEyeMotion::create );
registerMotion( ANIM_AGENT_FEMALE_WALK, LLKeyframeWalkMotion::create );
registerMotion( ANIM_AGENT_FLY_ADJUST, LLFlyAdjustMotion::create );
registerMotion( ANIM_AGENT_HAND_MOTION, LLHandMotion::create );
registerMotion( ANIM_AGENT_HEAD_ROT, LLHeadRotMotion::create );
@@ -5791,6 +5795,56 @@ std::string LLVOAvatar::getIdleTime()
return output;
}
// Override selectively based on avatar sex and whether we're using new
// animations.
LLUUID LLVOAvatar::remapMotionID(const LLUUID& id)
{
LLCachedControl<bool> use_new_walk_run("UseNewWalkRun",true);
LLCachedControl<bool> use_cross_walk_run("UseCrossWalkRun",false);
LLUUID result = id;
// start special case female walk for female avatars
if ((getSex() == SEX_FEMALE) != use_cross_walk_run)
{
if (id == ANIM_AGENT_WALK)
{
if (use_new_walk_run)
result = ANIM_AGENT_FEMALE_WALK_NEW;
else
result = ANIM_AGENT_FEMALE_WALK;
}
else if (id == ANIM_AGENT_RUN)
{
// There is no old female run animation, so only override
// in one case.
if (use_new_walk_run)
result = ANIM_AGENT_FEMALE_RUN_NEW;
}
else if (id == ANIM_AGENT_SIT)
{
result = ANIM_AGENT_SIT_FEMALE;
}
}
else
{
// Male avatar.
if (id == ANIM_AGENT_WALK)
{
if (use_new_walk_run)
result = ANIM_AGENT_WALK_NEW;
}
else if (id == ANIM_AGENT_RUN)
{
if (use_new_walk_run)
result = ANIM_AGENT_RUN_NEW;
}
}
return result;
}
//-----------------------------------------------------------------------------
// startMotion()
// id is the asset id of the animation to start
@@ -5809,25 +5863,14 @@ BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset)
LLMemType mt(LLMemType::MTYPE_AVATAR);
// start special case female walk for female avatars
if (getSex() == SEX_FEMALE)
{
if (id == ANIM_AGENT_WALK)
{
return LLCharacter::startMotion(ANIM_AGENT_FEMALE_WALK, time_offset);
}
else if (id == ANIM_AGENT_SIT)
{
return LLCharacter::startMotion(ANIM_AGENT_SIT_FEMALE, time_offset);
}
}
LLUUID remap_id = remapMotionID(id);
if (mIsSelf && id == ANIM_AGENT_AWAY)
if (mIsSelf && remap_id == ANIM_AGENT_AWAY)
{
gAgent.setAFK();
}
return LLCharacter::startMotion(id, time_offset);
return LLCharacter::startMotion(remap_id, time_offset);
}
//-----------------------------------------------------------------------------
@@ -5835,21 +5878,15 @@ BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset)
//-----------------------------------------------------------------------------
BOOL LLVOAvatar::stopMotion(const LLUUID& id, BOOL stop_immediate)
{
LLUUID remap_id = remapMotionID(id);
if (mIsSelf)
{
gAgent.onAnimStop(id);
gAgent.onAnimStop(remap_id);
}
if (id == ANIM_AGENT_WALK)
{
LLCharacter::stopMotion(ANIM_AGENT_FEMALE_WALK, stop_immediate);
}
else if (id == ANIM_AGENT_SIT)
{
LLCharacter::stopMotion(ANIM_AGENT_SIT_FEMALE, stop_immediate);
}
return LLCharacter::stopMotion(id, stop_immediate);
return LLCharacter::stopMotion(remap_id, stop_immediate);
}
//-----------------------------------------------------------------------------