All submissions to this site are governed by the Second Life Viewer Contribution Agreement. By submitting patches and other information using this site, you acknowledge that you have read, understood, and agreed to those terms.

Review Board 1.6.11

Welcome to the Second Life Viewer Code Review tool.
See the documentation on our wiki for how to use this site.

STORM-1899: Avatar hand poses randomly get stuck in spread position

Review Request #592 - Created July 19, 2012 and submitted

Ansariel Hiller Reviewers
viewer
STORM-1899
None viewer-release
A proposed solution for STORM-1899 and the issue, where the handpose of avatars randomly get stuck in the spread hand position.

In the current implementation, this case might happen under the following circumstances:
* Avatar uses an animation with hand pose A
* A request is issued to change hand pose to B
* Before the viewer has blended pose A over to pose B, the original pose A is requested again
* In this case, the hand pose will not be properly (re)set and because mNewPose == mCurrentPose, there will be no further blending, leaving the hand in it's current pose

The patch will properly reset the hand pose in this case and update the visual parameters of the avatar.

 

Changes between revision 1 and 2

1 2
1 2

  1. indra/llcharacter/llhandmotion.cpp: Loading...
indra/llcharacter/llhandmotion.cpp
Diff Revision 1 Diff Revision 2
... 152 lines hidden [Expand]
BOOL LLHandMotion::onUpdate(F32 time, U8* joint_mask)
153
			if (mCurrentPose == HAND_POSE_RELAXED)
153
			if (mCurrentPose == HAND_POSE_RELAXED)
154
			{
154
			{
155
				mCharacter->updateVisualParams();
155
				mCharacter->updateVisualParams();
156
			}
156
			}
157
		}
157
		}
158
		mNewPose = HAND_POSE_RELAXED;
158
		mNewPose = HAND_POSE_RELAXED;
159
	}
159
	}
160
	else
160
	else
161
	{
161
	{
162
		// Sometimes we seem to get garbage here, with poses that are out of bounds.
162
		// Sometimes we seem to get garbage here, with poses that are out of bounds.
163
		// Clamp requested pose before setting the new pose and request
163
		// So check for a valid pose first.
164
		// relaxed hand pose instead as default.
164
		if (*requestedHandPose >= 0 && *requestedHandPose < NUM_HAND_POSES)
165
		if (*requestedHandPose < 0 || *requestedHandPose >= NUM_HAND_POSES)

   
166
		{
165
		{
167
			llwarns << "Requested hand pose out of range. Using HAND_POSE_RELAXED." << llendl;

   
168
			*requestedHandPose = HAND_POSE_RELAXED;

   
169
		}

   
170

   

   
171
		// This is a new morph we didn't know about before:
166
			// This is a new morph we didn't know about before:
172
		// Reset morph weight for both current and new pose
167
			// Reset morph weight for both current and new pose
173
		// back their starting values while still blending.
168
			// back their starting values while still blending.
174
		if (*requestedHandPose != mNewPose && mNewPose != mCurrentPose)
169
			if (*requestedHandPose != mNewPose && mNewPose != mCurrentPose)
175
		{
170
			{
176
			if (mNewPose != HAND_POSE_SPREAD)
171
				if (mNewPose != HAND_POSE_SPREAD)
177
			{
172
				{
178
				mCharacter->setVisualParamWeight(gHandPoseNames[mNewPose], 0.f);
173
					mCharacter->setVisualParamWeight(gHandPoseNames[mNewPose], 0.f);
179
			}
174
				}
180

   
175

   
... 7 lines hidden [Expand]
BOOL LLHandMotion::onUpdate(F32 time, U8* joint_mask)
188
			}
183
				}
189

   
184

   
190
			// Update visual params now if we won't blend
185
				// Update visual params now if we won't blend
191
			if (mCurrentPose == *requestedHandPose)
186
				if (mCurrentPose == *requestedHandPose)
192
			{
187
				{
193
				mCharacter->updateVisualParams();
188
					mCharacter->updateVisualParams();
194
			}
189
				}
195
		}
190
			}
196
		mNewPose = *requestedHandPose;
191
			mNewPose = *requestedHandPose;
197
	}
192
		}

   
193
		else

   
194
		{

   
195
			llwarns << "Requested hand pose out of range. Ignoring requested pose." << llendl;

   
196
		}

   
197
	}
198

   
198

   
199
	mCharacter->removeAnimationData("Hand Pose");
199
	mCharacter->removeAnimationData("Hand Pose");
200
	mCharacter->removeAnimationData("Hand Pose Priority");
200
	mCharacter->removeAnimationData("Hand Pose Priority");
201

   
201

   
202
//	if (requestedHandPose)
202
//	if (requestedHandPose)
203
//		llinfos << "Hand Pose " << *requestedHandPose << llendl;
203
//		llinfos << "Hand Pose " << *requestedHandPose << llendl;
204

   
204

   
205
	// if we are still blending...
205
	// if we are still blending...
206
	if (mCurrentPose != mNewPose)
206
	if (mCurrentPose != mNewPose)
207
	{
207
	{
... 63 lines hidden [Expand]
  1. indra/llcharacter/llhandmotion.cpp: Loading...