mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 04:44:11 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into hdr
This commit is contained in:
commit
ff82fcae56
6 changed files with 93 additions and 9 deletions
|
@ -14,6 +14,7 @@
|
|||
#include <QFile>
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkRequest>
|
||||
#include <QMetaEnum>
|
||||
|
||||
#include <SharedUtil.h>
|
||||
|
||||
|
@ -78,10 +79,36 @@ void HTTPResourceRequest::onRequestFinished() {
|
|||
_loadedFromCache = _reply->attribute(QNetworkRequest::SourceIsFromCacheAttribute).toBool();
|
||||
_result = Success;
|
||||
break;
|
||||
|
||||
case QNetworkReply::TimeoutError:
|
||||
_result = Timeout;
|
||||
break;
|
||||
|
||||
case QNetworkReply::ContentNotFoundError: // Script.include('https://httpbin.org/status/404')
|
||||
_result = NotFound;
|
||||
break;
|
||||
|
||||
case QNetworkReply::ProtocolInvalidOperationError: // Script.include('https://httpbin.org/status/400')
|
||||
_result = InvalidURL;
|
||||
break;
|
||||
|
||||
case QNetworkReply::UnknownContentError: // Script.include('QUrl("https://httpbin.org/status/402")')
|
||||
case QNetworkReply::ContentOperationNotPermittedError: //Script.include('https://httpbin.org/status/403')
|
||||
case QNetworkReply::AuthenticationRequiredError: // Script.include('https://httpbin.org/basic-auth/user/passwd')
|
||||
_result = AccessDenied;
|
||||
break;
|
||||
|
||||
case QNetworkReply::RemoteHostClosedError: // Script.include('http://127.0.0.1:22')
|
||||
case QNetworkReply::ConnectionRefusedError: // Script.include(http://127.0.0.1:1')
|
||||
case QNetworkReply::HostNotFoundError: // Script.include('http://foo.bar.highfidelity.io')
|
||||
case QNetworkReply::ServiceUnavailableError: // Script.include('QUrl("https://httpbin.org/status/503")')
|
||||
_result = ServerUnavailable;
|
||||
break;
|
||||
|
||||
case QNetworkReply::UnknownServerError: // Script.include('QUrl("https://httpbin.org/status/504")')
|
||||
case QNetworkReply::InternalServerError: // Script.include('QUrl("https://httpbin.org/status/500")')
|
||||
default:
|
||||
qDebug() << "HTTPResourceRequest error:" << QMetaEnum::fromType<QNetworkReply::NetworkError>().valueToKey(_reply->error());
|
||||
_result = Error;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -55,7 +55,8 @@ void BatchLoader::start() {
|
|||
// Use a proxy callback to handle the call and emit the signal in a thread-safe way.
|
||||
// If BatchLoader is deleted before the callback is called, the subsequent "emit" call will not do
|
||||
// anything.
|
||||
ScriptCacheSignalProxy* proxy = new ScriptCacheSignalProxy(scriptCache.data());
|
||||
ScriptCacheSignalProxy* proxy = new ScriptCacheSignalProxy();
|
||||
connect(scriptCache.data(), &ScriptCache::destroyed, proxy, &ScriptCacheSignalProxy::deleteLater);
|
||||
|
||||
connect(proxy, &ScriptCacheSignalProxy::contentAvailable, this, [this](const QString& url, const QString& contents, bool isURL, bool success) {
|
||||
if (isURL && success) {
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
class ScriptCacheSignalProxy : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ScriptCacheSignalProxy(QObject* parent) : QObject(parent) { }
|
||||
void receivedContent(const QString& url, const QString& contents, bool isURL, bool success);
|
||||
|
||||
signals:
|
||||
|
|
|
@ -202,7 +202,14 @@ void ScriptCache::scriptContentAvailable() {
|
|||
finished = true;
|
||||
qCDebug(scriptengine) << "Done downloading script at:" << url.toString();
|
||||
} else {
|
||||
if (scriptRequest.numRetries < MAX_RETRIES) {
|
||||
auto result = req->getResult();
|
||||
bool irrecoverable =
|
||||
result == ResourceRequest::AccessDenied ||
|
||||
result == ResourceRequest::InvalidURL ||
|
||||
result == ResourceRequest::NotFound ||
|
||||
scriptRequest.numRetries >= MAX_RETRIES;
|
||||
|
||||
if (!irrecoverable) {
|
||||
++scriptRequest.numRetries;
|
||||
|
||||
qDebug() << "Script request failed: " << url;
|
||||
|
@ -222,6 +229,9 @@ void ScriptCache::scriptContentAvailable() {
|
|||
});
|
||||
} else {
|
||||
// Dubious, but retained here because it matches the behavior before fixing the threading
|
||||
|
||||
allCallbacks = scriptRequest.scriptUsers;
|
||||
|
||||
scriptContent = _scriptCache[url];
|
||||
finished = true;
|
||||
qCWarning(scriptengine) << "Error loading script from URL " << url;
|
||||
|
|
|
@ -248,7 +248,7 @@
|
|||
}
|
||||
|
||||
function update() {
|
||||
var viewport, diff, x;
|
||||
var viewport, diff, x, gpuTextures;
|
||||
|
||||
initialDelayCooldown -= 30;
|
||||
|
||||
|
@ -261,26 +261,28 @@
|
|||
}
|
||||
}
|
||||
|
||||
gpuTextures = Render.getConfig("Stats").textureGPUTransferCount;
|
||||
|
||||
// Update state
|
||||
if (!visible) { // Not visible because no recent downloads
|
||||
if (displayProgress < 100) { // Have started downloading so fade in
|
||||
if (displayProgress < 100 || gpuTextures > 0) { // Have started downloading so fade in
|
||||
visible = true;
|
||||
alphaDelta = ALPHA_DELTA_IN;
|
||||
fadeTimer = Script.setInterval(fade, FADE_INTERVAL);
|
||||
}
|
||||
} else if (alphaDelta !== 0.0) { // Fading in or out
|
||||
if (alphaDelta > 0) {
|
||||
if (rawProgress === 100) { // Was downloading but now have finished so fade out
|
||||
if (rawProgress === 100 && gpuTextures === 0) { // Was downloading but now have finished so fade out
|
||||
alphaDelta = ALPHA_DELTA_OUT;
|
||||
}
|
||||
} else {
|
||||
if (displayProgress < 100) { // Was finished downloading but have resumed so fade in
|
||||
if (displayProgress < 100 || gpuTextures > 0) { // Was finished downloading but have resumed so fade in
|
||||
alphaDelta = ALPHA_DELTA_IN;
|
||||
}
|
||||
}
|
||||
} else { // Fully visible because downloading or recently so
|
||||
if (fadeWaitTimer === null) {
|
||||
if (rawProgress === 100) { // Was downloading but have finished so fade out soon
|
||||
if (rawProgress === 100 && gpuTextures === 0) { // Was downloading but have finished so fade out soon
|
||||
fadeWaitTimer = Script.setTimeout(function () {
|
||||
alphaDelta = ALPHA_DELTA_OUT;
|
||||
fadeTimer = Script.setInterval(fade, FADE_INTERVAL);
|
||||
|
@ -288,7 +290,8 @@
|
|||
}, FADE_OUT_WAIT);
|
||||
}
|
||||
} else {
|
||||
if (displayProgress < 100) { // Was finished and waiting to fade out but have resumed so don't fade out
|
||||
if (displayProgress < 100 || gpuTextures > 0) { // Was finished and waiting to fade out but have resumed so
|
||||
// don't fade out
|
||||
Script.clearInterval(fadeWaitTimer);
|
||||
fadeWaitTimer = null;
|
||||
}
|
||||
|
|
44
tools/atp-extract.py
Normal file
44
tools/atp-extract.py
Normal file
|
@ -0,0 +1,44 @@
|
|||
#
|
||||
# Tool to extract atp files from the asset server cache.
|
||||
# Usage: python2 atp-extract.py -[lxa] [filename]
|
||||
#
|
||||
# cd into the c:\Users\BettySpaghetti\AppData\Roaming\High Fidelity\assignment-client\assets dir
|
||||
# run 'python2 atp-extract.py -l' to list all files
|
||||
# run 'python2 atp-extract.py -x file' to extract that particular file to the current directory.
|
||||
# run 'python2 atp-extract.py -a' to extract all files.
|
||||
#
|
||||
|
||||
import os, json, sys, shutil
|
||||
|
||||
def loadMapFile(filename):
|
||||
with open(filename, 'r') as f:
|
||||
return json.load(f)
|
||||
|
||||
def extractFile(assetMap, filename):
|
||||
if filename != None:
|
||||
assetFilename = assetMap.get("/" + filename)
|
||||
if assetFilename != None:
|
||||
dir = os.path.dirname(filename)
|
||||
if dir != "" and not os.path.exists(dir):
|
||||
os.makedirs(dir)
|
||||
shutil.copy("files/" + assetFilename, filename)
|
||||
return True
|
||||
return False
|
||||
|
||||
option = sys.argv[1]
|
||||
if option == '-l':
|
||||
assetMap = loadMapFile("map.json")
|
||||
for key, value in assetMap.iteritems():
|
||||
print key[1:]
|
||||
elif option == '-x':
|
||||
assetMap = loadMapFile("map.json")
|
||||
outputFilename = sys.argv[2]
|
||||
if not extractFile(assetMap, outputFilename):
|
||||
print("Error could not extract file: \"" + outputFilename + "\"")
|
||||
elif option == '-a':
|
||||
assetMap = loadMapFile("map.json")
|
||||
for key, value in assetMap.iteritems():
|
||||
print("Extracting " + key[1:])
|
||||
extractFile(assetMap, key[1:])
|
||||
else:
|
||||
print("unsuported option \"" + option + "\"")
|
Loading…
Reference in a new issue