summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaianakproductengine <daianakproductengine@lindenlab.com>2017-08-15 17:29:25 +0300
committerdaianakproductengine <daianakproductengine@lindenlab.com>2017-08-15 17:29:25 +0300
commitb2223dfd1c796236504cef600379f9468ed42aed (patch)
tree099b7c720ac05a8fe0f7d12686ab375a08410f29
parentb7894fce4f16f7722dcf5bb1b781c08b1478a600 (diff)
MAINT-5013 Fixed Changing avatar sex while sitting breaks animations until relogging
-rw-r--r--indra/newview/llvoavatar.cpp15
-rw-r--r--indra/newview/llvoavatar.h2
2 files changed, 11 insertions, 6 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index ddb7ba1e4b..f9dfa971d9 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -5260,13 +5260,13 @@ void LLVOAvatar::resetAnimations()
// Override selectively based on avatar sex and whether we're using new
// animations.
-LLUUID LLVOAvatar::remapMotionID(const LLUUID& id)
+LLUUID LLVOAvatar::remapMotionID(const LLUUID& id, ESex gender)
{
BOOL use_new_walk_run = gSavedSettings.getBOOL("UseNewWalkRun");
LLUUID result = id;
// start special case female walk for female avatars
- if (getSex() == SEX_FEMALE)
+ if (gender == SEX_FEMALE)
{
if (id == ANIM_AGENT_WALK)
{
@@ -5316,7 +5316,7 @@ BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset)
{
LL_DEBUGS() << "motion requested " << id.asString() << " " << gAnimLibrary.animationName(id) << LL_ENDL;
- LLUUID remap_id = remapMotionID(id);
+ LLUUID remap_id = remapMotionID(id, getSex());
if (remap_id != id)
{
@@ -5338,8 +5338,13 @@ BOOL LLVOAvatar::stopMotion(const LLUUID& id, BOOL stop_immediate)
{
LL_DEBUGS() << "motion requested " << id.asString() << " " << gAnimLibrary.animationName(id) << LL_ENDL;
- LLUUID remap_id = remapMotionID(id);
-
+ LLUUID remap_id = remapMotionID(id, getSex());
+ if (findMotion(remap_id) == NULL)
+ {
+ //possibility of encountering animation from the previous gender
+ remap_id = remapMotionID(id, (getSex() == SEX_MALE) ? SEX_FEMALE : SEX_MALE);
+ }
+
if (remap_id != id)
{
LL_DEBUGS() << "motion resultant " << remap_id.asString() << " " << gAnimLibrary.animationName(remap_id) << LL_ENDL;
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index bd89d4ef23..253d9c24f3 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -188,7 +188,7 @@ public:
/*virtual*/ LLVector3 getCharacterVelocity();
/*virtual*/ LLVector3 getCharacterAngularVelocity();
- /*virtual*/ LLUUID remapMotionID(const LLUUID& id);
+ /*virtual*/ LLUUID remapMotionID(const LLUUID& id, ESex gender);
/*virtual*/ BOOL startMotion(const LLUUID& id, F32 time_offset = 0.f);
/*virtual*/ BOOL stopMotion(const LLUUID& id, BOOL stop_immediate = FALSE);
virtual bool hasMotionFromSource(const LLUUID& source_id);