From 03789e01da412cc50cb8ecb86d1a5f03833b0509 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Wed, 30 Jan 2019 15:53:21 -0800 Subject: [PATCH 1/3] adding fix for oculus store argument check --- interface/src/Application.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index daf2dd6363..3b9fe15f25 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -761,6 +761,11 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { static const auto SUPPRESS_SETTINGS_RESET = "--suppress-settings-reset"; bool suppressPrompt = cmdOptionExists(argc, const_cast(argv), SUPPRESS_SETTINGS_RESET); + // set the OCULUS_STORE property so the oculus plugin can know if we ran from the Oculus Store + static const auto OCULUS_STORE_ARG = "--oculus-store"; + bool isStore = cmdOptionExists(argc, const_cast(argv), OCULUS_STORE_ARG); + qApp->setProperty(hifi::properties::OCULUS_STORE, isStore); + // Ignore any previous crashes if running from command line with a test script. bool inTestMode { false }; for (int i = 0; i < argc; ++i) { @@ -1138,10 +1143,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo qCDebug(interfaceapp) << "[VERSION] We will use DEVELOPMENT global services."; #endif - // set the OCULUS_STORE property so the oculus plugin can know if we ran from the Oculus Store - static const QString OCULUS_STORE_ARG = "--oculus-store"; - bool isStore = arguments().indexOf(OCULUS_STORE_ARG) != -1; - setProperty(hifi::properties::OCULUS_STORE, isStore); + bool isStore = property(hifi::properties::OCULUS_STORE).toBool(); + DependencyManager::get()->setLimitedCommerce(isStore); // Or we could make it a separate arg, or if either arg is set, etc. And should this instead by a hifi::properties? updateHeartbeat(); From 2c40b120ca98dff84a9c660af97b665643fbc43a Mon Sep 17 00:00:00 2001 From: Anthony Thibault Date: Wed, 30 Jan 2019 17:26:52 -0800 Subject: [PATCH 2/3] Make Animation Tests Pass Again --- .../animation/src/AnimBlendLinearMove.cpp | 4 +- libraries/animation/src/AnimVariant.h | 7 +-- libraries/animation/src/Rig.cpp | 2 - tests/animation/CMakeLists.txt | 2 +- .../src/AnimInverseKinematicsTests.cpp | 4 +- tests/animation/src/AnimTests.cpp | 62 ++++++++++--------- 6 files changed, 40 insertions(+), 41 deletions(-) diff --git a/libraries/animation/src/AnimBlendLinearMove.cpp b/libraries/animation/src/AnimBlendLinearMove.cpp index 07e1c17f77..28b8bb4a9f 100644 --- a/libraries/animation/src/AnimBlendLinearMove.cpp +++ b/libraries/animation/src/AnimBlendLinearMove.cpp @@ -151,10 +151,10 @@ void AnimBlendLinearMove::setFrameAndPhase(float dt, float alpha, int prevPoseIn if (_phase < 0.0f) { _phase = 0.0f; } - + // detect loop trigger events if (_phase >= 1.0f) { - triggersOut.setTrigger(_id + "Loop"); + triggersOut.setTrigger(_id + "OnLoop"); _phase = glm::fract(_phase); } diff --git a/libraries/animation/src/AnimVariant.h b/libraries/animation/src/AnimVariant.h index 0f921984b1..eb9ebd33dd 100644 --- a/libraries/animation/src/AnimVariant.h +++ b/libraries/animation/src/AnimVariant.h @@ -209,15 +209,14 @@ public: void set(const QString& key, const QString& value) { _map[key] = AnimVariant(value); } void unset(const QString& key) { _map.erase(key); } - void setTrigger(const QString& key) { _triggers.insert(key); } - void clearTriggers() { _triggers.clear(); } + void setTrigger(const QString& key) { _map[key] = AnimVariant(true); } void setRigToGeometryTransform(const glm::mat4& rigToGeometry) { _rigToGeometryMat = rigToGeometry; _rigToGeometryRot = glmExtractRotation(rigToGeometry); } - void clearMap() { _map.clear(); } + void clearMap() { _map.clear(); _triggers.clear(); } bool hasKey(const QString& key) const { return _map.find(key) != _map.end(); } const AnimVariant& get(const QString& key) const { @@ -238,7 +237,7 @@ public: // For stat debugging. std::map toDebugMap() const; -#ifdef NDEBUG +#ifndef NDEBUG void dump() const { qCDebug(animation) << "AnimVariantMap ="; for (auto& pair : _map) { diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index bc4dca54f2..7842ec0804 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -1207,9 +1207,7 @@ void Rig::updateAnimations(float deltaTime, const glm::mat4& rootTransform, cons _networkPoseSet._relativePoses = _animSkeleton->getRelativeDefaultPoses(); } _lastAnimVars = _animVars; - _animVars.clearTriggers(); _animVars = triggersOut; - _networkVars.clearTriggers(); _networkVars = networkTriggersOut; _lastContext = context; } diff --git a/tests/animation/CMakeLists.txt b/tests/animation/CMakeLists.txt index 17999c4d8e..2af4d5f2cd 100644 --- a/tests/animation/CMakeLists.txt +++ b/tests/animation/CMakeLists.txt @@ -1,7 +1,7 @@ # Declare dependencies macro (setup_testcase_dependencies) # link in the shared libraries - link_hifi_libraries(shared animation gpu fbx graphics networking test-utils) + link_hifi_libraries(shared animation gpu fbx hfm graphics networking test-utils) package_libraries_for_deployment() endmacro () diff --git a/tests/animation/src/AnimInverseKinematicsTests.cpp b/tests/animation/src/AnimInverseKinematicsTests.cpp index 910770bb0d..708b1b2d2a 100644 --- a/tests/animation/src/AnimInverseKinematicsTests.cpp +++ b/tests/animation/src/AnimInverseKinematicsTests.cpp @@ -143,7 +143,7 @@ void AnimInverseKinematicsTests::testSingleChain() { ikDoll.setTargetVars(QString("D"), QString("positionD"), QString("rotationD"), QString("targetTypeD"), QString("weightD"), 1.0f, flexCoefficients, QString("poleVectorEnabledD"), QString("poleReferenceVectorD"), QString("poleVectorD")); - AnimNode::Triggers triggers; + AnimVariantMap triggers; // the IK solution should be: // @@ -236,7 +236,7 @@ void AnimInverseKinematicsTests::testSingleChain() { ikDoll.setTargetVars(QString("D"), QString("positionD"), QString("rotationD"), QString("targetTypeD"), QString("weightD"), 1.0f, flexCoefficients, QString("poleVectorEnabledD"), QString("poleReferenceVectorD"), QString("poleVectorD")); - AnimNode::Triggers triggers; + AnimVariantMap triggers; // the IK solution should be: // diff --git a/tests/animation/src/AnimTests.cpp b/tests/animation/src/AnimTests.cpp index 01c8d1c1b6..0cd9571e22 100644 --- a/tests/animation/src/AnimTests.cpp +++ b/tests/animation/src/AnimTests.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -33,6 +34,7 @@ void AnimTests::initTestCase() { DependencyManager::set(NodeType::Agent); DependencyManager::set(); DependencyManager::set(); + DependencyManager::set(); DependencyManager::set(); DependencyManager::set(); } @@ -84,26 +86,26 @@ void AnimTests::testClipEvaulate() { AnimClip clip(id, url, startFrame, endFrame, timeScale, loopFlag, mirrorFlag); - AnimNode::Triggers triggers; + AnimVariantMap triggers; clip.evaluate(vars, context, framesToSec(10.0f), triggers); QCOMPARE_WITH_ABS_ERROR(clip._frame, 12.0f, TEST_EPSILON); // does it loop? - triggers.clear(); + triggers.clearMap(); clip.evaluate(vars, context, framesToSec(12.0f), triggers); QCOMPARE_WITH_ABS_ERROR(clip._frame, 3.0f, TEST_EPSILON); // Note: frame 3 and not 4, because extra frame between start and end. // did we receive a loop trigger? - QVERIFY(std::find(triggers.begin(), triggers.end(), "myClipNodeOnLoop") != triggers.end()); + QVERIFY(triggers.hasKey("myClipNodeOnLoop")); // does it pause at end? - triggers.clear(); + triggers.clearMap(); clip.setLoopFlagVar("FalseVar"); clip.evaluate(vars, context, framesToSec(20.0f), triggers); QCOMPARE_WITH_ABS_ERROR(clip._frame, 22.0f, TEST_EPSILON); // did we receive a done trigger? - QVERIFY(std::find(triggers.begin(), triggers.end(), "myClipNodeOnDone") != triggers.end()); + QVERIFY(triggers.hasKey("myClipNodeOnDone")); } void AnimTests::testClipEvaulateWithVars() { @@ -133,7 +135,7 @@ void AnimTests::testClipEvaulateWithVars() { clip.setTimeScaleVar("timeScale2"); clip.setLoopFlagVar("loopFlag2"); - AnimNode::Triggers triggers; + AnimVariantMap triggers; clip.evaluate(vars, context, framesToSec(0.1f), triggers); // verify that the values from the AnimVariantMap made it into the clipNode's @@ -284,11 +286,11 @@ void AnimTests::testAccumulateTime() { timeScale = 1.0f; float dt = 1.0f; QString id = "testNode"; - AnimNode::Triggers triggers; + AnimVariantMap triggers; float loopFlag = true; float resultFrame = accumulateTime(startFrame, endFrame, timeScale, startFrame, dt, loopFlag, id, triggers); // a one frame looping animation should NOT trigger onLoop events - QVERIFY(triggers.empty()); + QVERIFY(!triggers.hasKey("testNodeOnLoop")); const uint32_t MAX_TRIGGER_COUNT = 3; @@ -296,45 +298,45 @@ void AnimTests::testAccumulateTime() { endFrame = 1.1f; timeScale = 10.0f; dt = 10.0f; - triggers.clear(); + triggers.clearMap(); loopFlag = true; resultFrame = accumulateTime(startFrame, endFrame, timeScale, startFrame, dt, loopFlag, id, triggers); - // a short animation with a large dt & a large timescale, should only create a MAXIMUM of 3 loop events. - QVERIFY(triggers.size() <= MAX_TRIGGER_COUNT); + // a short animation with a large dt & a large timescale, should generate a onLoop event. + QVERIFY(triggers.hasKey("testNodeOnLoop")); } void AnimTests::testAccumulateTimeWithParameters(float startFrame, float endFrame, float timeScale) const { float dt = (1.0f / 30.0f) / timeScale; // sec QString id = "testNode"; - AnimNode::Triggers triggers; + AnimVariantMap triggers; bool loopFlag = false; float resultFrame = accumulateTime(startFrame, endFrame, timeScale, startFrame, dt, loopFlag, id, triggers); QVERIFY(resultFrame == startFrame + 1.0f); - QVERIFY(triggers.empty()); - triggers.clear(); + QVERIFY(!triggers.hasKey("testNodeOnLoop")); + triggers.clearMap(); resultFrame = accumulateTime(startFrame, endFrame, timeScale, resultFrame, dt, loopFlag, id, triggers); QVERIFY(resultFrame == startFrame + 2.0f); - QVERIFY(triggers.empty()); - triggers.clear(); + QVERIFY(!triggers.hasKey("testNodeOnLoop")); + triggers.clearMap(); resultFrame = accumulateTime(startFrame, endFrame, timeScale, resultFrame, dt, loopFlag, id, triggers); QVERIFY(resultFrame == startFrame + 3.0f); - QVERIFY(triggers.empty()); - triggers.clear(); + QVERIFY(!triggers.hasKey("testNodeOnLoop")); + triggers.clearMap(); // test onDone trigger and frame clamping. resultFrame = accumulateTime(startFrame, endFrame, timeScale, endFrame - 1.0f, dt, loopFlag, id, triggers); QVERIFY(resultFrame == endFrame); - QVERIFY(!triggers.empty() && triggers[0] == "testNodeOnDone"); - triggers.clear(); + QVERIFY(triggers.hasKey("testNodeOnDone")); + triggers.clearMap(); resultFrame = accumulateTime(startFrame, endFrame, timeScale, endFrame - 0.5f, dt, loopFlag, id, triggers); QVERIFY(resultFrame == endFrame); - QVERIFY(!triggers.empty() && triggers[0] == "testNodeOnDone"); - triggers.clear(); + QVERIFY(triggers.hasKey("testNodeOnDone")); + triggers.clearMap(); // test onLoop trigger and looping frame logic loopFlag = true; @@ -342,26 +344,26 @@ void AnimTests::testAccumulateTimeWithParameters(float startFrame, float endFram // should NOT trigger loop even though we stop at last frame, because there is an extra frame between end and start frames. resultFrame = accumulateTime(startFrame, endFrame, timeScale, endFrame - 1.0f, dt, loopFlag, id, triggers); QVERIFY(resultFrame == endFrame); - QVERIFY(triggers.empty()); - triggers.clear(); + QVERIFY(!triggers.hasKey("testNodeOnLoop")); + triggers.clearMap(); // now we should hit loop trigger resultFrame = accumulateTime(startFrame, endFrame, timeScale, resultFrame, dt, loopFlag, id, triggers); QVERIFY(resultFrame == startFrame); - QVERIFY(!triggers.empty() && triggers[0] == "testNodeOnLoop"); - triggers.clear(); + QVERIFY(triggers.hasKey("testNodeOnLoop")); + triggers.clearMap(); // should NOT trigger loop, even though we move past the end frame, because of extra frame between end and start. resultFrame = accumulateTime(startFrame, endFrame, timeScale, endFrame - 0.5f, dt, loopFlag, id, triggers); QVERIFY(resultFrame == endFrame + 0.5f); - QVERIFY(triggers.empty()); - triggers.clear(); + QVERIFY(!triggers.hasKey("testNodeOnLoop")); + triggers.clearMap(); // now we should hit loop trigger resultFrame = accumulateTime(startFrame, endFrame, timeScale, resultFrame, dt, loopFlag, id, triggers); QVERIFY(resultFrame == startFrame + 0.5f); - QVERIFY(!triggers.empty() && triggers[0] == "testNodeOnLoop"); - triggers.clear(); + QVERIFY(triggers.hasKey("testNodeOnLoop")); + triggers.clearMap(); } void AnimTests::testAnimPose() { From f4118213b15fa12082a73990ed70e9af0678d0bf Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Fri, 1 Feb 2019 10:12:04 -0800 Subject: [PATCH 3/3] give tablet root color --- .../qml/hifi/commerce/common/sendAsset/SendAsset.qml | 3 +-- interface/resources/qml/hifi/tablet/TabletRoot.qml | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/common/sendAsset/SendAsset.qml b/interface/resources/qml/hifi/commerce/common/sendAsset/SendAsset.qml index bc8816e0ea..68d437a346 100644 --- a/interface/resources/qml/hifi/commerce/common/sendAsset/SendAsset.qml +++ b/interface/resources/qml/hifi/commerce/common/sendAsset/SendAsset.qml @@ -21,11 +21,10 @@ import "../../../../controls" as HifiControls import "../" as HifiCommerceCommon import "qrc:////qml//hifi//models" as HifiModels // Absolute path so the same code works everywhere. -Rectangle { +Item { HifiConstants { id: hifi; } id: root; - color: hifi.colors.baseGray property int parentAppTitleBarHeight; property int parentAppNavBarHeight; property string currentActiveView: "sendAssetHome"; diff --git a/interface/resources/qml/hifi/tablet/TabletRoot.qml b/interface/resources/qml/hifi/tablet/TabletRoot.qml index b19dcbb919..93a23f1b9d 100644 --- a/interface/resources/qml/hifi/tablet/TabletRoot.qml +++ b/interface/resources/qml/hifi/tablet/TabletRoot.qml @@ -3,10 +3,13 @@ import Hifi 1.0 import "../../dialogs" import "../../controls" +import stylesUit 1.0 -Item { +Rectangle { + HifiConstants { id: hifi; } id: tabletRoot objectName: "tabletRoot" + color: hifi.colors.baseGray property string username: "Unknown user" property string usernameShort: "Unknown user" property var rootMenu;