aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--linden/indra/llcharacter/llhandmotion.cpp23
-rw-r--r--linden/indra/llcharacter/llheadrotmotion.cpp14
-rw-r--r--linden/indra/llcharacter/llkeyframemotion.cpp21
3 files changed, 48 insertions, 10 deletions
diff --git a/linden/indra/llcharacter/llhandmotion.cpp b/linden/indra/llcharacter/llhandmotion.cpp
index 4c97fcd..2499bb5 100644
--- a/linden/indra/llcharacter/llhandmotion.cpp
+++ b/linden/indra/llcharacter/llhandmotion.cpp
@@ -113,9 +113,9 @@ BOOL LLHandMotion::onActivate()
113 // Note: 0 is the default 113 // Note: 0 is the default
114 for (S32 i = 1; i < LLHandMotion::NUM_HAND_POSES; i++) 114 for (S32 i = 1; i < LLHandMotion::NUM_HAND_POSES; i++)
115 { 115 {
116 mCharacter->setVisualParamWeight(gHandPoseNames[i], 0.f); 116 mCharacter->setVisualParamWeight(getHandPoseName((eHandPose)i).c_str(), 0.f);
117 } 117 }
118 mCharacter->setVisualParamWeight(gHandPoseNames[mCurrentPose], 1.f); 118 mCharacter->setVisualParamWeight(getHandPoseName(mCurrentPose).c_str(), 1.f);
119 mCharacter->updateVisualParams(); 119 mCharacter->updateVisualParams();
120 } 120 }
121 return TRUE; 121 return TRUE;
@@ -138,7 +138,7 @@ BOOL LLHandMotion::onUpdate(F32 time, U8* joint_mask)
138 { 138 {
139 if (mNewPose != HAND_POSE_RELAXED && mNewPose != mCurrentPose) 139 if (mNewPose != HAND_POSE_RELAXED && mNewPose != mCurrentPose)
140 { 140 {
141 mCharacter->setVisualParamWeight(gHandPoseNames[mNewPose], 0.f); 141 mCharacter->setVisualParamWeight(getHandPoseName(mNewPose).c_str(), 0.f);
142 } 142 }
143 mNewPose = HAND_POSE_RELAXED; 143 mNewPose = HAND_POSE_RELAXED;
144 } 144 }
@@ -147,7 +147,7 @@ BOOL LLHandMotion::onUpdate(F32 time, U8* joint_mask)
147 // this is a new morph we didn't know about before 147 // this is a new morph we didn't know about before
148 if (*requestedHandPose != mNewPose && mNewPose != mCurrentPose && mNewPose != HAND_POSE_SPREAD) 148 if (*requestedHandPose != mNewPose && mNewPose != mCurrentPose && mNewPose != HAND_POSE_SPREAD)
149 { 149 {
150 mCharacter->setVisualParamWeight(gHandPoseNames[mNewPose], 0.f); 150 mCharacter->setVisualParamWeight(getHandPoseName(mNewPose).c_str(), 0.f);
151 } 151 }
152 mNewPose = *requestedHandPose; 152 mNewPose = *requestedHandPose;
153 } 153 }
@@ -166,18 +166,18 @@ BOOL LLHandMotion::onUpdate(F32 time, U8* joint_mask)
166 166
167 if (mNewPose != HAND_POSE_SPREAD) 167 if (mNewPose != HAND_POSE_SPREAD)
168 { 168 {
169 incomingWeight = mCharacter->getVisualParamWeight(gHandPoseNames[mNewPose]); 169 incomingWeight = mCharacter->getVisualParamWeight(getHandPoseName(mNewPose).c_str());
170 incomingWeight += (timeDelta / HAND_MORPH_BLEND_TIME); 170 incomingWeight += (timeDelta / HAND_MORPH_BLEND_TIME);
171 incomingWeight = llclamp(incomingWeight, 0.f, 1.f); 171 incomingWeight = llclamp(incomingWeight, 0.f, 1.f);
172 mCharacter->setVisualParamWeight(gHandPoseNames[mNewPose], incomingWeight); 172 mCharacter->setVisualParamWeight(getHandPoseName(mNewPose).c_str(), incomingWeight);
173 } 173 }
174 174
175 if (mCurrentPose != HAND_POSE_SPREAD) 175 if (mCurrentPose != HAND_POSE_SPREAD)
176 { 176 {
177 outgoingWeight = mCharacter->getVisualParamWeight(gHandPoseNames[mCurrentPose]); 177 outgoingWeight = mCharacter->getVisualParamWeight(getHandPoseName(mCurrentPose).c_str());
178 outgoingWeight -= (timeDelta / HAND_MORPH_BLEND_TIME); 178 outgoingWeight -= (timeDelta / HAND_MORPH_BLEND_TIME);
179 outgoingWeight = llclamp(outgoingWeight, 0.f, 1.f); 179 outgoingWeight = llclamp(outgoingWeight, 0.f, 1.f);
180 mCharacter->setVisualParamWeight(gHandPoseNames[mCurrentPose], outgoingWeight); 180 mCharacter->setVisualParamWeight(getHandPoseName(mCurrentPose).c_str(), outgoingWeight);
181 } 181 }
182 182
183 mCharacter->updateVisualParams(); 183 mCharacter->updateVisualParams();
@@ -199,6 +199,8 @@ void LLHandMotion::onDeactivate()
199{ 199{
200} 200}
201 201
202//Zwag: Changed the defaults here so things look right. Otherwise the hand ends up
203// in a pose that nobody is used to when something messes up.
202//----------------------------------------------------------------------------- 204//-----------------------------------------------------------------------------
203// LLHandMotion::getHandPoseName() 205// LLHandMotion::getHandPoseName()
204//----------------------------------------------------------------------------- 206//-----------------------------------------------------------------------------
@@ -208,7 +210,8 @@ std::string LLHandMotion::getHandPoseName(eHandPose pose)
208 { 210 {
209 return std::string(gHandPoseNames[pose]); 211 return std::string(gHandPoseNames[pose]);
210 } 212 }
211 return LLStringUtil::null; 213 LL_WARNS("Bounds") << "Was passed an invalid hand pose: " << (S32)pose << LL_ENDL;
214 return std::string("Hands_Relaxed");
212} 215}
213 216
214LLHandMotion::eHandPose LLHandMotion::getHandPose(std::string posename) 217LLHandMotion::eHandPose LLHandMotion::getHandPose(std::string posename)
@@ -220,7 +223,7 @@ LLHandMotion::eHandPose LLHandMotion::getHandPose(std::string posename)
220 return (eHandPose)pose; 223 return (eHandPose)pose;
221 } 224 }
222 } 225 }
223 return (eHandPose)0; 226 return (eHandPose)1;
224} 227}
225 228
226// End 229// End
diff --git a/linden/indra/llcharacter/llheadrotmotion.cpp b/linden/indra/llcharacter/llheadrotmotion.cpp
index 88cd77f..92e7f7e 100644
--- a/linden/indra/llcharacter/llheadrotmotion.cpp
+++ b/linden/indra/llcharacter/llheadrotmotion.cpp
@@ -507,6 +507,20 @@ BOOL LLEyeMotion::onUpdate(F32 time, U8* joint_mask)
507 vergence_quat.transQuat(); 507 vergence_quat.transQuat();
508 right_eye_rot = vergence_quat * eye_jitter_rot * right_eye_rot; 508 right_eye_rot = vergence_quat * eye_jitter_rot * right_eye_rot;
509 509
510 //if in appearance, set the eyes straight forward
511 if(mCharacter->getAppearanceFlag()) // no idea why this variable is reversed
512 {
513 LLVector3 forward(1.f, 0.0, 0.0);
514 LLVector3 left;
515 LLVector3 up;
516 left.setVec(forward % forward);
517 up.setVec(forward % left);
518 target_eye_rot = LLQuaternion(forward, left, up);
519 mLeftEyeState->setRotation( target_eye_rot );
520 mRightEyeState->setRotation( target_eye_rot );
521 return TRUE;
522 }
523
510 mLeftEyeState->setRotation( left_eye_rot ); 524 mLeftEyeState->setRotation( left_eye_rot );
511 mRightEyeState->setRotation( right_eye_rot ); 525 mRightEyeState->setRotation( right_eye_rot );
512 526
diff --git a/linden/indra/llcharacter/llkeyframemotion.cpp b/linden/indra/llcharacter/llkeyframemotion.cpp
index 3b4cf7e..6e80e8d 100644
--- a/linden/indra/llcharacter/llkeyframemotion.cpp
+++ b/linden/indra/llcharacter/llkeyframemotion.cpp
@@ -1460,6 +1460,10 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
1460 1460
1461 LLQuaternion::Order ro = StringToOrder("ZYX"); 1461 LLQuaternion::Order ro = StringToOrder("ZYX");
1462 rot_key.mRotation = mayaQ(rot_angles.mV[VX], rot_angles.mV[VY], rot_angles.mV[VZ], ro); 1462 rot_key.mRotation = mayaQ(rot_angles.mV[VX], rot_angles.mV[VY], rot_angles.mV[VZ], ro);
1463 if(!(rot_key.mRotation.isFinite()))
1464 {
1465 return FALSE;
1466 }
1463 } 1467 }
1464 else 1468 else
1465 { 1469 {
@@ -1538,6 +1542,10 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
1538 if (old_version) 1542 if (old_version)
1539 { 1543 {
1540 success = dp.unpackVector3(pos_key.mPosition, "pos"); 1544 success = dp.unpackVector3(pos_key.mPosition, "pos");
1545 if(!(pos_key.mPosition.isFinite()))
1546 {
1547 return FALSE;
1548 }
1541 } 1549 }
1542 else 1550 else
1543 { 1551 {
@@ -1644,6 +1652,13 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
1644 str = (char*)bin_data; 1652 str = (char*)bin_data;
1645 constraintp->mSourceConstraintVolume = mCharacter->getCollisionVolumeID(str); 1653 constraintp->mSourceConstraintVolume = mCharacter->getCollisionVolumeID(str);
1646 1654
1655 if(constraintp->mSourceConstraintVolume == -1)
1656 {
1657 llwarns << "can't find a valid source collision volume." << llendl;
1658 delete constraintp;
1659 return FALSE;
1660 }
1661
1647 if (!dp.unpackVector3(constraintp->mSourceConstraintOffset, "source_offset")) 1662 if (!dp.unpackVector3(constraintp->mSourceConstraintOffset, "source_offset"))
1648 { 1663 {
1649 llwarns << "can't read constraint source offset" << llendl; 1664 llwarns << "can't read constraint source offset" << llendl;
@@ -1676,6 +1691,12 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
1676 { 1691 {
1677 constraintp->mConstraintTargetType = CONSTRAINT_TARGET_TYPE_BODY; 1692 constraintp->mConstraintTargetType = CONSTRAINT_TARGET_TYPE_BODY;
1678 constraintp->mTargetConstraintVolume = mCharacter->getCollisionVolumeID(str); 1693 constraintp->mTargetConstraintVolume = mCharacter->getCollisionVolumeID(str);
1694 if(constraintp->mTargetConstraintVolume == -1)
1695 {
1696 llwarns << "can't find a valid target collision volume." << llendl;
1697 delete constraintp;
1698 return FALSE;
1699 }
1679 } 1700 }
1680 1701
1681 if (!dp.unpackVector3(constraintp->mTargetConstraintOffset, "target_offset")) 1702 if (!dp.unpackVector3(constraintp->mTargetConstraintOffset, "target_offset"))