Merge branch 'master' of https://github.com/highfidelity/hifi into brown

This commit is contained in:
Sam Gateau 2019-02-04 19:16:14 -08:00
commit 99251bdd6d
9 changed files with 52 additions and 48 deletions

View file

@ -21,11 +21,10 @@ import "../../../../controls" as HifiControls
import "../" as HifiCommerceCommon import "../" as HifiCommerceCommon
import "qrc:////qml//hifi//models" as HifiModels // Absolute path so the same code works everywhere. import "qrc:////qml//hifi//models" as HifiModels // Absolute path so the same code works everywhere.
Rectangle { Item {
HifiConstants { id: hifi; } HifiConstants { id: hifi; }
id: root; id: root;
color: hifi.colors.baseGray
property int parentAppTitleBarHeight; property int parentAppTitleBarHeight;
property int parentAppNavBarHeight; property int parentAppNavBarHeight;
property string currentActiveView: "sendAssetHome"; property string currentActiveView: "sendAssetHome";

View file

@ -3,10 +3,13 @@ import Hifi 1.0
import "../../dialogs" import "../../dialogs"
import "../../controls" import "../../controls"
import stylesUit 1.0
Item { Rectangle {
HifiConstants { id: hifi; }
id: tabletRoot id: tabletRoot
objectName: "tabletRoot" objectName: "tabletRoot"
color: hifi.colors.baseGray
property string username: "Unknown user" property string username: "Unknown user"
property string usernameShort: "Unknown user" property string usernameShort: "Unknown user"
property var rootMenu; property var rootMenu;

View file

@ -761,6 +761,11 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
static const auto SUPPRESS_SETTINGS_RESET = "--suppress-settings-reset"; static const auto SUPPRESS_SETTINGS_RESET = "--suppress-settings-reset";
bool suppressPrompt = cmdOptionExists(argc, const_cast<const char**>(argv), SUPPRESS_SETTINGS_RESET); bool suppressPrompt = cmdOptionExists(argc, const_cast<const char**>(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<const char**>(argv), OCULUS_STORE_ARG);
qApp->setProperty(hifi::properties::OCULUS_STORE, isStore);
// Ignore any previous crashes if running from command line with a test script. // Ignore any previous crashes if running from command line with a test script.
bool inTestMode { false }; bool inTestMode { false };
for (int i = 0; i < argc; ++i) { 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."; qCDebug(interfaceapp) << "[VERSION] We will use DEVELOPMENT global services.";
#endif #endif
// set the OCULUS_STORE property so the oculus plugin can know if we ran from the Oculus Store bool isStore = property(hifi::properties::OCULUS_STORE).toBool();
static const QString OCULUS_STORE_ARG = "--oculus-store";
bool isStore = arguments().indexOf(OCULUS_STORE_ARG) != -1;
setProperty(hifi::properties::OCULUS_STORE, isStore);
DependencyManager::get<WalletScriptingInterface>()->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? DependencyManager::get<WalletScriptingInterface>()->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(); updateHeartbeat();

View file

@ -154,7 +154,7 @@ void AnimBlendLinearMove::setFrameAndPhase(float dt, float alpha, int prevPoseIn
// detect loop trigger events // detect loop trigger events
if (_phase >= 1.0f) { if (_phase >= 1.0f) {
triggersOut.setTrigger(_id + "Loop"); triggersOut.setTrigger(_id + "OnLoop");
_phase = glm::fract(_phase); _phase = glm::fract(_phase);
} }

View file

@ -209,15 +209,14 @@ public:
void set(const QString& key, const QString& value) { _map[key] = AnimVariant(value); } void set(const QString& key, const QString& value) { _map[key] = AnimVariant(value); }
void unset(const QString& key) { _map.erase(key); } void unset(const QString& key) { _map.erase(key); }
void setTrigger(const QString& key) { _triggers.insert(key); } void setTrigger(const QString& key) { _map[key] = AnimVariant(true); }
void clearTriggers() { _triggers.clear(); }
void setRigToGeometryTransform(const glm::mat4& rigToGeometry) { void setRigToGeometryTransform(const glm::mat4& rigToGeometry) {
_rigToGeometryMat = rigToGeometry; _rigToGeometryMat = rigToGeometry;
_rigToGeometryRot = glmExtractRotation(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(); } bool hasKey(const QString& key) const { return _map.find(key) != _map.end(); }
const AnimVariant& get(const QString& key) const { const AnimVariant& get(const QString& key) const {
@ -238,7 +237,7 @@ public:
// For stat debugging. // For stat debugging.
std::map<QString, QString> toDebugMap() const; std::map<QString, QString> toDebugMap() const;
#ifdef NDEBUG #ifndef NDEBUG
void dump() const { void dump() const {
qCDebug(animation) << "AnimVariantMap ="; qCDebug(animation) << "AnimVariantMap =";
for (auto& pair : _map) { for (auto& pair : _map) {

View file

@ -1207,9 +1207,7 @@ void Rig::updateAnimations(float deltaTime, const glm::mat4& rootTransform, cons
_networkPoseSet._relativePoses = _animSkeleton->getRelativeDefaultPoses(); _networkPoseSet._relativePoses = _animSkeleton->getRelativeDefaultPoses();
} }
_lastAnimVars = _animVars; _lastAnimVars = _animVars;
_animVars.clearTriggers();
_animVars = triggersOut; _animVars = triggersOut;
_networkVars.clearTriggers();
_networkVars = networkTriggersOut; _networkVars = networkTriggersOut;
_lastContext = context; _lastContext = context;
} }

View file

@ -1,7 +1,7 @@
# Declare dependencies # Declare dependencies
macro (setup_testcase_dependencies) macro (setup_testcase_dependencies)
# link in the shared libraries # 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() package_libraries_for_deployment()
endmacro () endmacro ()

View file

@ -143,7 +143,7 @@ void AnimInverseKinematicsTests::testSingleChain() {
ikDoll.setTargetVars(QString("D"), QString("positionD"), QString("rotationD"), QString("targetTypeD"), ikDoll.setTargetVars(QString("D"), QString("positionD"), QString("rotationD"), QString("targetTypeD"),
QString("weightD"), 1.0f, flexCoefficients, QString("poleVectorEnabledD"), QString("weightD"), 1.0f, flexCoefficients, QString("poleVectorEnabledD"),
QString("poleReferenceVectorD"), QString("poleVectorD")); QString("poleReferenceVectorD"), QString("poleVectorD"));
AnimNode::Triggers triggers; AnimVariantMap triggers;
// the IK solution should be: // the IK solution should be:
// //
@ -236,7 +236,7 @@ void AnimInverseKinematicsTests::testSingleChain() {
ikDoll.setTargetVars(QString("D"), QString("positionD"), QString("rotationD"), QString("targetTypeD"), ikDoll.setTargetVars(QString("D"), QString("positionD"), QString("rotationD"), QString("targetTypeD"),
QString("weightD"), 1.0f, flexCoefficients, QString("poleVectorEnabledD"), QString("weightD"), 1.0f, flexCoefficients, QString("poleVectorEnabledD"),
QString("poleReferenceVectorD"), QString("poleVectorD")); QString("poleReferenceVectorD"), QString("poleVectorD"));
AnimNode::Triggers triggers; AnimVariantMap triggers;
// the IK solution should be: // the IK solution should be:
// //

View file

@ -19,6 +19,7 @@
#include <AddressManager.h> #include <AddressManager.h>
#include <AccountManager.h> #include <AccountManager.h>
#include <ResourceManager.h> #include <ResourceManager.h>
#include <ResourceRequestObserver.h>
#include <StatTracker.h> #include <StatTracker.h>
#include <test-utils/QTestExtensions.h> #include <test-utils/QTestExtensions.h>
@ -33,6 +34,7 @@ void AnimTests::initTestCase() {
DependencyManager::set<NodeList>(NodeType::Agent); DependencyManager::set<NodeList>(NodeType::Agent);
DependencyManager::set<ResourceManager>(); DependencyManager::set<ResourceManager>();
DependencyManager::set<AnimationCache>(); DependencyManager::set<AnimationCache>();
DependencyManager::set<ResourceRequestObserver>();
DependencyManager::set<ResourceCacheSharedItems>(); DependencyManager::set<ResourceCacheSharedItems>();
DependencyManager::set<StatTracker>(); DependencyManager::set<StatTracker>();
} }
@ -84,26 +86,26 @@ void AnimTests::testClipEvaulate() {
AnimClip clip(id, url, startFrame, endFrame, timeScale, loopFlag, mirrorFlag); AnimClip clip(id, url, startFrame, endFrame, timeScale, loopFlag, mirrorFlag);
AnimNode::Triggers triggers; AnimVariantMap triggers;
clip.evaluate(vars, context, framesToSec(10.0f), triggers); clip.evaluate(vars, context, framesToSec(10.0f), triggers);
QCOMPARE_WITH_ABS_ERROR(clip._frame, 12.0f, TEST_EPSILON); QCOMPARE_WITH_ABS_ERROR(clip._frame, 12.0f, TEST_EPSILON);
// does it loop? // does it loop?
triggers.clear(); triggers.clearMap();
clip.evaluate(vars, context, framesToSec(12.0f), triggers); 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. 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? // 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? // does it pause at end?
triggers.clear(); triggers.clearMap();
clip.setLoopFlagVar("FalseVar"); clip.setLoopFlagVar("FalseVar");
clip.evaluate(vars, context, framesToSec(20.0f), triggers); clip.evaluate(vars, context, framesToSec(20.0f), triggers);
QCOMPARE_WITH_ABS_ERROR(clip._frame, 22.0f, TEST_EPSILON); QCOMPARE_WITH_ABS_ERROR(clip._frame, 22.0f, TEST_EPSILON);
// did we receive a done trigger? // did we receive a done trigger?
QVERIFY(std::find(triggers.begin(), triggers.end(), "myClipNodeOnDone") != triggers.end()); QVERIFY(triggers.hasKey("myClipNodeOnDone"));
} }
void AnimTests::testClipEvaulateWithVars() { void AnimTests::testClipEvaulateWithVars() {
@ -133,7 +135,7 @@ void AnimTests::testClipEvaulateWithVars() {
clip.setTimeScaleVar("timeScale2"); clip.setTimeScaleVar("timeScale2");
clip.setLoopFlagVar("loopFlag2"); clip.setLoopFlagVar("loopFlag2");
AnimNode::Triggers triggers; AnimVariantMap triggers;
clip.evaluate(vars, context, framesToSec(0.1f), triggers); clip.evaluate(vars, context, framesToSec(0.1f), triggers);
// verify that the values from the AnimVariantMap made it into the clipNode's // verify that the values from the AnimVariantMap made it into the clipNode's
@ -284,11 +286,11 @@ void AnimTests::testAccumulateTime() {
timeScale = 1.0f; timeScale = 1.0f;
float dt = 1.0f; float dt = 1.0f;
QString id = "testNode"; QString id = "testNode";
AnimNode::Triggers triggers; AnimVariantMap triggers;
float loopFlag = true; float loopFlag = true;
float resultFrame = accumulateTime(startFrame, endFrame, timeScale, startFrame, dt, loopFlag, id, triggers); float resultFrame = accumulateTime(startFrame, endFrame, timeScale, startFrame, dt, loopFlag, id, triggers);
// a one frame looping animation should NOT trigger onLoop events // a one frame looping animation should NOT trigger onLoop events
QVERIFY(triggers.empty()); QVERIFY(!triggers.hasKey("testNodeOnLoop"));
const uint32_t MAX_TRIGGER_COUNT = 3; const uint32_t MAX_TRIGGER_COUNT = 3;
@ -296,45 +298,45 @@ void AnimTests::testAccumulateTime() {
endFrame = 1.1f; endFrame = 1.1f;
timeScale = 10.0f; timeScale = 10.0f;
dt = 10.0f; dt = 10.0f;
triggers.clear(); triggers.clearMap();
loopFlag = true; loopFlag = true;
resultFrame = accumulateTime(startFrame, endFrame, timeScale, startFrame, dt, loopFlag, id, triggers); 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. // a short animation with a large dt & a large timescale, should generate a onLoop event.
QVERIFY(triggers.size() <= MAX_TRIGGER_COUNT); QVERIFY(triggers.hasKey("testNodeOnLoop"));
} }
void AnimTests::testAccumulateTimeWithParameters(float startFrame, float endFrame, float timeScale) const { void AnimTests::testAccumulateTimeWithParameters(float startFrame, float endFrame, float timeScale) const {
float dt = (1.0f / 30.0f) / timeScale; // sec float dt = (1.0f / 30.0f) / timeScale; // sec
QString id = "testNode"; QString id = "testNode";
AnimNode::Triggers triggers; AnimVariantMap triggers;
bool loopFlag = false; bool loopFlag = false;
float resultFrame = accumulateTime(startFrame, endFrame, timeScale, startFrame, dt, loopFlag, id, triggers); float resultFrame = accumulateTime(startFrame, endFrame, timeScale, startFrame, dt, loopFlag, id, triggers);
QVERIFY(resultFrame == startFrame + 1.0f); QVERIFY(resultFrame == startFrame + 1.0f);
QVERIFY(triggers.empty()); QVERIFY(!triggers.hasKey("testNodeOnLoop"));
triggers.clear(); triggers.clearMap();
resultFrame = accumulateTime(startFrame, endFrame, timeScale, resultFrame, dt, loopFlag, id, triggers); resultFrame = accumulateTime(startFrame, endFrame, timeScale, resultFrame, dt, loopFlag, id, triggers);
QVERIFY(resultFrame == startFrame + 2.0f); QVERIFY(resultFrame == startFrame + 2.0f);
QVERIFY(triggers.empty()); QVERIFY(!triggers.hasKey("testNodeOnLoop"));
triggers.clear(); triggers.clearMap();
resultFrame = accumulateTime(startFrame, endFrame, timeScale, resultFrame, dt, loopFlag, id, triggers); resultFrame = accumulateTime(startFrame, endFrame, timeScale, resultFrame, dt, loopFlag, id, triggers);
QVERIFY(resultFrame == startFrame + 3.0f); QVERIFY(resultFrame == startFrame + 3.0f);
QVERIFY(triggers.empty()); QVERIFY(!triggers.hasKey("testNodeOnLoop"));
triggers.clear(); triggers.clearMap();
// test onDone trigger and frame clamping. // test onDone trigger and frame clamping.
resultFrame = accumulateTime(startFrame, endFrame, timeScale, endFrame - 1.0f, dt, loopFlag, id, triggers); resultFrame = accumulateTime(startFrame, endFrame, timeScale, endFrame - 1.0f, dt, loopFlag, id, triggers);
QVERIFY(resultFrame == endFrame); QVERIFY(resultFrame == endFrame);
QVERIFY(!triggers.empty() && triggers[0] == "testNodeOnDone"); QVERIFY(triggers.hasKey("testNodeOnDone"));
triggers.clear(); triggers.clearMap();
resultFrame = accumulateTime(startFrame, endFrame, timeScale, endFrame - 0.5f, dt, loopFlag, id, triggers); resultFrame = accumulateTime(startFrame, endFrame, timeScale, endFrame - 0.5f, dt, loopFlag, id, triggers);
QVERIFY(resultFrame == endFrame); QVERIFY(resultFrame == endFrame);
QVERIFY(!triggers.empty() && triggers[0] == "testNodeOnDone"); QVERIFY(triggers.hasKey("testNodeOnDone"));
triggers.clear(); triggers.clearMap();
// test onLoop trigger and looping frame logic // test onLoop trigger and looping frame logic
loopFlag = true; 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. // 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); resultFrame = accumulateTime(startFrame, endFrame, timeScale, endFrame - 1.0f, dt, loopFlag, id, triggers);
QVERIFY(resultFrame == endFrame); QVERIFY(resultFrame == endFrame);
QVERIFY(triggers.empty()); QVERIFY(!triggers.hasKey("testNodeOnLoop"));
triggers.clear(); triggers.clearMap();
// now we should hit loop trigger // now we should hit loop trigger
resultFrame = accumulateTime(startFrame, endFrame, timeScale, resultFrame, dt, loopFlag, id, triggers); resultFrame = accumulateTime(startFrame, endFrame, timeScale, resultFrame, dt, loopFlag, id, triggers);
QVERIFY(resultFrame == startFrame); QVERIFY(resultFrame == startFrame);
QVERIFY(!triggers.empty() && triggers[0] == "testNodeOnLoop"); QVERIFY(triggers.hasKey("testNodeOnLoop"));
triggers.clear(); triggers.clearMap();
// should NOT trigger loop, even though we move past the end frame, because of extra frame between end and start. // 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); resultFrame = accumulateTime(startFrame, endFrame, timeScale, endFrame - 0.5f, dt, loopFlag, id, triggers);
QVERIFY(resultFrame == endFrame + 0.5f); QVERIFY(resultFrame == endFrame + 0.5f);
QVERIFY(triggers.empty()); QVERIFY(!triggers.hasKey("testNodeOnLoop"));
triggers.clear(); triggers.clearMap();
// now we should hit loop trigger // now we should hit loop trigger
resultFrame = accumulateTime(startFrame, endFrame, timeScale, resultFrame, dt, loopFlag, id, triggers); resultFrame = accumulateTime(startFrame, endFrame, timeScale, resultFrame, dt, loopFlag, id, triggers);
QVERIFY(resultFrame == startFrame + 0.5f); QVERIFY(resultFrame == startFrame + 0.5f);
QVERIFY(!triggers.empty() && triggers[0] == "testNodeOnLoop"); QVERIFY(triggers.hasKey("testNodeOnLoop"));
triggers.clear(); triggers.clearMap();
} }
void AnimTests::testAnimPose() { void AnimTests::testAnimPose() {