Merge branch 'master' of github.com:highfidelity/hifi into fix-linux-asan

This commit is contained in:
Seth Alves 2017-06-22 10:07:44 -07:00
commit 517bf0af0f
4 changed files with 52 additions and 16 deletions

View file

@ -889,6 +889,20 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
}
ResourceCache::setRequestLimit(concurrentDownloads);
// perhaps override the avatar url. Since we will test later for validity
// we don't need to do so here.
QString avatarURL = getCmdOption(argc, constArgv, "--avatarURL");
_avatarOverrideUrl = QUrl::fromUserInput(avatarURL);
// If someone specifies both --avatarURL and --replaceAvatarURL,
// the replaceAvatarURL wins. So only set the _overrideUrl if this
// does have a non-empty string.
QString replaceURL = getCmdOption(argc, constArgv, "--replaceAvatarURL");
if (!replaceURL.isEmpty()) {
_avatarOverrideUrl = QUrl::fromUserInput(replaceURL);
_saveAvatarOverrideUrl = true;
}
_glWidget = new GLCanvas();
getApplicationCompositor().setRenderingWidget(_glWidget);
_window->setCentralWidget(_glWidget);
@ -5312,6 +5326,10 @@ void Application::nodeActivated(SharedNodePointer node) {
if (node->getType() == NodeType::AvatarMixer) {
// new avatar mixer, send off our identity packet on next update loop
// Reset skeletonModelUrl if the last server modified our choice.
// Override the avatar url (but not model name) here too.
if (_avatarOverrideUrl.isValid()) {
getMyAvatar()->useFullAvatarURL(_avatarOverrideUrl);
}
static const QUrl empty{};
if (getMyAvatar()->getFullAvatarURLFromPreferences() != getMyAvatar()->cannonicalSkeletonModelURL(empty)) {
getMyAvatar()->resetFullAvatarURL();
@ -7066,3 +7084,8 @@ QUuid Application::getTabletFrameID() const {
auto HMD = DependencyManager::get<HMDScriptingInterface>();
return HMD->getCurrentTabletFrameID();
}
void Application::setAvatarOverrideUrl(const QUrl& url, bool save) {
_avatarOverrideUrl = url;
_saveAvatarOverrideUrl = save;
}

View file

@ -294,6 +294,10 @@ public:
OverlayID getTabletHomeButtonID() const;
QUuid getTabletFrameID() const; // may be an entity or an overlay
void setAvatarOverrideUrl(const QUrl& url, bool save);
QUrl getAvatarOverrideUrl() { return _avatarOverrideUrl; }
bool getSaveAvatarOverrideUrl() { return _saveAvatarOverrideUrl; }
signals:
void svoImportRequested(const QString& url);
@ -681,5 +685,8 @@ private:
bool _previousHMDWornStatus;
void startHMDStandBySession();
void endHMDSession();
QUrl _avatarOverrideUrl;
bool _saveAvatarOverrideUrl { false };
};
#endif // hifi_Application_h

View file

@ -929,10 +929,15 @@ void MyAvatar::saveData() {
settings.setValue("scale", _targetScale);
// only save the fullAvatarURL if it has not been overwritten on command line
// (so the overrideURL is not valid), or it was overridden _and_ we specified
// --replaceAvatarURL (so _saveAvatarOverrideUrl is true)
if (qApp->getSaveAvatarOverrideUrl() || !qApp->getAvatarOverrideUrl().isValid() ) {
settings.setValue("fullAvatarURL",
_fullAvatarURLFromPreferences == AvatarData::defaultFullAvatarModelUrl() ?
"" :
_fullAvatarURLFromPreferences.toString());
}
settings.setValue("fullAvatarModelName", _fullAvatarModelName);

View file

@ -821,6 +821,7 @@ void NetworkTexture::refresh() {
TextureCache::requestCompleted(_self);
}
_ktxResourceState = PENDING_INITIAL_LOAD;
Resource::refresh();
}