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

@ -215,7 +215,7 @@ static QTimer pingTimer;
static const int MAX_CONCURRENT_RESOURCE_DOWNLOADS = 16;
// For processing on QThreadPool, we target a number of threads after reserving some
// For processing on QThreadPool, we target a number of threads after reserving some
// based on how many are being consumed by the application and the display plugin. However,
// we will never drop below the 'min' value
static const int MIN_PROCESSING_THREAD_POOL_SIZE = 1;
@ -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);
@ -1278,7 +1292,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
// Add periodic checks to send user activity data
static int CHECK_NEARBY_AVATARS_INTERVAL_MS = 10000;
static int NEARBY_AVATAR_RADIUS_METERS = 10;
// setup the stats interval depending on if the 1s faster hearbeat was requested
static const QString FAST_STATS_ARG = "--fast-heartbeat";
static int SEND_STATS_INTERVAL_MS = arguments().indexOf(FAST_STATS_ARG) != -1 ? 1000 : 10000;
@ -1428,10 +1442,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
_autoSwitchDisplayModeSupportedHMDPlugin = nullptr;
foreach(DisplayPluginPointer displayPlugin, PluginManager::getInstance()->getDisplayPlugins()) {
if (displayPlugin->isHmd() &&
if (displayPlugin->isHmd() &&
displayPlugin->getSupportsAutoSwitch()) {
_autoSwitchDisplayModeSupportedHMDPlugin = displayPlugin;
_autoSwitchDisplayModeSupportedHMDPluginName =
_autoSwitchDisplayModeSupportedHMDPluginName =
_autoSwitchDisplayModeSupportedHMDPlugin->getName();
_previousHMDWornStatus =
_autoSwitchDisplayModeSupportedHMDPlugin->isDisplayVisible();
@ -1683,7 +1697,7 @@ void Application::onAboutToQuit() {
}
getActiveDisplayPlugin()->deactivate();
if (_autoSwitchDisplayModeSupportedHMDPlugin
if (_autoSwitchDisplayModeSupportedHMDPlugin
&& _autoSwitchDisplayModeSupportedHMDPlugin->isSessionActive()) {
_autoSwitchDisplayModeSupportedHMDPlugin->endSession();
}
@ -1752,8 +1766,8 @@ void Application::cleanupBeforeQuit() {
// Cleanup all overlays after the scripts, as scripts might add more
_overlays.cleanupAllOverlays();
// The cleanup process enqueues the transactions but does not process them. Calling this here will force the actual
// removal of the items.
// The cleanup process enqueues the transactions but does not process them. Calling this here will force the actual
// removal of the items.
// See https://highfidelity.fogbugz.com/f/cases/5328
_main3DScene->processTransactionQueue();
@ -5248,7 +5262,7 @@ void Application::clearDomainOctreeDetails() {
skyStage->setBackgroundMode(model::SunSkyStage::SKY_DEFAULT);
_recentlyClearedDomain = true;
DependencyManager::get<AnimationCache>()->clearUnusedResources();
DependencyManager::get<ModelCache>()->clearUnusedResources();
DependencyManager::get<SoundCache>()->clearUnusedResources();
@ -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

@ -102,9 +102,9 @@ class Application;
#endif
#define qApp (static_cast<Application*>(QCoreApplication::instance()))
class Application : public QApplication,
public AbstractViewStateInterface,
public AbstractScriptingServicesInterface,
class Application : public QApplication,
public AbstractViewStateInterface,
public AbstractScriptingServicesInterface,
public AbstractUriHandler,
public PluginContainer {
Q_OBJECT
@ -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);
@ -675,11 +679,14 @@ private:
FileScriptingInterface* _fileDownload;
AudioInjector* _snapshotSoundInjector { nullptr };
SharedSoundPointer _snapshotSound;
DisplayPluginPointer _autoSwitchDisplayModeSupportedHMDPlugin;
QString _autoSwitchDisplayModeSupportedHMDPluginName;
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);
settings.setValue("fullAvatarURL",
// 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);
@ -2430,7 +2435,7 @@ bool MyAvatar::requiresSafeLanding(const glm::vec3& positionIn, glm::vec3& bette
// Our head may be embedded, but our center is out and there's room below. See corresponding comment above.
return false; // nothing below
}
// See if we have room between entities above and below, but that we are not contained.
// First check if the surface above us is the bottom of something, and the surface below us it the top of something.
// I.e., we are in a clearing between two objects.
@ -3150,6 +3155,6 @@ void MyAvatar::updateHoldActions(const AnimPose& prePhysicsPose, const AnimPose&
}
}
const MyHead* MyAvatar::getMyHead() const {
return static_cast<const MyHead*>(getHead());
const MyHead* MyAvatar::getMyHead() const {
return static_cast<const MyHead*>(getHead());
}

View file

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