diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 4bcd7aaf0f..bcd3f269e8 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -70,12 +70,16 @@ file(GLOB_RECURSE INTERFACE_SRCS "src/*.cpp" "src/*.h") GroupSources("src") list(APPEND INTERFACE_SRCS ${RESOURCES_RCC}) +# grab the Objective-C sources on OS X +if (APPLE) + file(GLOB_RECURSE INTERFACE_OBJCPP_SRCS "src/*.m" "src/*.mm") + list(APPEND INTERFACE_SRCS ${INTERFACE_OBJCPP_SRCS}) +endif () + # Add SpeechRecognizer if on Windows or OS X, otherwise remove if (WIN32) # Use .cpp and .h files as is. elseif (APPLE) - file(GLOB INTERFACE_OBJCPP_SRCS "src/SpeechRecognizer.mm") - set(INTERFACE_SRCS ${INTERFACE_SRCS} ${INTERFACE_OBJCPP_SRCS}) get_filename_component(SPEECHRECOGNIZER_CPP "src/SpeechRecognizer.cpp" ABSOLUTE) list(REMOVE_ITEM INTERFACE_SRCS ${SPEECHRECOGNIZER_CPP}) else () diff --git a/interface/resources/avatar/animations/emote_point01_aimoffsets.fbx b/interface/resources/avatar/animations/emote_point01_aimoffsets.fbx new file mode 100644 index 0000000000..84524168e7 Binary files /dev/null and b/interface/resources/avatar/animations/emote_point01_aimoffsets.fbx differ diff --git a/interface/resources/avatar/animations/sitting_emote_point_aimoffsets.fbx b/interface/resources/avatar/animations/sitting_emote_point_aimoffsets.fbx new file mode 100644 index 0000000000..eb31091a94 Binary files /dev/null and b/interface/resources/avatar/animations/sitting_emote_point_aimoffsets.fbx differ diff --git a/interface/resources/avatar/avatar-animation.json b/interface/resources/avatar/avatar-animation.json index 375bc330ba..fa3a020b23 100644 --- a/interface/resources/avatar/avatar-animation.json +++ b/interface/resources/avatar/avatar-animation.json @@ -1544,103 +1544,292 @@ "type": "randomSwitchStateMachine" }, { - "children": [ + "children": [ { - "children": [ + "children": [ + { + "children": [ + { + "children": [ + ], + "data": { + "endFrame": 21, + "loopFlag": false, + "startFrame": 1, + "timeScale": 1, + "url": "qrc:///avatar/animations/sitting_emote_point_all.fbx" + }, + "id": "seatedReactionPointIntro", + "type": "clip" + }, + { + "children": [ + ], + "data": { + "endFrame": 100, + "loopFlag": true, + "startFrame": 21, + "timeScale": 1, + "url": "qrc:///avatar/animations/sitting_emote_point_all.fbx" + }, + "id": "seatedReactionPointLoop", + "type": "clip" + }, + { + "children": [ + ], + "data": { + "endFrame": 134, + "loopFlag": false, + "mirrorFlag": false, + "startFrame": 100, + "timeScale": 1, + "url": "qrc:///avatar/animations/sitting_emote_point_all.fbx" + }, + "id": "seatedReactionPointOutro", + "type": "clip" + } + ], + "data": { + "currentState": "seatedReactionPointIntro", + "randomSwitchTimeMax": 10, + "randomSwitchTimeMin": 1, + "states": [ + { + "easingType": "easeInOutQuad", + "id": "seatedReactionPointIntro", + "interpDuration": 18, + "interpTarget": 18, + "interpType": "evaluateBoth", + "priority": 1, + "resume": false, + "transitions": [ + { + "randomSwitchState": "seatedReactionPointLoop", + "var": "seatedReactionPointIntroOnDone" + } + ] + }, + { + "easingType": "easeInOutQuad", + "id": "seatedReactionPointLoop", + "interpDuration": 18, + "interpTarget": 18, + "interpType": "evaluateBoth", + "priority": 0, + "resume": false, + "transitions": [ + { + "randomSwitchState": "seatedReactionPointOutro", + "var": "reactionPointDisabled" + } + ] + }, + { + "easingType": "easeInOutQuad", + "id": "seatedReactionPointOutro", + "interpDuration": 18, + "interpTarget": 18, + "interpType": "evaluateBoth", + "priority": 0, + "resume": false, + "transitions": [ + { + "randomSwitchState": "seatedReactionPointLoop", + "var": "reactionPointEnabled" + } + ] + } + ], + "triggerRandomSwitch": "" + }, + "id": "seatedReactionPoint", + "type": "randomSwitchStateMachine" + } ], "data": { - "endFrame": 21, - "loopFlag": false, - "startFrame": 1, - "timeScale": 1, - "url": "qrc:///avatar/animations/sitting_emote_point_all.fbx" + "alpha": 0, + "alphaVar": "seatedPointBlendAlpha", + "blendType": "addAbsolute" }, - "id": "seatedReactionPointIntro", - "type": "clip" + "id": "seatedReactionPointBase", + "type": "blendLinear" }, { "children": [ + { + "children": [ + ], + "data": { + "baseFrame": 1, + "baseURL": "qrc:///avatar/animations/sitting_emote_point_aimoffsets.fbx", + "blendType": "addAbsolute", + "endFrame": 11, + "loopFlag": true, + "startFrame": 11, + "timeScale": 1, + "url": "qrc:///avatar/animations/sitting_emote_point_aimoffsets.fbx" + }, + "id": "seatedPointLeft", + "type": "clip" + }, + { + "children": [ + ], + "data": { + "baseFrame": 1, + "baseURL": "qrc:///avatar/animations/sitting_emote_point_aimoffsets.fbx", + "blendType": "addAbsolute", + "endFrame": 30, + "loopFlag": true, + "startFrame": 30, + "timeScale": 1, + "url": "qrc:///avatar/animations/sitting_emote_point_aimoffsets.fbx" + }, + "id": "seatedPointRight", + "type": "clip" + }, + { + "children": [ + ], + "data": { + "baseFrame": 1, + "baseURL": "qrc:///avatar/animations/sitting_emote_point_aimoffsets.fbx", + "blendType": "addAbsolute", + "endFrame": 50, + "loopFlag": true, + "startFrame": 50, + "timeScale": 1, + "url": "qrc:///avatar/animations/sitting_emote_point_aimoffsets.fbx" + }, + "id": "seatedPointUp", + "type": "clip" + }, + { + "children": [ + ], + "data": { + "baseFrame": 1, + "baseURL": "qrc:///avatar/animations/sitting_emote_point_aimoffsets.fbx", + "blendType": "addAbsolute", + "endFrame": 70, + "loopFlag": true, + "startFrame": 70, + "timeScale": 1, + "url": "qrc:///avatar/animations/sitting_emote_point_aimoffsets.fbx" + }, + "id": "seatedPointDown", + "type": "clip" + }, + { + "children": [ + ], + "data": { + "baseFrame": 1, + "baseURL": "qrc:///avatar/animations/sitting_emote_point_aimoffsets.fbx", + "blendType": "addAbsolute", + "endFrame": 90, + "loopFlag": true, + "startFrame": 90, + "timeScale": 1, + "url": "qrc:///avatar/animations/sitting_emote_point_aimoffsets.fbx" + }, + "id": "seatedPointUpLeft", + "type": "clip" + }, + { + "children": [ + ], + "data": { + "baseFrame": 1, + "baseURL": "qrc:///avatar/animations/sitting_emote_point_aimoffsets.fbx", + "blendType": "addAbsolute", + "endFrame": 110, + "loopFlag": true, + "startFrame": 110, + "timeScale": 1, + "url": "qrc:///avatar/animations/sitting_emote_point_aimoffsets.fbx" + }, + "id": "seatedPointUpRight", + "type": "clip" + }, + { + "children": [ + ], + "data": { + "baseFrame": 1, + "baseURL": "qrc:///avatar/animations/sitting_emote_point_aimoffsets.fbx", + "blendType": "addAbsolute", + "endFrame": 130, + "loopFlag": true, + "startFrame": 130, + "timeScale": 1, + "url": "qrc:///avatar/animations/sitting_emote_point_aimoffsets.fbx" + }, + "id": "seatedPointDownLeft", + "type": "clip" + }, + { + "children": [ + ], + "data": { + "baseFrame": 1, + "baseURL": "qrc:///avatar/animations/sitting_emote_point_aimoffsets.fbx", + "blendType": "addAbsolute", + "endFrame": 150, + "loopFlag": true, + "startFrame": 150, + "timeScale": 1, + "url": "qrc:///avatar/animations/sitting_emote_point_aimoffsets.fbx" + }, + "id": "seatedPointDownRight", + "type": "clip" + }, + { + "children": [ + ], + "data": { + "baseFrame": 1, + "baseURL": "qrc:///avatar/animations/sitting_emote_point_aimoffsets.fbx", + "blendType": "addAbsolute", + "endFrame": 3, + "loopFlag": true, + "startFrame": 3, + "timeScale": 1, + "url": "qrc:///avatar/animations/sitting_emote_point_aimoffsets.fbx" + }, + "id": "seatedPointCenter", + "type": "clip" + } ], "data": { - "endFrame": 100, - "loopFlag": true, - "startFrame": 21, - "timeScale": 1, - "url": "qrc:///avatar/animations/sitting_emote_point_all.fbx" + "alpha": [ + 0, + 0, + 0 + ], + "alphaVar": "pointAroundAlpha", + "centerId": "seatedPointCenter", + "downId": "seatedPointDown", + "downLeftId": "seatedPointDownLeft", + "downRightId": "seatedPointDownRight", + "leftId": "seatedPointLeft", + "rightId": "seatedPointRight", + "upId": "seatedPointUp", + "upLeftId": "seatedPointUpLeft", + "upRightId": "seatedPointUpRight" }, - "id": "seatedReactionPointLoop", - "type": "clip" - }, - { - "children": [ - ], - "data": { - "endFrame": 134, - "loopFlag": false, - "mirrorFlag": false, - "startFrame": 100, - "timeScale": 1, - "url": "qrc:///avatar/animations/sitting_emote_point_all.fbx" - }, - "id": "seatedReactionPointOutro", - "type": "clip" + "id": "seatedPointAround", + "type": "blendDirectional" } ], "data": { - "currentState": "seatedReactionPointIntro", - "randomSwitchTimeMax": 10, - "randomSwitchTimeMin": 1, - "states": [ - { - "easingType": "easeInOutQuad", - "id": "seatedReactionPointIntro", - "interpDuration": 18, - "interpTarget": 18, - "interpType": "evaluateBoth", - "priority": 1, - "resume": false, - "transitions": [ - { - "randomSwitchState": "seatedReactionPointLoop", - "var": "seatedReactionPointIntroOnDone" - } - ] - }, - { - "easingType": "easeInOutQuad", - "id": "seatedReactionPointLoop", - "interpDuration": 18, - "interpTarget": 18, - "interpType": "evaluateBoth", - "priority": 0, - "resume": false, - "transitions": [ - { - "randomSwitchState": "seatedReactionPointOutro", - "var": "reactionPointDisabled" - } - ] - }, - { - "easingType": "easeInOutQuad", - "id": "seatedReactionPointOutro", - "interpDuration": 18, - "interpTarget": 18, - "interpType": "evaluateBoth", - "priority": 0, - "resume": false, - "transitions": [ - { - "randomSwitchState": "seatedReactionPointLoop", - "var": "reactionPointEnabled" - } - ] - } - ], - "triggerRandomSwitch": "" + "alpha": 0, + "alphaVar": "pointBlendAlpha", + "blendType": "addAbsolute" }, "id": "seatedReactionPoint", - "type": "randomSwitchStateMachine" + "type": "blendLinear" } ], "data": { @@ -3531,97 +3720,275 @@ "children": [ { "children": [ + { + "children": [ + ], + "data": { + "endFrame": 21, + "loopFlag": false, + "startFrame": 1, + "timeScale": 1, + "url": "qrc:///avatar/animations/emote_point01_all.fbx" + }, + "id": "reactionPointIntro", + "type": "clip" + }, + { + "children": [ + ], + "data": { + "endFrame": 100, + "loopFlag": true, + "startFrame": 21, + "timeScale": 1, + "url": "qrc:///avatar/animations/emote_point01_all.fbx" + }, + "id": "reactionPointLoop", + "type": "clip" + }, + { + "children": [ + ], + "data": { + "endFrame": 134, + "loopFlag": false, + "startFrame": 100, + "timeScale": 1, + "url": "qrc:///avatar/animations/emote_point01_all.fbx" + }, + "id": "reactionPointOutro", + "type": "clip" + } ], "data": { - "endFrame": 21, - "loopFlag": false, - "startFrame": 1, - "timeScale": 1, - "url": "qrc:///avatar/animations/emote_point01_all.fbx" + "currentState": "reactionPointIntro", + "randomSwitchTimeMax": 10, + "randomSwitchTimeMin": 1, + "states": [ + { + "easingType": "easeInOutQuad", + "id": "reactionPointIntro", + "interpDuration": 1, + "interpTarget": 1, + "interpType": "evaluateBoth", + "priority": 1, + "resume": false, + "transitions": [ + { + "randomSwitchState": "reactionPointLoop", + "var": "reactionPointIntroOnDone" + } + ] + }, + { + "id": "reactionPointLoop", + "interpDuration": 1, + "interpTarget": 1, + "priority": 0, + "resume": false, + "transitions": [ + { + "randomSwitchState": "reactionPointOutro", + "var": "reactionPointDisabled" + } + ] + }, + { + "easingType": "easeInOutQuad", + "id": "reactionPointOutro", + "interpDuration": 6, + "interpTarget": 6, + "interpType": "evaluateBoth", + "priority": 0, + "resume": false, + "transitions": [ + { + "randomSwitchState": "reactionPointLoop", + "var": "reactionPointEnabled" + } + ] + } + ], + "triggerRandomSwitch": "" }, - "id": "reactionPointIntro", - "type": "clip" + "id": "reactionPoint", + "type": "randomSwitchStateMachine" }, { "children": [ + { + "children": [ + ], + "data": { + "baseFrame": 1, + "baseURL": "qrc:///avatar/animations/emote_point01_aimoffsets.fbx", + "blendType": "addAbsolute", + "endFrame": 11, + "loopFlag": true, + "startFrame": 11, + "timeScale": 1, + "url": "qrc:///avatar/animations/emote_point01_aimoffsets.fbx" + }, + "id": "idlePointLeft", + "type": "clip" + }, + { + "children": [ + ], + "data": { + "baseFrame": 1, + "baseURL": "qrc:///avatar/animations/emote_point01_aimoffsets.fbx", + "blendType": "addAbsolute", + "endFrame": 30, + "loopFlag": true, + "startFrame": 30, + "timeScale": 1, + "url": "qrc:///avatar/animations/emote_point01_aimoffsets.fbx" + }, + "id": "idlePointRight", + "type": "clip" + }, + { + "children": [ + ], + "data": { + "baseFrame": 1, + "baseURL": "qrc:///avatar/animations/emote_point01_aimoffsets.fbx", + "blendType": "addAbsolute", + "endFrame": 50, + "loopFlag": true, + "startFrame": 50, + "timeScale": 1, + "url": "qrc:///avatar/animations/emote_point01_aimoffsets.fbx" + }, + "id": "idlePointUp", + "type": "clip" + }, + { + "children": [ + ], + "data": { + "baseFrame": 1, + "baseURL": "qrc:///avatar/animations/emote_point01_aimoffsets.fbx", + "blendType": "addAbsolute", + "endFrame": 70, + "loopFlag": true, + "startFrame": 70, + "timeScale": 1, + "url": "qrc:///avatar/animations/emote_point01_aimoffsets.fbx" + }, + "id": "idlePointDown", + "type": "clip" + }, + { + "children": [ + ], + "data": { + "baseFrame": 1, + "baseURL": "qrc:///avatar/animations/emote_point01_aimoffsets.fbx", + "blendType": "addAbsolute", + "endFrame": 90, + "loopFlag": true, + "startFrame": 90, + "timeScale": 1, + "url": "qrc:///avatar/animations/emote_point01_aimoffsets.fbx" + }, + "id": "idlePointUpLeft", + "type": "clip" + }, + { + "children": [ + ], + "data": { + "baseFrame": 1, + "baseURL": "qrc:///avatar/animations/emote_point01_aimoffsets.fbx", + "blendType": "addAbsolute", + "endFrame": 110, + "loopFlag": true, + "startFrame": 110, + "timeScale": 1, + "url": "qrc:///avatar/animations/emote_point01_aimoffsets.fbx" + }, + "id": "idlePointUpRight", + "type": "clip" + }, + { + "children": [ + ], + "data": { + "baseFrame": 1, + "baseURL": "qrc:///avatar/animations/emote_point01_aimoffsets.fbx", + "blendType": "addAbsolute", + "endFrame": 130, + "loopFlag": true, + "startFrame": 130, + "timeScale": 1, + "url": "qrc:///avatar/animations/emote_point01_aimoffsets.fbx" + }, + "id": "idlePointDownLeft", + "type": "clip" + }, + { + "children": [ + ], + "data": { + "baseFrame": 1, + "baseURL": "qrc:///avatar/animations/emote_point01_aimoffsets.fbx", + "blendType": "addAbsolute", + "endFrame": 150, + "loopFlag": true, + "startFrame": 150, + "timeScale": 1, + "url": "qrc:///avatar/animations/emote_point01_aimoffsets.fbx" + }, + "id": "idlePointDownRight", + "type": "clip" + }, + { + "children": [ + ], + "data": { + "baseFrame": 1, + "baseURL": "qrc:///avatar/animations/emote_point01_aimoffsets.fbx", + "blendType": "addAbsolute", + "endFrame": 3, + "loopFlag": true, + "startFrame": 3, + "timeScale": 1, + "url": "qrc:///avatar/animations/emote_point01_aimoffsets.fbx" + }, + "id": "idlePointCenter", + "type": "clip" + } ], "data": { - "endFrame": 100, - "loopFlag": true, - "startFrame": 21, - "timeScale": 1, - "url": "qrc:///avatar/animations/emote_point01_all.fbx" + "alpha": [ + 0, + 0, + 0 + ], + "alphaVar": "pointAroundAlpha", + "centerId": "idlePointCenter", + "downId": "idlePointDown", + "downLeftId": "idlePointDownLeft", + "downRightId": "idlePointDownRight", + "leftId": "idlePointLeft", + "rightId": "idlePointRight", + "upId": "idlePointUp", + "upLeftId": "idlePointUpLeft", + "upRightId": "idlePointUpRight" }, - "id": "reactionPointLoop", - "type": "clip" - }, - { - "children": [ - ], - "data": { - "endFrame": 134, - "loopFlag": false, - "startFrame": 100, - "timeScale": 1, - "url": "qrc:///avatar/animations/emote_point01_all.fbx" - }, - "id": "reactionPointOutro", - "type": "clip" + "id": "idlePointAround", + "type": "blendDirectional" } ], "data": { - "currentState": "reactionPointIntro", - "randomSwitchTimeMax": 10, - "randomSwitchTimeMin": 1, - "states": [ - { - "easingType": "easeInOutQuad", - "id": "reactionPointIntro", - "interpDuration": 1, - "interpTarget": 1, - "interpType": "evaluateBoth", - "priority": 1, - "resume": false, - "transitions": [ - { - "randomSwitchState": "reactionPointLoop", - "var": "reactionPointIntroOnDone" - } - ] - }, - { - "id": "reactionPointLoop", - "interpDuration": 1, - "interpTarget": 1, - "priority": 0, - "resume": false, - "transitions": [ - { - "randomSwitchState": "reactionPointOutro", - "var": "reactionPointDisabled" - } - ] - }, - { - "easingType": "easeInOutQuad", - "id": "reactionPointOutro", - "interpDuration": 6, - "interpTarget": 6, - "interpType": "evaluateBoth", - "priority": 0, - "resume": false, - "transitions": [ - { - "randomSwitchState": "reactionPointLoop", - "var": "reactionPointEnabled" - } - ] - } - ], - "triggerRandomSwitch": "" + "alpha": 0, + "alphaVar": "pointBlendAlpha", + "blendType": "addAbsolute" }, "id": "reactionPoint", - "type": "randomSwitchStateMachine" + "type": "blendLinear" } ], "data": { @@ -5683,16 +6050,16 @@ "upLeftId": "lookUpLeft", "upRightId": "lookUpRight" }, - "id": "lookAround", + "id": "lookAroundBlend", "type": "blendDirectional" } ], "data": { "alpha": 0, - "alphaVar": "additiveBlendAlpha", + "alphaVar": "lookBlendAlpha", "blendType": "addAbsolute" }, - "id": "additiveBlend", + "id": "lookAround", "type": "blendLinear" } ], diff --git a/interface/resources/controllers/keyboardMouse.json b/interface/resources/controllers/keyboardMouse.json index 1f7ea097da..eb07c9a6dd 100644 --- a/interface/resources/controllers/keyboardMouse.json +++ b/interface/resources/controllers/keyboardMouse.json @@ -3,8 +3,10 @@ "channels": [ { "from": "Keyboard.A", "when": ["Keyboard.RightMouseButton", "!Keyboard.Control"], "to": "Actions.LATERAL_LEFT" }, { "from": "Keyboard.D", "when": ["Keyboard.RightMouseButton", "!Keyboard.Control"], "to": "Actions.LATERAL_RIGHT" }, - { "from": "Keyboard.E", "when": ["!Application.CameraSelfie", "!Application.CameraLookAt", "!Keyboard.Control"], "to": "Actions.LATERAL_RIGHT" }, - { "from": "Keyboard.Q", "when": ["!Application.CameraSelfie", "!Application.CameraLookAt", "!Keyboard.Control"], "to": "Actions.LATERAL_LEFT" }, + { "from": "Keyboard.E", "when": ["!Application.CameraSelfie", "!Keyboard.Control"], "to": "Actions.LATERAL_RIGHT" }, + { "from": "Keyboard.Q", "when": ["!Application.CameraSelfie", "!Keyboard.Control"], "to": "Actions.LATERAL_LEFT" }, + { "from": "Keyboard.Q", "when": ["Application.CameraSelfie", "!Keyboard.Control"], "to": "Actions.LATERAL_RIGHT" }, + { "from": "Keyboard.E", "when": ["Application.CameraSelfie", "!Keyboard.Control"], "to": "Actions.LATERAL_LEFT" }, { "from": "Keyboard.T", "when": "!Keyboard.Control", "to": "Actions.TogglePushToTalk" }, { "comment" : "Mouse turn need to be small continuous increments", @@ -122,18 +124,18 @@ }, { "from": { "makeAxis" : [ - ["Keyboard.Q"], - ["Keyboard.E"] - ] + ["Keyboard.A"], + ["Keyboard.D"] + ] }, "when": ["Application.CameraLookAt", "!Keyboard.Control"], "to": "Actions.Yaw" }, { "from": { "makeAxis" : [ - ["Keyboard.E"], - ["Keyboard.Q"] - ] + ["Keyboard.A"], + ["Keyboard.D"] + ] }, "when": ["Application.CameraSelfie", "!Keyboard.Control"], "to": "Actions.Yaw" @@ -215,10 +217,6 @@ { "from": "Keyboard.S", "when": ["!Application.CameraSelfie", "!Keyboard.Control"], "to": "Actions.LONGITUDINAL_BACKWARD" }, { "from": "Keyboard.S", "when": ["Application.CameraSelfie", "!Keyboard.Control"], "to": "Actions.LONGITUDINAL_FORWARD" }, { "from": "Keyboard.W", "when": ["Application.CameraSelfie", "!Keyboard.Control"], "to": "Actions.LONGITUDINAL_BACKWARD" }, - { "from": "Keyboard.A", "when": "Application.CameraLookAt", "to": "Actions.LATERAL_LEFT" }, - { "from": "Keyboard.D", "when": "Application.CameraLookAt", "to": "Actions.LATERAL_RIGHT" }, - { "from": "Keyboard.A", "when": "Application.CameraSelfie", "to": "Actions.LATERAL_RIGHT" }, - { "from": "Keyboard.D", "when": "Application.CameraSelfie", "to": "Actions.LATERAL_LEFT" }, { "from": "Keyboard.Shift", "when": ["!Keyboard.Left", "!Keyboard.Right"], "to": "Actions.SPRINT" }, { "from": "Keyboard.C", "when": "!Keyboard.Control", "to": "Actions.VERTICAL_DOWN" }, { "from": "Keyboard.Left", "when": "Keyboard.Shift", "to": "Actions.LATERAL_LEFT" }, diff --git a/interface/src/AppNapDisabler.h b/interface/src/AppNapDisabler.h new file mode 100644 index 0000000000..b3cfc3038d --- /dev/null +++ b/interface/src/AppNapDisabler.h @@ -0,0 +1,24 @@ +// +// AppNapDisabler.h +// interface/src +// +// Copyright 2019 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#ifndef hifi_AppNapDisabler_h +#define hifi_AppNapDisabler_h + +#import + +class AppNapDisabler { +public: + AppNapDisabler(); + ~AppNapDisabler(); +private: + id _activity; +}; + +#endif // hifi_AppNapDisabler_h diff --git a/interface/src/AppNapDisabler.mm b/interface/src/AppNapDisabler.mm new file mode 100644 index 0000000000..0c760fad5f --- /dev/null +++ b/interface/src/AppNapDisabler.mm @@ -0,0 +1,28 @@ +// +// AppNapDisabler.mm +// interface/src +// +// Copyright 2019 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#include +#ifdef Q_OS_MAC + +#include "AppNapDisabler.h" + +#import + +AppNapDisabler::AppNapDisabler() { + _activity = [[NSProcessInfo processInfo] beginActivityWithOptions:NSActivityUserInitiated reason:@"Audio is in use"]; + [_activity retain]; +} + +AppNapDisabler::~AppNapDisabler() { + [[NSProcessInfo processInfo] endActivity:_activity]; + [_activity release]; +} + +#endif // Q_OS_MAC diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 4002cca0c1..b4a37519a6 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -265,6 +265,12 @@ extern "C" { #include "AndroidHelper.h" #endif +#if defined(Q_OS_MAC) +// On Mac OS, disable App Nap to prevent audio glitches while running in the background +#include "AppNapDisabler.h" +static AppNapDisabler appNapDisabler; // disabled, while in scope +#endif + #include "graphics/RenderEventHandler.h" Q_LOGGING_CATEGORY(trace_app_input_mouse, "trace.app.input.mouse") diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index f03dd8e21f..54785933c9 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -99,10 +99,16 @@ static const QString USER_RECENTER_MODEL_FORCE_STAND = QStringLiteral("ForceStan static const QString USER_RECENTER_MODEL_AUTO = QStringLiteral("Auto"); static const QString USER_RECENTER_MODEL_DISABLE_HMD_LEAN = QStringLiteral("DisableHMDLean"); -const QString HEAD_BLENDING_NAME = "lookAroundAlpha"; -const QString HEAD_ALPHA_NAME = "additiveBlendAlpha"; +const QString HEAD_BLEND_DIRECTIONAL_ALPHA_NAME = "lookAroundAlpha"; +const QString HEAD_BLEND_LINEAR_ALPHA_NAME = "lookBlendAlpha"; const float HEAD_ALPHA_BLENDING = 1.0f; +const QString POINT_REACTION_NAME = "point"; +const QString POINT_BLEND_DIRECTIONAL_ALPHA_NAME = "pointAroundAlpha"; +const QString POINT_BLEND_LINEAR_ALPHA_NAME = "pointBlendAlpha"; +const QString POINT_REF_JOINT_NAME = "RightShoulder"; +const float POINT_ALPHA_BLENDING = 1.0f; + MyAvatar::SitStandModelType stringToUserRecenterModel(const QString& str) { if (str == USER_RECENTER_MODEL_FORCE_SIT) { return MyAvatar::ForceSit; @@ -948,13 +954,16 @@ void MyAvatar::simulate(float deltaTime, bool inView) { qCDebug(interfaceapp) << "MyAvatar::simulate headPosition is NaN"; headPosition = glm::vec3(0.0f); } - head->setPosition(headPosition); head->setScale(getModelScale()); head->simulate(deltaTime); CameraMode mode = qApp->getCamera().getMode(); if (_scriptControlsHeadLookAt || mode == CAMERA_MODE_LOOK_AT || mode == CAMERA_MODE_SELFIE) { - updateHeadLookAt(deltaTime); + if (!_pointAtActive || !_isPointTargetValid) { + updateHeadLookAt(deltaTime); + } else { + resetHeadLookAt(); + } } else if (_headLookAtActive){ resetHeadLookAt(); _headLookAtActive = false; @@ -6113,6 +6122,10 @@ bool MyAvatar::beginReaction(QString reactionName) { if (reactionIndex >= 0 && reactionIndex < (int)NUM_AVATAR_BEGIN_END_REACTIONS) { std::lock_guard guard(_reactionLock); _reactionEnabledRefCounts[reactionIndex]++; + if (reactionName == POINT_REACTION_NAME) { + _pointAtActive = true; + _isPointTargetValid = true; + } return true; } return false; @@ -6122,13 +6135,18 @@ bool MyAvatar::endReaction(QString reactionName) { int reactionIndex = beginEndReactionNameToIndex(reactionName); if (reactionIndex >= 0 && reactionIndex < (int)NUM_AVATAR_BEGIN_END_REACTIONS) { std::lock_guard guard(_reactionLock); + bool wasReactionActive = true; if (_reactionEnabledRefCounts[reactionIndex] > 0) { _reactionEnabledRefCounts[reactionIndex]--; - return true; + wasReactionActive = true; } else { _reactionEnabledRefCounts[reactionIndex] = 0; - return false; + wasReactionActive = false; } + if (reactionName == POINT_REACTION_NAME) { + _pointAtActive = _reactionEnabledRefCounts[reactionIndex] > 0; + } + return wasReactionActive; } return false; } @@ -6139,10 +6157,13 @@ void MyAvatar::updateRigControllerParameters(Rig::ControllerParameters& params) for (int i = 0; i < TRIGGER_REACTION_NAMES.size(); i++) { params.reactionTriggers[i] = _reactionTriggers[i]; } - + int pointReactionIndex = beginEndReactionNameToIndex("point"); for (int i = 0; i < BEGIN_END_REACTION_NAMES.size(); i++) { // copy current state into params. params.reactionEnabledFlags[i] = _reactionEnabledRefCounts[i] > 0; + if (params.reactionEnabledFlags[i] && i == pointReactionIndex) { + params.reactionEnabledFlags[i] = _isPointTargetValid; + } } for (int i = 0; i < TRIGGER_REACTION_NAMES.size(); i++) { @@ -6668,10 +6689,42 @@ void MyAvatar::updateLookAtPosition(FaceTracker* faceTracker, Camera& myCamera) getHead()->setLookAtPosition(lookAtSpot); } +glm::vec3 MyAvatar::aimToBlendValues(const glm::vec3& aimVector, const glm::quat& frameOrientation) { + // This method computes the values for the directional blending animation node + + glm::vec3 uVector = glm::normalize(frameOrientation * Vectors::UNIT_X); + glm::vec3 vVector = glm::normalize(frameOrientation * Vectors::UNIT_Y); + + glm::vec3 aimDirection; + if (glm::length(aimVector) > EPSILON) { + aimDirection = glm::normalize(aimVector); + } else { + // aim vector is zero + return glm::vec3(); + } + + float xDot = glm::dot(uVector, aimDirection); + float yDot = glm::dot(vVector, aimDirection); + + // Make sure dot products are in range to avoid acosf returning NaN + xDot = glm::min(glm::max(xDot, -1.0f), 1.0f); + yDot = glm::min(glm::max(yDot, -1.0f), 1.0f); + + float xAngle = acosf(xDot); + float yAngle = acosf(yDot); + + // xBlend and yBlend are the values from -1.0 to 1.0 that set the directional blending. + // We compute them using the angles (0 to PI/2) => (1.0 to 0.0) and (PI/2 to PI) => (0.0 to -1.0) + float xBlend = -(xAngle - 0.5f * PI) / (0.5f * PI); + float yBlend = -(yAngle - 0.5f * PI) / (0.5f * PI); + glm::vec3 blendValues = glm::vec3(xBlend, yBlend, 0.0f); + return blendValues; +} + void MyAvatar::resetHeadLookAt() { if (_skeletonModelLoaded) { - _skeletonModel->getRig().setDirectionalBlending(HEAD_BLENDING_NAME, glm::vec3(), - HEAD_ALPHA_NAME, HEAD_ALPHA_BLENDING); + _skeletonModel->getRig().setDirectionalBlending(HEAD_BLEND_DIRECTIONAL_ALPHA_NAME, glm::vec3(), + HEAD_BLEND_LINEAR_ALPHA_NAME, HEAD_ALPHA_BLENDING); } } @@ -6687,39 +6740,10 @@ void MyAvatar::resetLookAtRotation(const glm::vec3& avatarPosition, const glm::q void MyAvatar::updateHeadLookAt(float deltaTime) { if (_skeletonModelLoaded) { glm::vec3 lookAtTarget = _scriptControlsHeadLookAt ? _lookAtScriptTarget : _lookAtCameraTarget; - glm::vec3 avatarXVector = glm::normalize(getWorldOrientation() * Vectors::UNIT_X); - glm::vec3 avatarYVector = glm::normalize(getWorldOrientation() * Vectors::UNIT_Y); - glm::vec3 avatarZVector = glm::normalize(getWorldOrientation() * Vectors::UNIT_Z); - glm::vec3 headToTargetVector = lookAtTarget - getDefaultEyePosition(); - if (glm::length(headToTargetVector) > EPSILON) { - headToTargetVector = glm::normalize(headToTargetVector); - } else { - // The target point is the avatar head - return; - } - - float xDot = glm::dot(avatarXVector, headToTargetVector); - float yDot = glm::dot(avatarYVector, headToTargetVector); - float zDot = glm::dot(avatarZVector, headToTargetVector); - // Force the head to look at one of the sides when the look at point is behind the avatar - if (zDot > 0.0f && xDot != 0.0f) { - //xDot /= fabsf(xDot); - } - - // Make sure dot products are in range to avoid acosf returning NaN - xDot = glm::min(glm::max(xDot, -1.0f), 1.0f); - yDot = glm::min(glm::max(yDot, -1.0f), 1.0f); - - float xAngle = acosf(xDot); - float yAngle = acosf(yDot); - - // xBlend and yBlend are the values from -1.0 to 1.0 that set the directional blending. - // We compute them using the angles (0 to PI/2) => (1.0 to 0.0) and (PI/2 to PI) => (0.0 to -1.0) - float xBlend = -(xAngle - 0.5f * PI) / (0.5f * PI); - float yBlend = -(yAngle - 0.5f * PI) / (0.5f * PI); - glm::vec3 lookAtBlend = glm::vec3(xBlend, yBlend, 0.0f); - _skeletonModel->getRig().setDirectionalBlending(HEAD_BLENDING_NAME, lookAtBlend, - HEAD_ALPHA_NAME, HEAD_ALPHA_BLENDING); + glm::vec3 aimVector = lookAtTarget - getDefaultEyePosition(); + glm::vec3 lookAtBlend = MyAvatar::aimToBlendValues(aimVector, getWorldOrientation()); + _skeletonModel->getRig().setDirectionalBlending(HEAD_BLEND_DIRECTIONAL_ALPHA_NAME, lookAtBlend, + HEAD_BLEND_LINEAR_ALPHA_NAME, HEAD_ALPHA_BLENDING); if (_scriptControlsHeadLookAt) { _scriptHeadControlTimer += deltaTime; @@ -6743,3 +6767,30 @@ void MyAvatar::setHeadLookAt(const glm::vec3& lookAtTarget) { _scriptHeadControlTimer = 0.0f; _lookAtScriptTarget = lookAtTarget; } + +bool MyAvatar::setPointAt(const glm::vec3& pointAtTarget) { + if (QThread::currentThread() != thread()) { + bool result = false; + BLOCKING_INVOKE_METHOD(this, "setPointAt", Q_RETURN_ARG(bool, result), + Q_ARG(const glm::vec3&, pointAtTarget)); + return result; + } + if (_skeletonModelLoaded && _pointAtActive) { + glm::vec3 aimVector = pointAtTarget - getJointPosition(POINT_REF_JOINT_NAME); + _isPointTargetValid = glm::dot(aimVector, getWorldOrientation() * Vectors::FRONT) > 0.0f; + if (_isPointTargetValid) { + glm::vec3 pointAtBlend = MyAvatar::aimToBlendValues(aimVector, getWorldOrientation()); + _skeletonModel->getRig().setDirectionalBlending(POINT_BLEND_DIRECTIONAL_ALPHA_NAME, pointAtBlend, + POINT_BLEND_LINEAR_ALPHA_NAME, POINT_ALPHA_BLENDING); + } + return _isPointTargetValid; + } + return false; +} + +void MyAvatar::resetPointAt() { + if (_skeletonModelLoaded) { + _skeletonModel->getRig().setDirectionalBlending(POINT_BLEND_DIRECTIONAL_ALPHA_NAME, glm::vec3(), + POINT_BLEND_LINEAR_ALPHA_NAME, POINT_ALPHA_BLENDING); + } +} diff --git a/interface/src/avatar/MyAvatar.h b/interface/src/avatar/MyAvatar.h index 7b63e8e86b..6b1344aad2 100644 --- a/interface/src/avatar/MyAvatar.h +++ b/interface/src/avatar/MyAvatar.h @@ -1765,6 +1765,16 @@ public: */ Q_INVOKABLE glm::vec3 getHeadLookAt() { return _lookAtCameraTarget; } + /**jsdoc + * Aims the pointing directional blending towards the provided target point. + * The "point" reaction should be triggered before using this method. + * MyAvatar.beginReaction("point") + * Returns true if the target point lays in front of the avatar. + * @function MyAvatar.setPointAt + * @param {Vec3} pointAtTarget - The target point in world coordinates. + */ + Q_INVOKABLE bool setPointAt(const glm::vec3& pointAtTarget); + glm::quat getLookAtRotation() { return _lookAtYaw * _lookAtPitch; } /**jsdoc @@ -2653,6 +2663,8 @@ private: bool _shouldTurnToFaceCamera { false }; bool _scriptControlsHeadLookAt { false }; float _scriptHeadControlTimer { 0.0f }; + bool _pointAtActive { false }; + bool _isPointTargetValid { true }; Setting::Handle _realWorldFieldOfView; Setting::Handle _useAdvancedMovementControls; @@ -2681,6 +2693,8 @@ private: void updateHeadLookAt(float deltaTime); void resetHeadLookAt(); void resetLookAtRotation(const glm::vec3& avatarPosition, const glm::quat& avatarOrientation); + void resetPointAt(); + static glm::vec3 aimToBlendValues(const glm::vec3& aimVector, const glm::quat& frameOrientation); // Avatar Preferences QUrl _fullAvatarURLFromPreferences; diff --git a/interface/src/scripting/AudioDevices.cpp b/interface/src/scripting/AudioDevices.cpp index eae4a61552..8cc45a3bf5 100644 --- a/interface/src/scripting/AudioDevices.cpp +++ b/interface/src/scripting/AudioDevices.cpp @@ -282,9 +282,9 @@ void AudioDeviceList::onDevicesChanged(const QList& devices if (deviceInfo.isDefault()) { if (deviceInfo.getMode() == QAudio::AudioInput) { - device.display = "Default microphone (recommended)"; + device.display = "Computer's default microphone (recommended)"; } else { - device.display = "Default audio (recommended)"; + device.display = "Computer's default audio (recommended)"; } } else { device.display = device.info.deviceName() diff --git a/libraries/animation/src/Rig.h b/libraries/animation/src/Rig.h index 51ff537d51..98431e1dca 100644 --- a/libraries/animation/src/Rig.h +++ b/libraries/animation/src/Rig.h @@ -359,7 +359,7 @@ protected: A, B }; - NetworkAnimState() : clipNodeEnum(NetworkAnimState::None) {} + NetworkAnimState() : clipNodeEnum(NetworkAnimState::None), fps(30.0f), loop(false), firstFrame(0.0f), lastFrame(0.0f), blendTime(FLT_MAX) {} NetworkAnimState(ClipNodeEnum clipNodeEnumIn, const QString& urlIn, float fpsIn, bool loopIn, float firstFrameIn, float lastFrameIn) : clipNodeEnum(clipNodeEnumIn), url(urlIn), fps(fpsIn), loop(loopIn), firstFrame(firstFrameIn), lastFrame(lastFrameIn) {} diff --git a/libraries/audio-client/src/AudioClient.cpp b/libraries/audio-client/src/AudioClient.cpp index 8f71b1bd33..5e1f285a6c 100644 --- a/libraries/audio-client/src/AudioClient.cpp +++ b/libraries/audio-client/src/AudioClient.cpp @@ -494,7 +494,9 @@ HifiAudioDeviceInfo defaultAudioDeviceForMode(QAudio::Mode mode) { waveInGetDevCaps(WAVE_MAPPER, &wic, sizeof(wic)); //Use the received manufacturer id to get the device's real name waveInGetDevCaps(wic.wMid, &wic, sizeof(wic)); +#if !defined(NDEBUG) qCDebug(audioclient) << "input device:" << wic.szPname; +#endif deviceName = wic.szPname; } else { WAVEOUTCAPS woc; @@ -502,7 +504,9 @@ HifiAudioDeviceInfo defaultAudioDeviceForMode(QAudio::Mode mode) { waveOutGetDevCaps(WAVE_MAPPER, &woc, sizeof(woc)); //Use the received manufacturer id to get the device's real name waveOutGetDevCaps(woc.wMid, &woc, sizeof(woc)); +#if !defined(NDEBUG) qCDebug(audioclient) << "output device:" << woc.szPname; +#endif deviceName = woc.szPname; } } else { @@ -532,10 +536,10 @@ HifiAudioDeviceInfo defaultAudioDeviceForMode(QAudio::Mode mode) { break; } } - +#if !defined(NDEBUG) qCDebug(audioclient) << "defaultAudioDeviceForMode mode: " << (mode == QAudio::AudioOutput ? "Output" : "Input") << " [" << deviceName << "] [" << foundDevice.deviceName() << "]"; - +#endif return foundDevice; #endif diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp index b0f3934278..75a7693de8 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp @@ -133,7 +133,21 @@ void Avatar::setShowNamesAboveHeads(bool show) { showNamesAboveHeads = show; } +static const char* avatarTransitStatusToStringMap[] = { + "IDLE", + "STARTED", + "PRE_TRANSIT", + "START_TRANSIT", + "TRANSITING", + "END_TRANSIT", + "POST_TRANSIT", + "ENDED", + "ABORT_TRANSIT" +}; + AvatarTransit::Status AvatarTransit::update(float deltaTime, const glm::vec3& avatarPosition, const AvatarTransit::TransitConfig& config) { + AvatarTransit::Status previousStatus = _status; + float oneFrameDistance = _isActive ? glm::length(avatarPosition - _endPosition) : glm::length(avatarPosition - _lastPosition); if (oneFrameDistance > (config._minTriggerDistance * _scale)) { if (oneFrameDistance < (config._maxTriggerDistance * _scale)) { @@ -150,6 +164,10 @@ AvatarTransit::Status AvatarTransit::update(float deltaTime, const glm::vec3& av reset(); _status = Status::ENDED; } + + if (previousStatus != _status) { + qDebug(avatars_renderer) << "AvatarTransit " << avatarTransitStatusToStringMap[(int)previousStatus] << "->" << avatarTransitStatusToStringMap[_status]; + } return _status; } diff --git a/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js b/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js index 189608fafd..8633fe8870 100644 --- a/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js +++ b/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js @@ -203,10 +203,20 @@ function maybeDeleteRemoteIndicatorTimeout() { } } - var reactionsBegun = []; var pointReticle = null; var mouseMoveEventsConnected = false; +var targetPointInterpolateConnected = false; +var pointAtTarget = Vec3.ZERO; +var isReticleVisible = true; + +function targetPointInterpolate() { + if (reticlePosition) { + pointAtTarget = Vec3.mix(pointAtTarget, reticlePosition, POINT_AT_MIX_ALPHA); + isReticleVisible = MyAvatar.setPointAt(pointAtTarget); + } +} + function beginReactionWrapper(reaction) { maybeDeleteRemoteIndicatorTimeout(); @@ -227,14 +237,18 @@ function beginReactionWrapper(reaction) { break; case ("point"): deleteOldReticles(); + pointAtTarget = MyAvatar.getHeadLookAt(); if (!mouseMoveEventsConnected) { Controller.mouseMoveEvent.connect(mouseMoveEvent); mouseMoveEventsConnected = true; } + if (!targetPointInterpolateConnected) { + Script.update.connect(targetPointInterpolate); + targetPointInterpolateConnected = true; + } } } - // Checks to see if there are any reticle entities already to delete function deleteOldReticles() { MyAvatar.getAvatarEntitiesVariant() @@ -250,6 +264,8 @@ function deleteOldReticles() { var MAX_INTERSECTION_DISTANCE_M = 50; var reticleUpdateRateLimiterTimer = false; var RETICLE_UPDATE_RATE_LIMITER_TIMER_MS = 75; +var POINT_AT_MIX_ALPHA = 0.15; +var reticlePosition = Vec3.ZERO; function mouseMoveEvent(event) { if (!reticleUpdateRateLimiterTimer) { reticleUpdateRateLimiterTimer = Script.setTimeout(function() { @@ -261,11 +277,10 @@ function mouseMoveEvent(event) { var pickRay = Camera.computePickRay(event.x, event.y); - var avatarIntersectionData = AvatarManager.findRayIntersection(pickRay); + var avatarIntersectionData = AvatarManager.findRayIntersection(pickRay, [], [MyAvatar.sessionUUID], false); var entityIntersectionData = Entities.findRayIntersection(pickRay, true); var avatarIntersectionDistanceM = avatarIntersectionData.intersects && avatarIntersectionData.distance < MAX_INTERSECTION_DISTANCE_M ? avatarIntersectionData.distance : null; var entityIntersectionDistanceM = entityIntersectionData.intersects && entityIntersectionData.distance < MAX_INTERSECTION_DISTANCE_M ? entityIntersectionData.distance : null; - var reticlePosition; if (avatarIntersectionDistanceM && entityIntersectionDistanceM) { if (avatarIntersectionDistanceM < entityIntersectionDistanceM) { @@ -283,7 +298,7 @@ function mouseMoveEvent(event) { } if (pointReticle && reticlePosition) { - Entities.editEntity(pointReticle, { position: reticlePosition }); + Entities.editEntity(pointReticle, { position: reticlePosition, visible: isReticleVisible }); } else if (reticlePosition) { pointReticle = Entities.addEntity({ type: "Box", @@ -349,6 +364,10 @@ function endReactionWrapper(reaction) { Controller.mouseMoveEvent.disconnect(mouseMoveEvent); mouseMoveEventsConnected = false; } + if (targetPointInterpolateConnected) { + Script.update.disconnect(targetPointInterpolate); + targetPointInterpolateConnected = false; + } maybeClearReticleUpdateLimiterTimeout(); deleteOldReticles(); break; @@ -757,7 +776,6 @@ function toggleEmojiApp() { emojiAPI.registerAvimojiQMLWindow(emojiAppWindow); } - // #endregion // ************************************* // END EMOJI_MAIN diff --git a/scripts/simplifiedUI/ui/simplifiedFTUE/InitialLaunchWindow.qml b/scripts/simplifiedUI/ui/simplifiedFTUE/InitialLaunchWindow.qml index 74f302746c..84f0237472 100644 --- a/scripts/simplifiedUI/ui/simplifiedFTUE/InitialLaunchWindow.qml +++ b/scripts/simplifiedUI/ui/simplifiedFTUE/InitialLaunchWindow.qml @@ -20,6 +20,7 @@ Rectangle { id: root color: simplifiedUI.colors.white anchors.fill: parent + property bool landscapeOrientation: root.width > root.height SimplifiedConstants.SimplifiedConstants { id: simplifiedUI @@ -56,55 +57,59 @@ Rectangle { id: tempAvatarPageContainer visible: true - SimplifiedControls.VerticalScrollBar { - parent: tempAvatarPageContainer - } - GridLayout { id: tempAvatarPageGrid anchors.fill: parent - anchors.leftMargin: 180 + anchors.leftMargin: 50 anchors.topMargin: 50 anchors.rightMargin: 100 - columns: root.width > root.height ? 2 : 1 - rows: root.width > root.height ? 1 : 2 - flow: root.width > root.height ? GridLayout.LeftToRight : GridLayout.TopToBottom + columns: landscapeOrientation ? 2 : 1 + rows: landscapeOrientation ? 1 : 2 + + Item { + id: tempAvatarImageContainer + Layout.preferredWidth: tempAvatarImage.width + Layout.preferredHeight: tempAvatarImage.height + + Image { + id: tempAvatarImage + width: landscapeOrientation ? 428 : 320 + height: landscapeOrientation ? 800 : 598 + source: resourceDirectoryUrl + "qml/hifi/simplifiedUI/avatarApp/images/" + + MyAvatar.skeletonModelURL.substring(MyAvatar.skeletonModelURL.indexOf("simplifiedAvatar"), MyAvatar.skeletonModelURL.lastIndexOf("/")) + ".png" + } + } Item { id: textAndQRContainer - Layout.preferredWidth: 550 - Layout.preferredHeight: 670 - Layout.minimumWidth: 200 - Layout.maximumWidth: 800 - Layout.topMargin: 130 + Layout.preferredWidth: 680 + Layout.preferredHeight: childrenRect.height + Layout.topMargin: landscapeOrientation ? 130 : 0 HifiStylesUit.RalewayBold { id: headerText text: "We know this isn't you..." - color: simplifiedUI.colors.text.darkGray + color: simplifiedUI.colors.text.black size: 48 wrapMode: Text.WordWrap anchors.left: parent.left - height: 60 - width: 550 + anchors.right: parent.right } HifiStylesUit.RalewayRegular { id: descriptionText anchors.top: headerText.bottom - anchors.topMargin: 30 + anchors.topMargin: 10 text: "but, we've given you this temporary avatar to use for today. If you see this avatar in-world, walk up and say hello to other new users!



