send out one last blendshape update when setting MyAvatar.hasScriptedBlendshapes to false

This commit is contained in:
Thijs Wenker 2018-05-15 21:39:17 +02:00
parent bfe210da75
commit 8b4298514e
2 changed files with 15 additions and 2 deletions

View file

@ -2081,6 +2081,19 @@ bool MyAvatar::shouldRenderHead(const RenderArgs* renderArgs) const {
return !defaultMode || !firstPerson || !insideHead;
}
void MyAvatar::setHasScriptedBlendshapes(bool hasScriptedBlendshapes) {
if (hasScriptedBlendshapes == _hasScriptedBlendShapes) {
return;
}
if (!hasScriptedBlendshapes) {
// send a forced avatarData update to make sure the script can send neutal blendshapes on unload
// without having to wait for the update loop, make sure _hasScriptedBlendShapes is still true
// before sending the update, or else it won't send the neutal blendshapes to the receiving clients
sendAvatarDataPacket(true);
}
_hasScriptedBlendShapes = hasScriptedBlendshapes;
}
void MyAvatar::updateOrientation(float deltaTime) {
// Smoothly rotate body with arrow keys

View file

@ -1345,7 +1345,7 @@ private:
virtual bool shouldRenderHead(const RenderArgs* renderArgs) const override;
void setShouldRenderLocally(bool shouldRender) { _shouldRender = shouldRender; setEnableMeshVisible(shouldRender); }
bool getShouldRenderLocally() const { return _shouldRender; }
void setHasScriptedBlendshapes(bool hasScriptedBlendshapes) { _hasScriptedBlendShapes = hasScriptedBlendshapes; }
void setHasScriptedBlendshapes(bool hasScriptedBlendshapes);
bool getHasScriptedBlendshapes() const override { return _hasScriptedBlendShapes; }
void setHasAudioEnabledFaceMovement(bool hasAudioEnabledFaceMovement) { _hasAudioEnabledFaceMovement = hasAudioEnabledFaceMovement; }
bool getHasAudioEnabledFaceMovement() const override { return _hasAudioEnabledFaceMovement; }
@ -1457,7 +1457,7 @@ private:
bool _hmdRollControlEnabled { true };
float _hmdRollControlDeadZone { ROLL_CONTROL_DEAD_ZONE_DEFAULT };
float _hmdRollControlRate { ROLL_CONTROL_RATE_DEFAULT };
bool _hasScriptedBlendShapes { false };
std::atomic<bool> _hasScriptedBlendShapes { false };
bool _hasAudioEnabledFaceMovement { true };
// working copy -- see AvatarData for thread-safe _sensorToWorldMatrixCache, used for outward facing access