From dd1525c9b75df5f969681907979abd001be49ae8 Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Tue, 30 Apr 2019 12:27:08 -0700 Subject: [PATCH 1/9] First version of BackTrace upload python script. --- hifi_backtrace_post.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 hifi_backtrace_post.py diff --git a/hifi_backtrace_post.py b/hifi_backtrace_post.py new file mode 100644 index 0000000000..7df9b867a2 --- /dev/null +++ b/hifi_backtrace_post.py @@ -0,0 +1,18 @@ +# Parameters: +# 1 - $BACKTRACE_UPLOAD_TOKEN +# 2 - $SYMBOLS_ARCHIVE +# 3 - $RELEASE_NUMBER +# +import sys +import urllib.request +import urllib.parse + +post_headers = {} +post_headers['Content-Type'] = 'application/json' +post_headers['Expect'] = '' + +post_url = 'https://highfidelity.sp.backtrace.io:6098/post?format=symbols&token=' + sys.argv[1] + '&upload_file=' + sys.argv[2] + '&tag=' + sys.argv[3] +post_data = open(sys.argv[1], 'rb') + +post_request = urllib.request.Request(post_url, post_data, post_headers) +post_response = urllib.request.urlopen(post_request) From 5c6ea082dbf9c93205cd9e414de127283eeabba1 Mon Sep 17 00:00:00 2001 From: Angus Antley Date: Tue, 30 Apr 2019 14:06:18 -0700 Subject: [PATCH 2/9] changed away script to make you active if you turn on your mic --- scripts/system/away.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/scripts/system/away.js b/scripts/system/away.js index e45041139a..c1bbfe67c4 100644 --- a/scripts/system/away.js +++ b/scripts/system/away.js @@ -203,7 +203,7 @@ function setAwayProperties() { if (!wasMuted) { Audio.muted = !Audio.muted; } - MyAvatar.setEnableMeshVisible(false); // just for our own display, without changing point of view + MyAvatar.setEnableMeshVisible(false); // just for our own display, without changing point of view playAwayAnimation(); // animation is still seen by others showOverlay(); @@ -223,8 +223,8 @@ function setAwayProperties() { function setActiveProperties() { isAway = false; - if (!wasMuted) { - Audio.muted = !Audio.muted; + if ((Audio.muted === true) && (wasMuted === false)) { + Audio.muted = false; } MyAvatar.setEnableMeshVisible(true); // IWBNI we respected Developer->Avatar->Draw Mesh setting. stopAwayAnimation(); @@ -254,7 +254,7 @@ function setActiveProperties() { } function maybeGoActive(event) { - if (event.isAutoRepeat) { // isAutoRepeat is true when held down (or when Windows feels like it) + if (event.isAutoRepeat) { // isAutoRepeat is true when held down (or when Windows feels like it) return; } if (!isAway && (event.text === 'ESC')) { @@ -314,6 +314,13 @@ function setEnabled(value) { isEnabled = value; } +function checkAudioToggled() { + if (isAway && !Audio.muted) { + goActive(); + } +} + + var CHANNEL_AWAY_ENABLE = "Hifi-Away-Enable"; var handleMessage = function(channel, message, sender) { if (channel === CHANNEL_AWAY_ENABLE && sender === MyAvatar.sessionUUID) { @@ -324,9 +331,10 @@ var handleMessage = function(channel, message, sender) { Messages.subscribe(CHANNEL_AWAY_ENABLE); Messages.messageReceived.connect(handleMessage); -var maybeIntervalTimer = Script.setInterval(function(){ +var maybeIntervalTimer = Script.setInterval(function() { maybeMoveOverlay(); maybeGoAway(); + checkAudioToggled(); }, BASIC_TIMER_INTERVAL); From 125d182773dcd1c8414d789f18038152f9d95b7f Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Tue, 30 Apr 2019 14:09:16 -0700 Subject: [PATCH 3/9] Added try/except blocks. --- hifi_backtrace_post.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/hifi_backtrace_post.py b/hifi_backtrace_post.py index 7df9b867a2..96dcee5c8f 100644 --- a/hifi_backtrace_post.py +++ b/hifi_backtrace_post.py @@ -12,7 +12,23 @@ post_headers['Content-Type'] = 'application/json' post_headers['Expect'] = '' post_url = 'https://highfidelity.sp.backtrace.io:6098/post?format=symbols&token=' + sys.argv[1] + '&upload_file=' + sys.argv[2] + '&tag=' + sys.argv[3] -post_data = open(sys.argv[1], 'rb') -post_request = urllib.request.Request(post_url, post_data, post_headers) -post_response = urllib.request.urlopen(post_request) +try: + post_data = open(sys.argv[2], 'rb') +except: + print('file ' + sys.argv[2] + ' not found') + exit() + +try: + post_request = urllib.request.Request(post_url, post_data, post_headers) +except: + print('urllib.request.Request failed') + exit() + +try: + post_response = urllib.request.urlopen(post_request) +except: + print('urllib.request.urlopen failed') + exit() + +print("No errors") \ No newline at end of file From c0da46453be075757664a2b06a28c73a2f72d370 Mon Sep 17 00:00:00 2001 From: Angus Antley Date: Tue, 30 Apr 2019 14:34:10 -0700 Subject: [PATCH 4/9] made correction --- scripts/system/away.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/away.js b/scripts/system/away.js index c1bbfe67c4..5180588e9d 100644 --- a/scripts/system/away.js +++ b/scripts/system/away.js @@ -223,7 +223,7 @@ function setAwayProperties() { function setActiveProperties() { isAway = false; - if ((Audio.muted === true) && (wasMuted === false)) { + if (Audio.muted && !wasMuted) { Audio.muted = false; } MyAvatar.setEnableMeshVisible(true); // IWBNI we respected Developer->Avatar->Draw Mesh setting. From 867f1f80df94aae71fe678b167653f37b4e3c7ef Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Tue, 30 Apr 2019 15:26:39 -0700 Subject: [PATCH 5/9] Improved messages. --- hifi_backtrace_post.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hifi_backtrace_post.py b/hifi_backtrace_post.py index 96dcee5c8f..b55e72fde9 100644 --- a/hifi_backtrace_post.py +++ b/hifi_backtrace_post.py @@ -7,6 +7,8 @@ import sys import urllib.request import urllib.parse +print("Running python script to upload to BackTrace") + post_headers = {} post_headers['Content-Type'] = 'application/json' post_headers['Expect'] = '' @@ -18,7 +20,7 @@ try: except: print('file ' + sys.argv[2] + ' not found') exit() - + try: post_request = urllib.request.Request(post_url, post_data, post_headers) except: @@ -31,4 +33,4 @@ except: print('urllib.request.urlopen failed') exit() -print("No errors") \ No newline at end of file +print("Upload to BackTrace completed without errors") \ No newline at end of file From 73454b06a234488bb1bf962ab5e869ad2cd7a6cd Mon Sep 17 00:00:00 2001 From: luiscuenca Date: Wed, 1 May 2019 08:57:09 -0700 Subject: [PATCH 6/9] Fix crash accessing _modelJointIndicesCache --- .../src/avatars-renderer/Avatar.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp index 204ed79660..73e623223e 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp @@ -1428,7 +1428,7 @@ int Avatar::getJointIndex(const QString& name) const { withValidJointIndicesCache([&]() { if (_modelJointIndicesCache.contains(name)) { - result = _modelJointIndicesCache[name] - 1; + result = _modelJointIndicesCache.value(name) - 1; } }); return result; @@ -1439,22 +1439,22 @@ QStringList Avatar::getJointNames() const { withValidJointIndicesCache([&]() { // find out how large the vector needs to be int maxJointIndex = -1; - QHashIterator k(_modelJointIndicesCache); - while (k.hasNext()) { - k.next(); + QHash::const_iterator k = _modelJointIndicesCache.constBegin(); + while (k != _modelJointIndicesCache.constEnd()) { int index = k.value(); if (index > maxJointIndex) { maxJointIndex = index; } + ++k; } // iterate through the hash and put joint names // into the vector at their indices QVector resultVector(maxJointIndex+1); - QHashIterator i(_modelJointIndicesCache); - while (i.hasNext()) { - i.next(); + QHash::const_iterator i = _modelJointIndicesCache.constBegin(); + while (i != _modelJointIndicesCache.constEnd()) { int index = i.value(); resultVector[index] = i.key(); + ++i; } // convert to QList and drop out blanks result = resultVector.toList(); From b9e2174fe9e3c2e4a7fc682a74d20f65fb4eb43d Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Wed, 1 May 2019 10:10:28 -0700 Subject: [PATCH 7/9] Use exit(1) on errors --- hifi_backtrace_post.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hifi_backtrace_post.py b/hifi_backtrace_post.py index b55e72fde9..a6871ef535 100644 --- a/hifi_backtrace_post.py +++ b/hifi_backtrace_post.py @@ -19,18 +19,18 @@ try: post_data = open(sys.argv[2], 'rb') except: print('file ' + sys.argv[2] + ' not found') - exit() + exit(1) try: post_request = urllib.request.Request(post_url, post_data, post_headers) except: print('urllib.request.Request failed') - exit() + exit(1) try: post_response = urllib.request.urlopen(post_request) except: print('urllib.request.urlopen failed') - exit() + exit(1) print("Upload to BackTrace completed without errors") \ No newline at end of file From 9dfcb675ca36b270efd7917e5ebee7ba257161a7 Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Wed, 1 May 2019 10:47:40 -0700 Subject: [PATCH 8/9] Moved script. --- hifi_backtrace_post.py => tools/ci-scripts/hifi_backtrace_post.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename hifi_backtrace_post.py => tools/ci-scripts/hifi_backtrace_post.py (100%) diff --git a/hifi_backtrace_post.py b/tools/ci-scripts/hifi_backtrace_post.py similarity index 100% rename from hifi_backtrace_post.py rename to tools/ci-scripts/hifi_backtrace_post.py From 6e2ac14c23ac91183d8b8dc30c2ade6ed9f8dc34 Mon Sep 17 00:00:00 2001 From: luiscuenca Date: Wed, 1 May 2019 12:42:41 -0700 Subject: [PATCH 9/9] Change while loops --- .../avatars-renderer/src/avatars-renderer/Avatar.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp index 73e623223e..cb0acd68cb 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp @@ -1439,22 +1439,18 @@ QStringList Avatar::getJointNames() const { withValidJointIndicesCache([&]() { // find out how large the vector needs to be int maxJointIndex = -1; - QHash::const_iterator k = _modelJointIndicesCache.constBegin(); - while (k != _modelJointIndicesCache.constEnd()) { + for (auto k = _modelJointIndicesCache.constBegin(); k != _modelJointIndicesCache.constEnd(); k++) { int index = k.value(); if (index > maxJointIndex) { maxJointIndex = index; } - ++k; } // iterate through the hash and put joint names // into the vector at their indices QVector resultVector(maxJointIndex+1); - QHash::const_iterator i = _modelJointIndicesCache.constBegin(); - while (i != _modelJointIndicesCache.constEnd()) { + for (auto i = _modelJointIndicesCache.constBegin(); i != _modelJointIndicesCache.constEnd(); i++) { int index = i.value(); resultVector[index] = i.key(); - ++i; } // convert to QList and drop out blanks result = resultVector.toList();