mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 10:13:15 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into more-reliable-crowds
This commit is contained in:
commit
59630f8eca
8 changed files with 68 additions and 16 deletions
|
@ -534,6 +534,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
_maxOctreePPS(maxOctreePacketsPerSecond.get()),
|
_maxOctreePPS(maxOctreePacketsPerSecond.get()),
|
||||||
_lastFaceTrackerUpdate(0)
|
_lastFaceTrackerUpdate(0)
|
||||||
{
|
{
|
||||||
|
setProperty("com.highfidelity.launchedFromSteam", SteamClient::isRunning());
|
||||||
|
|
||||||
_runningMarker.startRunningMarker();
|
_runningMarker.startRunningMarker();
|
||||||
|
|
||||||
PluginContainer* pluginContainer = dynamic_cast<PluginContainer*>(this); // set the container for any plugins that care
|
PluginContainer* pluginContainer = dynamic_cast<PluginContainer*>(this); // set the container for any plugins that care
|
||||||
|
@ -569,6 +571,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
_deadlockWatchdogThread = new DeadlockWatchdogThread();
|
_deadlockWatchdogThread = new DeadlockWatchdogThread();
|
||||||
_deadlockWatchdogThread->start();
|
_deadlockWatchdogThread->start();
|
||||||
|
|
||||||
|
qCDebug(interfaceapp) << "[VERSION] SteamVR buildID:" << SteamClient::getSteamVRBuildID();
|
||||||
qCDebug(interfaceapp) << "[VERSION] Build sequence:" << qPrintable(applicationVersion());
|
qCDebug(interfaceapp) << "[VERSION] Build sequence:" << qPrintable(applicationVersion());
|
||||||
qCDebug(interfaceapp) << "[VERSION] MODIFIED_ORGANIZATION:" << BuildInfo::MODIFIED_ORGANIZATION;
|
qCDebug(interfaceapp) << "[VERSION] MODIFIED_ORGANIZATION:" << BuildInfo::MODIFIED_ORGANIZATION;
|
||||||
qCDebug(interfaceapp) << "[VERSION] VERSION:" << BuildInfo::VERSION;
|
qCDebug(interfaceapp) << "[VERSION] VERSION:" << BuildInfo::VERSION;
|
||||||
|
|
|
@ -620,6 +620,14 @@ Menu::Menu() {
|
||||||
// Developer > Audio >>>
|
// Developer > Audio >>>
|
||||||
MenuWrapper* audioDebugMenu = developerMenu->addMenu("Audio");
|
MenuWrapper* audioDebugMenu = developerMenu->addMenu("Audio");
|
||||||
|
|
||||||
|
action = addActionToQMenuAndActionHash(audioDebugMenu, "Stats...");
|
||||||
|
connect(action, &QAction::triggered, [] {
|
||||||
|
auto scriptEngines = DependencyManager::get<ScriptEngines>();
|
||||||
|
QUrl defaultScriptsLoc = defaultScriptsLocation();
|
||||||
|
defaultScriptsLoc.setPath(defaultScriptsLoc.path() + "developer/utilities/audio/stats.js");
|
||||||
|
scriptEngines->loadScript(defaultScriptsLoc.toString());
|
||||||
|
});
|
||||||
|
|
||||||
action = addActionToQMenuAndActionHash(audioDebugMenu, "Buffers...");
|
action = addActionToQMenuAndActionHash(audioDebugMenu, "Buffers...");
|
||||||
connect(action, &QAction::triggered, [] {
|
connect(action, &QAction::triggered, [] {
|
||||||
DependencyManager::get<OffscreenUi>()->toggle(QString("hifi/dialogs/AudioPreferencesDialog.qml"), "AudioPreferencesDialog");
|
DependencyManager::get<OffscreenUi>()->toggle(QString("hifi/dialogs/AudioPreferencesDialog.qml"), "AudioPreferencesDialog");
|
||||||
|
|
|
@ -161,9 +161,6 @@ int main(int argc, const char* argv[]) {
|
||||||
QSettings::setDefaultFormat(QSettings::IniFormat);
|
QSettings::setDefaultFormat(QSettings::IniFormat);
|
||||||
Application app(argc, const_cast<char**>(argv), startupTime, runServer, serverContentPathOptionValue);
|
Application app(argc, const_cast<char**>(argv), startupTime, runServer, serverContentPathOptionValue);
|
||||||
|
|
||||||
bool launchedFromSteam = SteamClient::isRunning();
|
|
||||||
app.setProperty("com.highfidelity.launchedFromSteam", launchedFromSteam);
|
|
||||||
|
|
||||||
// If we failed the OpenGLVersion check, log it.
|
// If we failed the OpenGLVersion check, log it.
|
||||||
if (override) {
|
if (override) {
|
||||||
auto accountManager = DependencyManager::get<AccountManager>();
|
auto accountManager = DependencyManager::get<AccountManager>();
|
||||||
|
|
|
@ -44,33 +44,40 @@ void BatchLoader::start() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (const auto& rawURL : _urls) {
|
for (const auto& rawURL : _urls) {
|
||||||
QUrl url = expandScriptUrl(normalizeScriptURL(rawURL));
|
QUrl url = expandScriptUrl(normalizeScriptURL(rawURL));
|
||||||
|
|
||||||
qCDebug(scriptengine) << "Loading script at " << url;
|
qCDebug(scriptengine) << "Loading script at " << url;
|
||||||
|
|
||||||
QPointer<BatchLoader> self = this;
|
auto scriptCache = DependencyManager::get<ScriptCache>();
|
||||||
DependencyManager::get<ScriptCache>()->getScriptContents(url.toString(), [this, self](const QString& url, const QString& contents, bool isURL, bool success) {
|
|
||||||
if (!self) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Because the ScriptCache may call this callback from differents threads,
|
// Use a proxy callback to handle the call and emit the signal in a thread-safe way.
|
||||||
// we need to make sure this is thread-safe.
|
// If BatchLoader is deleted before the callback is called, the subsequent "emit" call will not do
|
||||||
std::lock_guard<std::mutex> lock(_dataLock);
|
// anything.
|
||||||
|
ScriptCacheSignalProxy* proxy = new ScriptCacheSignalProxy(scriptCache.data());
|
||||||
|
scriptCache->getScriptContents(url.toString(), [proxy](const QString& url, const QString& contents, bool isURL, bool success) {
|
||||||
|
proxy->receivedContent(url, contents, isURL, success);
|
||||||
|
proxy->deleteLater();
|
||||||
|
}, false);
|
||||||
|
|
||||||
|
connect(proxy, &ScriptCacheSignalProxy::contentAvailable, this, [this](const QString& url, const QString& contents, bool isURL, bool success) {
|
||||||
if (isURL && success) {
|
if (isURL && success) {
|
||||||
_data.insert(url, contents);
|
_data.insert(url, contents);
|
||||||
qCDebug(scriptengine) << "Loaded: " << url;
|
qCDebug(scriptengine) << "Loaded: " << url;
|
||||||
} else {
|
} else {
|
||||||
_data.insert(url, QString());
|
_data.insert(url, QString());
|
||||||
qCDebug(scriptengine) << "Could not load" << url;
|
qCDebug(scriptengine) << "Could not load: " << url;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_finished && _urls.size() == _data.size()) {
|
if (!_finished && _urls.size() == _data.size()) {
|
||||||
_finished = true;
|
_finished = true;
|
||||||
emit finished(_data);
|
emit finished(_data);
|
||||||
}
|
}
|
||||||
}, false);
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScriptCacheSignalProxy::receivedContent(const QString& url, const QString& contents, bool isURL, bool success) {
|
||||||
|
emit contentAvailable(url, contents, isURL, success);
|
||||||
|
}
|
||||||
|
|
|
@ -21,10 +21,20 @@
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
|
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:
|
||||||
|
void contentAvailable(const QString& url, const QString& contents, bool isURL, bool success);
|
||||||
|
};
|
||||||
|
|
||||||
class BatchLoader : public QObject {
|
class BatchLoader : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
BatchLoader(const QList<QUrl>& urls) ;
|
BatchLoader(const QList<QUrl>& urls);
|
||||||
|
|
||||||
void start();
|
void start();
|
||||||
bool isFinished() const { return _finished; };
|
bool isFinished() const { return _finished; };
|
||||||
|
@ -39,7 +49,6 @@ private:
|
||||||
bool _finished;
|
bool _finished;
|
||||||
QSet<QUrl> _urls;
|
QSet<QUrl> _urls;
|
||||||
QMap<QUrl, QString> _data;
|
QMap<QUrl, QString> _data;
|
||||||
std::mutex _dataLock;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_BatchLoader_h
|
#endif // hifi_BatchLoader_h
|
||||||
|
|
|
@ -245,6 +245,32 @@ void SteamClient::shutdown() {
|
||||||
steamCallbackManager.getTicketRequests().stopAll();
|
steamCallbackManager.getTicketRequests().stopAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int SteamClient::getSteamVRBuildID() {
|
||||||
|
if (initialized) {
|
||||||
|
static const int MAX_PATH_SIZE = 512;
|
||||||
|
static const int STEAMVR_APPID = 250820;
|
||||||
|
char rawPath[MAX_PATH_SIZE];
|
||||||
|
SteamApps()->GetAppInstallDir(STEAMVR_APPID, rawPath, MAX_PATH_SIZE);
|
||||||
|
|
||||||
|
QString path(rawPath);
|
||||||
|
path += "\\bin\\version.txt";
|
||||||
|
qDebug() << "SteamVR version file path:" << path;
|
||||||
|
|
||||||
|
QFile file(path);
|
||||||
|
if (file.open(QIODevice::ReadOnly)) {
|
||||||
|
QString buildIDString = file.readLine();
|
||||||
|
|
||||||
|
bool ok = false;
|
||||||
|
int buildID = buildIDString.toInt(&ok);
|
||||||
|
if (ok) {
|
||||||
|
return buildID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SteamClient::runCallbacks() {
|
void SteamClient::runCallbacks() {
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -37,6 +37,7 @@ public:
|
||||||
static void openInviteOverlay();
|
static void openInviteOverlay();
|
||||||
static void joinLobby(QString lobbyId);
|
static void joinLobby(QString lobbyId);
|
||||||
|
|
||||||
|
static int getSteamVRBuildID();
|
||||||
};
|
};
|
||||||
|
|
||||||
class SteamScriptingInterface : public QObject {
|
class SteamScriptingInterface : public QObject {
|
||||||
|
|
|
@ -304,7 +304,7 @@ function setEnabled(value) {
|
||||||
|
|
||||||
var CHANNEL_AWAY_ENABLE = "Hifi-Away-Enable";
|
var CHANNEL_AWAY_ENABLE = "Hifi-Away-Enable";
|
||||||
var handleMessage = function(channel, message, sender) {
|
var handleMessage = function(channel, message, sender) {
|
||||||
if (channel === CHANNEL_AWAY_ENABLE) {
|
if (channel === CHANNEL_AWAY_ENABLE && sender === MyAvatar.sessionUUID) {
|
||||||
print("away.js | Got message on Hifi-Away-Enable: ", message);
|
print("away.js | Got message on Hifi-Away-Enable: ", message);
|
||||||
setEnabled(message === 'enable');
|
setEnabled(message === 'enable');
|
||||||
}
|
}
|
||||||
|
@ -344,6 +344,7 @@ Script.scriptEnding.connect(function () {
|
||||||
Controller.mousePressEvent.disconnect(goActive);
|
Controller.mousePressEvent.disconnect(goActive);
|
||||||
Controller.keyPressEvent.disconnect(maybeGoActive);
|
Controller.keyPressEvent.disconnect(maybeGoActive);
|
||||||
Messages.messageReceived.disconnect(handleMessage);
|
Messages.messageReceived.disconnect(handleMessage);
|
||||||
|
Messages.unsubscribe(CHANNEL_AWAY_ENABLE);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (HMD.active && !HMD.mounted) {
|
if (HMD.active && !HMD.mounted) {
|
||||||
|
|
Loading…
Reference in a new issue