The Reload button re-downloads the script for both the editor and for everyone in the vicinity.
Showing the changes to libraries/script-engine/src/ScriptCache.cpp (1 of 18 files). Show all
Unified · Split
| @@ -27,11 +27,11 @@ ScriptCache::ScriptCache(QObject* parent) { · 26 unmodified lines | ||
| 27 | 27 | // nothing to do here... |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | −QString ScriptCache::getScript(const QUrl& url, ScriptUser* scriptUser, bool& isPending, bool redownload) { | |
| 31 | − assert(!_scriptCache.contains(url) || !redownload); | |
| 30 | +QString ScriptCache::getScript(const QUrl& url, ScriptUser* scriptUser, bool& isPending, bool reload) { | |
| 31 | + assert(!_scriptCache.contains(url) || !reload); | |
| 32 | 32 | |
| 33 | 33 | QString scriptContents; |
| 34 | − if (_scriptCache.contains(url)) { | |
| 34 | + if (_scriptCache.contains(url) && !reload) { | |
| 35 | 35 | qCDebug(scriptengine) << "Found script in cache:" << url.toString(); |
| 36 | 36 | scriptContents = _scriptCache[url]; |
| 37 | 37 | scriptUser->scriptContentsAvailable(url, scriptContents); |
| @@ -47,8 +47,8 @@ QString ScriptCache::getScript(const QUrl& url, ScriptUser* scriptUser, bool& is · 9 unmodified lines | ||
| 47 | 47 | QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance(); |
| 48 | 48 | QNetworkRequest networkRequest = QNetworkRequest(url); |
| 49 | 49 | networkRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT); |
| 50 | − if (redownload) { | |
| 51 | − networkRequest.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferNetwork); | |
| 50 | + if (reload) { | |
| 51 | + networkRequest.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork); | |
| 52 | 52 | qCDebug(scriptengine) << "Redownloading script at:" << url.toString(); |
| 53 | 53 | } else { |
| 54 | 54 | qCDebug(scriptengine) << "Downloading script at:" << url.toString(); |