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.
indra/llcharacter/llhandmotion.cpp | |||
---|---|---|---|
Revision 4d9106153407 | New Change | ||
... | 124 lines hidden [Expand] | ||
BOOL LLHandMotion::onUpdate(F32 time, U8* joint_mask) |
|||
125 | 125 | ||
126 |
F32 timeDelta = time - mLastTime; |
126 |
F32 timeDelta = time - mLastTime; |
127 |
mLastTime = time; |
127 |
mLastTime = time; |
128 | 128 | ||
129 |
requestedHandPose = (eHandPose *)mCharacter->getAnimationData("Hand Pose"); |
129 |
requestedHandPose = (eHandPose *)mCharacter->getAnimationData("Hand Pose"); |
130 |
// check to see if requested pose has changed |
130 |
// check to see if requested pose has changed |
131 |
if (!requestedHandPose) |
131 |
if (!requestedHandPose) |
132 |
{ |
132 |
{ |
133 |
if (mNewPose != HAND_POSE_RELAXED && mNewPose != mCurrentPose) |
133 |
if (mNewPose != HAND_POSE_RELAXED && mNewPose != mCurrentPose) |
134 |
{ |
134 |
{ |
135 |
// Only set param weight for poses other than |
||
136 |
// default (HAND_POSE_SPREAD); HAND_POSE_SPREAD |
||
137 |
// is not an animatable morph! |
||
138 |
if (mNewPose != HAND_POSE_SPREAD) |
||
139 |
{ |
||
135 |
mCharacter->setVisualParamWeight(gHandPoseNames[mNewPose], 0.f); |
140 |
mCharacter->setVisualParamWeight(gHandPoseNames[mNewPose], 0.f); |
136 |
} |
141 |
} |
142 | |||
143 |
// Reset morph weight for current pose back to its |
||
144 |
// full extend or it might be stuck somewhere in the middle if a |
||
145 |
// pose is requested and the old pose is requested again shortly |
||
146 |
// after while still blending to the other pose! |
||
147 |
if (mCurrentPose != HAND_POSE_SPREAD) |
||
148 |
{ |
||
149 |
mCharacter->setVisualParamWeight(gHandPoseNames[mCurrentPose], 1.f); |
||
150 |
} |
||
151 | |||
152 |
// Update visual params now if we won't blend |
||
153 |
if (mCurrentPose == HAND_POSE_RELAXED) |
||
154 |
{ |
||
155 |
mCharacter->updateVisualParams(); |
||
156 |
} |
||
157 |
} |
||
137 |
mNewPose = HAND_POSE_RELAXED; |
158 |
mNewPose = HAND_POSE_RELAXED; |
138 |
} |
159 |
} |
139 |
else |
160 |
else |
140 |
{ |
161 |
{ |
141 | // this is a new morph we didn't know about before |
162 | // Sometimes we seem to get garbage here, with poses that are out of bounds. |
142 | if (*requestedHandPose != mNewPose && mNewPose != mCurrentPose && mNewPose != HAND_POSE_SPREAD) |
163 | // So check for a valid pose first. |
164 |
if (*requestedHandPose >= 0 && *requestedHandPose < NUM_HAND_POSES) |
||
165 |
{ |
||
166 |
// This is a new morph we didn't know about before: |
||
167 |
// Reset morph weight for both current and new pose |
||
168 |
// back their starting values while still blending. |
||
169 |
if (*requestedHandPose != mNewPose && mNewPose != mCurrentPose) |
||
170 |
{ |
||
171 |
if (mNewPose != HAND_POSE_SPREAD) |
||
143 |
{ |
172 |
{ |
144 |
mCharacter->setVisualParamWeight(gHandPoseNames[mNewPose], 0.f); |
173 |
mCharacter->setVisualParamWeight(gHandPoseNames[mNewPose], 0.f); |
145 |
} |
174 |
} |
175 | |||
176 |
// Reset morph weight for current pose back to its full extend |
||
177 |
// or it might be stuck somewhere in the middle if a pose is |
||
178 |
// requested and the old pose is requested again shortly after |
||
179 |
// while still blending to the other pose! |
||
180 |
if (mCurrentPose != HAND_POSE_SPREAD) |
||
181 |
{ |
||
182 |
mCharacter->setVisualParamWeight(gHandPoseNames[mCurrentPose], 1.f); |
||
183 |
} |
||
184 | |||
185 |
// Update visual params now if we won't blend |
||
186 |
if (mCurrentPose == *requestedHandPose) |
||
187 |
{ |
||
188 |
mCharacter->updateVisualParams(); |
||
189 |
} |
||
190 |
} |
||
146 |
mNewPose = *requestedHandPose; |
191 |
mNewPose = *requestedHandPose; |
147 |
} |
192 |
} |
193 |
else |
||
194 |
{ |
||
195 |
llwarns << "Requested hand pose out of range. Ignoring requested pose." << llendl; |
||
196 |
} |
||
197 |
} |
||
148 | 198 | ||
149 |
mCharacter->removeAnimationData("Hand Pose"); |
199 |
mCharacter->removeAnimationData("Hand Pose"); |
150 |
mCharacter->removeAnimationData("Hand Pose Priority"); |
200 |
mCharacter->removeAnimationData("Hand Pose Priority"); |
151 | 201 | ||
152 |
// if (requestedHandPose)
|
202 |
// if (requestedHandPose)
|
153 |
// llinfos << "Hand Pose " << *requestedHandPose << llendl;
|
203 |
// llinfos << "Hand Pose " << *requestedHandPose << llendl;
|
154 | 204 | ||
155 |
// if we are still blending... |
205 |
// if we are still blending... |
156 |
if (mCurrentPose != mNewPose) |
206 |
if (mCurrentPose != mNewPose) |
157 |
{ |
207 |
{ |
... | 63 lines hidden [Expand] |
Other reviews