mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 17:23:12 +02:00
new switches to override avatarURL
This commit is contained in:
parent
4ddb5e8866
commit
94a33fea94
3 changed files with 49 additions and 16 deletions
|
@ -859,6 +859,19 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
}
|
||||
ResourceCache::setRequestLimit(concurrentDownloads);
|
||||
|
||||
// perhaps override the avatar url. We test later for validity, so
|
||||
// no need to do so here. If someone specifies both --avatarURL
|
||||
// and --replaceAvatarURL, the replaceAvatarURL wins.
|
||||
QString avatarURL = getCmdOption(argc, constArgv, "--avatarURL");
|
||||
qDebug() << "XXXXXXXXXXXXXXXXXXXXX" << avatarURL;
|
||||
_avatarOverrideUrl = QUrl::fromUserInput(avatarURL);
|
||||
QString replaceURL = getCmdOption(argc, constArgv, "--replaceAvatarURL");
|
||||
qDebug() << "YYYYYYYYYYYYYYYYYYYYYY" << replaceURL;
|
||||
if (!replaceURL.isEmpty()) {
|
||||
_avatarOverrideUrl = QUrl::fromUserInput(replaceURL);
|
||||
_saveAvatarOverrideUrl = true;
|
||||
}
|
||||
|
||||
_glWidget = new GLCanvas();
|
||||
getApplicationCompositor().setRenderingWidget(_glWidget);
|
||||
_window->setCentralWidget(_glWidget);
|
||||
|
@ -5281,6 +5294,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();
|
||||
|
@ -7035,3 +7052,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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -929,10 +929,14 @@ void MyAvatar::saveData() {
|
|||
|
||||
settings.setValue("scale", _targetScale);
|
||||
|
||||
settings.setValue("fullAvatarURL",
|
||||
// only save the fullAvatarURL if it has not been overwritten on command line, or it
|
||||
// has but we want it saved
|
||||
if (qApp->getSaveAvatarOverrideUrl() || !qApp->getAvatarOverrideUrl().isValid() ) {
|
||||
settings.setValue("fullAvatarURL",
|
||||
_fullAvatarURLFromPreferences == AvatarData::defaultFullAvatarModelUrl() ?
|
||||
"" :
|
||||
_fullAvatarURLFromPreferences.toString());
|
||||
}
|
||||
|
||||
settings.setValue("fullAvatarModelName", _fullAvatarModelName);
|
||||
|
||||
|
|
Loading…
Reference in a new issue