From 18e776bd291dbc82fa48a0dfe851a489803eb237 Mon Sep 17 00:00:00 2001 From: Kunal Gosar Date: Sat, 11 Feb 2017 13:58:23 -0800 Subject: [PATCH] emit signal only on change --- interface/src/avatar/MyAvatar.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index ded5d056bb..5fa68b859e 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -2361,16 +2361,15 @@ bool MyAvatar::hasDriveInput() const { } void MyAvatar::setAway(bool value) { - _isAway = value; - if (_isAway) { - emit wentAway(); - } else { - emit wentActive(); + if (_isAway == value) { + return; } + _isAway = value; + _isAway ? emit wentAway() : emit wentActive(); } // The resulting matrix is used to render the hand controllers, even if the camera is decoupled from the avatar. -// Specificly, if we are rendering using a third person camera. We would like to render the hand controllers in front of the camera, +// Specifically, if we are rendering using a third person camera. We would like to render the hand controllers in front of the camera, // not in front of the avatar. glm::mat4 MyAvatar::computeCameraRelativeHandControllerMatrix(const glm::mat4& controllerSensorMatrix) const {