We want you to be you so we've built an Avatar Creator App that's as easy as taking a selfie and picking your outfits! Available now on iOS and Android Platforms." - color: simplifiedUI.colors.text.darkGray + color: simplifiedUI.colors.text.black size: 22 anchors.left: parent.left anchors.right: parent.right - height: 180 - width: 550 wrapMode: Text.WordWrap } @@ -112,7 +117,8 @@ Rectangle { id: qrAndInstructionsContainer anchors.top: descriptionText.bottom height: avatarAppQRCodeImage.height - width: parent.width + anchors.left: parent.left + anchors.right: parent.right anchors.topMargin: 50 Image { @@ -132,7 +138,7 @@ Rectangle { anchors.right: parent.right anchors.leftMargin: 30 text: "Use your mobile phone to scan this QR code." - color: simplifiedUI.colors.text.darkGray + color: simplifiedUI.colors.text.black size: 22 wrapMode: Text.WordWrap } @@ -143,7 +149,7 @@ Rectangle { anchors.topMargin: 50 anchors.left: parent.left anchors.right: parent.right - horizontalAlignment: Text.AlignRight + horizontalAlignment: Text.AlignLeft text: "Continue >" color: simplifiedUI.colors.text.lightBlue opacity: continueMouseArea.containsMouse ? 1.0 : 0.7 @@ -158,29 +164,16 @@ Rectangle { onClicked: { Tablet.playSound(TabletEnums.ButtonClick); - print("_____________________________________", bottomRightAccentImage.source); tempAvatarPageContainer.visible = false; controlsContainer.visible = true; } } } } + } - Item { - id: tempAvatarImageContainer - Layout.leftMargin: 30 - Layout.preferredWidth: tempAvatarImage.width - Layout.preferredHeight: tempAvatarImage.height - - Image { - id: tempAvatarImage - width: root.width > root.height ? 428 : 320 - height: root.width > root.height ? 800 : 598 - source: resourceDirectoryUrl + "qml/hifi/simplifiedUI/avatarApp/images/" + - MyAvatar.skeletonModelURL.substring(MyAvatar.skeletonModelURL.indexOf("simplifiedAvatar"), MyAvatar.skeletonModelURL.lastIndexOf("/")) + ".png" - } - // TODO move this to be above the rest of the grid layout stuff in landscape mode - } + SimplifiedControls.VerticalScrollBar { + parent: tempAvatarPageContainer } } @@ -203,7 +196,7 @@ Rectangle { horizontalAlignment: Text.AlignHCenter height: 100 width: 850 - color: simplifiedUI.colors.darkGray + color: simplifiedUI.colors.text.black size: 36 wrapMode: Text.WordWrap } @@ -214,9 +207,10 @@ Rectangle { anchors.topMargin: 60 anchors.bottomMargin: 80 anchors.horizontalCenter: parent.horizontalCenter - columns: 2 columnSpacing: 50 rowSpacing: 40 + columns: 2 + rows: 2 Image { Layout.preferredWidth: 360 diff --git a/scripts/simplifiedUI/ui/simplifiedFTUE/SecondLaunchWindow.qml b/scripts/simplifiedUI/ui/simplifiedFTUE/SecondLaunchWindow.qml index 702bfaa92a..0e87363ba9 100644 --- a/scripts/simplifiedUI/ui/simplifiedFTUE/SecondLaunchWindow.qml +++ b/scripts/simplifiedUI/ui/simplifiedFTUE/SecondLaunchWindow.qml @@ -20,6 +20,7 @@ Rectangle { id: root color: simplifiedUI.colors.white anchors.fill: parent + property bool landscapeOrientation: root.width > root.height SimplifiedConstants.SimplifiedConstants { id: simplifiedUI @@ -51,28 +52,39 @@ Rectangle { GridLayout { id: tempAvatarPageGrid anchors.fill: parent - anchors.leftMargin: 180 + anchors.leftMargin: 50 anchors.bottomMargin: 50 - anchors.rightMargin: 100 - columns: 2 + anchors.rightMargin: 50 + columns: landscapeOrientation ? 2 : 1 + rows: landscapeOrientation ? 1 : 2 + + Item { + id: heroImageContainer + Layout.preferredWidth: heroImage.width + Layout.preferredHeight: heroImage.height + + Image { + id: heroImage + width: 428 + height: 800 + source: resourceDirectoryUrl + "qml/hifi/simplifiedUI/avatarApp/images/hero.png" + } + } Item { id: textAndQRContainer - Layout.preferredWidth: 650 - Layout.preferredHeight: 670 - Layout.minimumWidth: 200 - Layout.maximumWidth: 800 - Layout.topMargin: 180 + Layout.preferredWidth: 720 + Layout.preferredHeight: childrenRect.height + Layout.topMargin: 150 HifiStylesUit.RalewayBold { id: headerText text: "Stand out from the crowd!" - color: simplifiedUI.colors.darkGray + color: simplifiedUI.colors.text.black size: 48 wrapMode: Text.WordWrap anchors.left: parent.left anchors.right: parent.right - height: 60 } HifiStylesUit.RalewayRegular { @@ -81,10 +93,9 @@ Rectangle { anchors.top: headerText.bottom anchors.topMargin: 10 text: "You can create and upload custom avatars from our Avatar Creator App. It's as easy as taking a selfie. Available now on iOS and Android Platforms." - color: simplifiedUI.colors.darkGray + color: simplifiedUI.colors.text.black size: 24 anchors.left: parent.left - height: 80 wrapMode: Text.WordWrap } @@ -92,40 +103,42 @@ Rectangle { id: qrAndInstructionsContainer anchors.top: descriptionText.bottom anchors.left: parent.left - height: avatarAppQRCodeImage.height + instructionText.height + 50 - width: descriptionText.width - anchors.topMargin: 60 + height: avatarAppQRCodeImage.height + width: parent.width + anchors.topMargin: 150 Image { id: avatarAppQRCodeImage - anchors.horizontalCenter: instructionText.horizontalCenter + anchors.left: parent.left source: resourceDirectoryUrl + "qml/hifi/simplifiedUI/avatarApp/images/qrCode.jpg" - height: 220 - width: 220 + height: 180 + width: 180 } HifiStylesUit.RalewayBold { id: instructionText - anchors.left: parent.left - anchors.topMargin: 10 - width: 515 + anchors.left: avatarAppQRCodeImage.right + anchors.leftMargin: 20 + anchors.verticalCenter: avatarAppQRCodeImage.verticalCenter + anchors.right: parent.right anchors.top: avatarAppQRCodeImage.bottom text: "Use your mobile phone to scan this QR code." - color: simplifiedUI.colors.darkGray + color: simplifiedUI.colors.text.black size: 24 - height: 30 wrapMode: Text.WordWrap } } HifiStylesUit.RalewayBold { anchors.top: qrAndInstructionsContainer.bottom - anchors.topMargin: 50 - anchors.horizontalCenter: qrAndInstructionsContainer.horizontalCenter - text: "No thanks, I'll keep using my default avatar." + anchors.topMargin: 150 + anchors.left: parent.left + anchors.right: parent.right + horizontalAlignment: Text.AlignLeft + text: "Continue >" color: simplifiedUI.colors.text.lightBlue opacity: continueMouseArea.containsMouse ? 1.0 : 0.7 - size: 14 + size: 36 z: 1 wrapMode: Text.WordWrap @@ -144,21 +157,6 @@ Rectangle { } } } - - Item { - id: heroImageContainer - Layout.leftMargin: 30 - Layout.preferredWidth: heroImage.width - Layout.preferredHeight: heroImage.height - - Image { - id: heroImage - width: 428 - height: 800 - source: resourceDirectoryUrl + "qml/hifi/simplifiedUI/avatarApp/images/hero.png" - } - // TODO move this to be above the rest of the grid layout stuff in landscape mode - } } SimplifiedControls.VerticalScrollBar { diff --git a/scripts/simplifiedUI/ui/simplifiedUI.js b/scripts/simplifiedUI/ui/simplifiedUI.js index c1a76f5b3e..98ec5e2260 100644 --- a/scripts/simplifiedUI/ui/simplifiedUI.js +++ b/scripts/simplifiedUI/ui/simplifiedUI.js @@ -296,7 +296,7 @@ function updateOutputDeviceMutedOverlay(isMuted) { props.y = Window.innerHeight / 2 - overlayDims / 2; var outputDeviceMutedOverlayBottomY = props.y + overlayDims; - var inputDeviceMutedOverlayTopY = getInputDeviceMutedOverlayTopY(); + var inputDeviceMutedOverlayTopY = INPUT_DEVICE_MUTED_MARGIN_TOP_PX; if (outputDeviceMutedOverlayBottomY + OUTPUT_DEVICE_MUTED_MARGIN_BOTTOM_PX > inputDeviceMutedOverlayTopY) { overlayDims = 2 * (inputDeviceMutedOverlayTopY - Window.innerHeight / 2 - OUTPUT_DEVICE_MUTED_MARGIN_BOTTOM_PX); } @@ -436,21 +436,25 @@ function displaySecondLaunchWindow() { } function closeInitialLaunchWindow() { - initialLaunchWindow.fromQml.disconnect(onMessageFromInitialLaunchWindow); - var homeLocation = LocationBookmarks.getAddress("hqhome"); - if (homeLocation) { - Window.location = homeLocation; + if (initialLaunchWindow) { + initialLaunchWindow.fromQml.disconnect(onMessageFromInitialLaunchWindow); + var homeLocation = LocationBookmarks.getAddress("hqhome"); + if (homeLocation) { + Window.location = homeLocation; + } + initialLaunchWindow.close(); } - initialLaunchWindow.close(); } function closeSecondLaunchWindow() { - secondLaunchWindow.fromQml.disconnect(onMessageFromSecondLaunchWindow); - var homeLocation = LocationBookmarks.getAddress("hqhome"); - if (homeLocation) { - Window.location = homeLocation; + if (secondLaunchWindow) { + secondLaunchWindow.fromQml.disconnect(onMessageFromSecondLaunchWindow); + var homeLocation = LocationBookmarks.getAddress("hqhome"); + if (homeLocation) { + Window.location = homeLocation; + } + secondLaunchWindow.close(); } - secondLaunchWindow.close(); } var INITIAL_LAUNCH_WINDOW_MESSAGE_SOURCE = "InitialLaunchWindow.qml"; @@ -487,7 +491,6 @@ function onMessageFromSecondLaunchWindow(message) { } } - var WAIT_FOR_TOP_BAR_MS = 1000; function sendLocalStatusToQml() { var currentStatus = si.getLocalStatus(); @@ -609,15 +612,11 @@ function maybeDeleteInputDeviceMutedOverlay() { } -function getInputDeviceMutedOverlayTopY() { - return (Window.innerHeight - INPUT_DEVICE_MUTED_OVERLAY_DEFAULT_Y_PX - INPUT_DEVICE_MUTED_MARGIN_BOTTOM_PX); -} - - var inputDeviceMutedOverlay = false; -var INPUT_DEVICE_MUTED_OVERLAY_DEFAULT_X_PX = 353; -var INPUT_DEVICE_MUTED_OVERLAY_DEFAULT_Y_PX = 95; -var INPUT_DEVICE_MUTED_MARGIN_BOTTOM_PX = 20 + TOP_BAR_HEIGHT_PX; +var INPUT_DEVICE_MUTED_OVERLAY_DEFAULT_X_PX = 237; +var INPUT_DEVICE_MUTED_OVERLAY_DEFAULT_Y_PX = 64; +var INPUT_DEVICE_MUTED_MARGIN_LEFT_PX = 20; +var INPUT_DEVICE_MUTED_MARGIN_TOP_PX = 20; function updateInputDeviceMutedOverlay(isMuted) { if (isMuted) { var props = { @@ -626,8 +625,8 @@ function updateInputDeviceMutedOverlay(isMuted) { }; props.width = INPUT_DEVICE_MUTED_OVERLAY_DEFAULT_X_PX; props.height = INPUT_DEVICE_MUTED_OVERLAY_DEFAULT_Y_PX; - props.x = Window.innerWidth / 2 - INPUT_DEVICE_MUTED_OVERLAY_DEFAULT_X_PX / 2; - props.y = getInputDeviceMutedOverlayTopY(); + props.x = INPUT_DEVICE_MUTED_MARGIN_LEFT_PX; + props.y = INPUT_DEVICE_MUTED_MARGIN_TOP_PX; if (inputDeviceMutedOverlay) { Overlays.editOverlay(inputDeviceMutedOverlay, props); } else {