mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 03:50:40 +02:00
Merge pull request #9650 from kunalgosar/browserFix
Added isAway (paused) property to myAvatar
This commit is contained in:
commit
442e8d68ef
4 changed files with 49 additions and 20 deletions
|
@ -296,6 +296,10 @@ Fadable {
|
||||||
// fall through
|
// fall through
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
if (MyAvatar.isAway) {
|
||||||
|
// If stuck in a window and a key is pressed this should exit paused mode
|
||||||
|
MyAvatar.isAway = false;
|
||||||
|
}
|
||||||
// Consume unmodified keyboard entries while the window is focused, to prevent them
|
// Consume unmodified keyboard entries while the window is focused, to prevent them
|
||||||
// from propagating to the application
|
// from propagating to the application
|
||||||
if (event.modifiers === Qt.NoModifier) {
|
if (event.modifiers === Qt.NoModifier) {
|
||||||
|
|
|
@ -88,6 +88,7 @@ MyAvatar::MyAvatar(RigPointer rig) :
|
||||||
_isPushing(false),
|
_isPushing(false),
|
||||||
_isBeingPushed(false),
|
_isBeingPushed(false),
|
||||||
_isBraking(false),
|
_isBraking(false),
|
||||||
|
_isAway(false),
|
||||||
_boomLength(ZOOM_DEFAULT),
|
_boomLength(ZOOM_DEFAULT),
|
||||||
_yawSpeed(YAW_SPEED_DEFAULT),
|
_yawSpeed(YAW_SPEED_DEFAULT),
|
||||||
_pitchSpeed(PITCH_SPEED_DEFAULT),
|
_pitchSpeed(PITCH_SPEED_DEFAULT),
|
||||||
|
@ -2361,6 +2362,15 @@ bool MyAvatar::hasDriveInput() const {
|
||||||
return fabsf(_driveKeys[TRANSLATE_X]) > 0.0f || fabsf(_driveKeys[TRANSLATE_Y]) > 0.0f || fabsf(_driveKeys[TRANSLATE_Z]) > 0.0f;
|
return fabsf(_driveKeys[TRANSLATE_X]) > 0.0f || fabsf(_driveKeys[TRANSLATE_Y]) > 0.0f || fabsf(_driveKeys[TRANSLATE_Z]) > 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyAvatar::setAway(bool value) {
|
||||||
|
_isAway = value;
|
||||||
|
if (_isAway) {
|
||||||
|
emit wentAway();
|
||||||
|
} else {
|
||||||
|
emit wentActive();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// The resulting matrix is used to render the hand controllers, even if the camera is decoupled from the avatar.
|
// 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,
|
// Specificly, 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.
|
// not in front of the avatar.
|
||||||
|
|
|
@ -82,6 +82,7 @@ class MyAvatar : public Avatar {
|
||||||
Q_PROPERTY(controller::Pose rightHandTipPose READ getRightHandTipPose)
|
Q_PROPERTY(controller::Pose rightHandTipPose READ getRightHandTipPose)
|
||||||
|
|
||||||
Q_PROPERTY(float energy READ getEnergy WRITE setEnergy)
|
Q_PROPERTY(float energy READ getEnergy WRITE setEnergy)
|
||||||
|
Q_PROPERTY(float isAway READ getIsAway WRITE setAway)
|
||||||
|
|
||||||
Q_PROPERTY(bool hmdLeanRecenterEnabled READ getHMDLeanRecenterEnabled WRITE setHMDLeanRecenterEnabled)
|
Q_PROPERTY(bool hmdLeanRecenterEnabled READ getHMDLeanRecenterEnabled WRITE setHMDLeanRecenterEnabled)
|
||||||
Q_PROPERTY(bool characterControllerEnabled READ getCharacterControllerEnabled WRITE setCharacterControllerEnabled)
|
Q_PROPERTY(bool characterControllerEnabled READ getCharacterControllerEnabled WRITE setCharacterControllerEnabled)
|
||||||
|
@ -328,6 +329,8 @@ signals:
|
||||||
void energyChanged(float newEnergy);
|
void energyChanged(float newEnergy);
|
||||||
void positionGoneTo();
|
void positionGoneTo();
|
||||||
void onLoadComplete();
|
void onLoadComplete();
|
||||||
|
void wentAway();
|
||||||
|
void wentActive();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -385,6 +388,7 @@ private:
|
||||||
bool _isPushing;
|
bool _isPushing;
|
||||||
bool _isBeingPushed;
|
bool _isBeingPushed;
|
||||||
bool _isBraking;
|
bool _isBraking;
|
||||||
|
bool _isAway;
|
||||||
|
|
||||||
float _boomLength;
|
float _boomLength;
|
||||||
float _yawSpeed; // degrees/sec
|
float _yawSpeed; // degrees/sec
|
||||||
|
@ -521,6 +525,8 @@ private:
|
||||||
float getEnergy();
|
float getEnergy();
|
||||||
void setEnergy(float value);
|
void setEnergy(float value);
|
||||||
bool didTeleport();
|
bool didTeleport();
|
||||||
|
bool getIsAway() const { return _isAway; }
|
||||||
|
void setAway(bool value);
|
||||||
};
|
};
|
||||||
|
|
||||||
QScriptValue audioListenModeToScriptValue(QScriptEngine* engine, const AudioListenerMode& audioListenerMode);
|
QScriptValue audioListenModeToScriptValue(QScriptEngine* engine, const AudioListenerMode& audioListenerMode);
|
||||||
|
|
|
@ -165,9 +165,36 @@ function goAway(fromStartup) {
|
||||||
if (!isEnabled || isAway) {
|
if (!isEnabled || isAway) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we're entering away mode from some other state than startup, then we create our move timer immediately.
|
||||||
|
// However if we're just stating up, we need to delay this process so that we don't think the initial teleport
|
||||||
|
// is actually a move.
|
||||||
|
if (fromStartup === undefined || fromStartup === false) {
|
||||||
|
avatarMovedInterval = Script.setInterval(ifAvatarMovedGoActive, BASIC_TIMER_INTERVAL);
|
||||||
|
} else {
|
||||||
|
var WAIT_FOR_MOVE_ON_STARTUP = 3000; // 3 seconds
|
||||||
|
Script.setTimeout(function() {
|
||||||
|
avatarMovedInterval = Script.setInterval(ifAvatarMovedGoActive, BASIC_TIMER_INTERVAL);
|
||||||
|
}, WAIT_FOR_MOVE_ON_STARTUP);
|
||||||
|
}
|
||||||
|
|
||||||
UserActivityLogger.toggledAway(true);
|
UserActivityLogger.toggledAway(true);
|
||||||
|
MyAvatar.isAway = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function goActive() {
|
||||||
|
if (!isAway) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UserActivityLogger.toggledAway(false);
|
||||||
|
MyAvatar.isAway = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
MyAvatar.wentAway.connect(setAwayProperties)
|
||||||
|
MyAvatar.wentActive.connect(setActiveProperties)
|
||||||
|
|
||||||
|
function setAwayProperties() {
|
||||||
isAway = true;
|
isAway = true;
|
||||||
wasMuted = AudioDevice.getMuted();
|
wasMuted = AudioDevice.getMuted();
|
||||||
if (!wasMuted) {
|
if (!wasMuted) {
|
||||||
|
@ -189,27 +216,9 @@ function goAway(fromStartup) {
|
||||||
wasHmdMounted = HMD.mounted; // always remember the correct state
|
wasHmdMounted = HMD.mounted; // always remember the correct state
|
||||||
|
|
||||||
avatarPosition = MyAvatar.position;
|
avatarPosition = MyAvatar.position;
|
||||||
|
|
||||||
// If we're entering away mode from some other state than startup, then we create our move timer immediately.
|
|
||||||
// However if we're just stating up, we need to delay this process so that we don't think the initial teleport
|
|
||||||
// is actually a move.
|
|
||||||
if (fromStartup === undefined || fromStartup === false) {
|
|
||||||
avatarMovedInterval = Script.setInterval(ifAvatarMovedGoActive, BASIC_TIMER_INTERVAL);
|
|
||||||
} else {
|
|
||||||
var WAIT_FOR_MOVE_ON_STARTUP = 3000; // 3 seconds
|
|
||||||
Script.setTimeout(function() {
|
|
||||||
avatarMovedInterval = Script.setInterval(ifAvatarMovedGoActive, BASIC_TIMER_INTERVAL);
|
|
||||||
}, WAIT_FOR_MOVE_ON_STARTUP);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function goActive() {
|
function setActiveProperties() {
|
||||||
if (!isAway) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
UserActivityLogger.toggledAway(false);
|
|
||||||
|
|
||||||
isAway = false;
|
isAway = false;
|
||||||
if (!wasMuted) {
|
if (!wasMuted) {
|
||||||
AudioDevice.toggleMute();
|
AudioDevice.toggleMute();
|
||||||
|
|
Loading…
Reference in a new issue