History

Merge branch 'master' into 21776

David Rowe committed 8 years ago

Commit 16aefea2 parents b1bda28 db2b79f238 files · +13371 −1178Browse files

Showing the changes to interface/src/Application.cpp (1 of 238 files). Show all

Unified · Split

interface/src/Application.cpp+26−28
@@ -891,7 +891,7 @@ Q_GUI_EXPORT void qt_gl_set_global_share_context(QOpenGLContext *context); · 890 unmodified lines
891 891
892Setting::Handle<int> sessionRunTime{ "sessionRunTime", 0 };892Setting::Handle<int> sessionRunTime{ "sessionRunTime", 0 };
893 893
894const float DEFAULT_HMD_TABLET_SCALE_PERCENT = 100.0f;894const float DEFAULT_HMD_TABLET_SCALE_PERCENT = 70.0f;
895const float DEFAULT_DESKTOP_TABLET_SCALE_PERCENT = 75.0f;895const float DEFAULT_DESKTOP_TABLET_SCALE_PERCENT = 75.0f;
896const bool DEFAULT_DESKTOP_TABLET_BECOMES_TOOLBAR = true;896const bool DEFAULT_DESKTOP_TABLET_BECOMES_TOOLBAR = true;
897const bool DEFAULT_HMD_TABLET_BECOMES_TOOLBAR = false;897const bool DEFAULT_HMD_TABLET_BECOMES_TOOLBAR = false;
@@ -981,6 +981,15 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 83 unmodified lines
981 qInstallMessageHandler(messageHandler);981 qInstallMessageHandler(messageHandler);
982 982
983 QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "styles/Inconsolata.otf");983 QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "styles/Inconsolata.otf");
984 QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/fontawesome-webfont.ttf");
985 QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/hifi-glyphs.ttf");
986 QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/AnonymousPro-Regular.ttf");
987 QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/FiraSans-Regular.ttf");
988 QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/FiraSans-SemiBold.ttf");
989 QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/Raleway-Light.ttf");
990 QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/Raleway-Regular.ttf");
991 QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/Raleway-Bold.ttf");
992 QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "fonts/Raleway-SemiBold.ttf");
984 _window->setWindowTitle("High Fidelity Interface");993 _window->setWindowTitle("High Fidelity Interface");
985 994
986 Model::setAbstractViewStateInterface(this); // The model class will sometimes need to know view state details from us995 Model::setAbstractViewStateInterface(this); // The model class will sometimes need to know view state details from us
@@ -1998,20 +2007,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 1011 unmodified lines
1998 connect(_window, SIGNAL(windowMinimizedChanged(bool)), this, SLOT(windowMinimizedChanged(bool)));2007 connect(_window, SIGNAL(windowMinimizedChanged(bool)), this, SLOT(windowMinimizedChanged(bool)));
1999 qCDebug(interfaceapp, "Startup time: %4.2f seconds.", (double)startupTimer.elapsed() / 1000.0);2008 qCDebug(interfaceapp, "Startup time: %4.2f seconds.", (double)startupTimer.elapsed() / 1000.0);
2000 2009
2001 {
2002 PROFILE_RANGE(render, "Process Default Skybox");
2003 auto textureCache = DependencyManager::get<TextureCache>();
2004
2005 QFileSelector fileSelector;
2006 fileSelector.setExtraSelectors(FileUtils::getFileSelectors());
2007 auto skyboxUrl = fileSelector.select(PathUtils::resourcesPath() + "images/Default-Sky-9-cubemap.ktx");
2008
2009 _defaultSkyboxTexture = gpu::Texture::unserialize(skyboxUrl.toStdString());
2010 _defaultSkyboxAmbientTexture = _defaultSkyboxTexture;
2011
2012 _defaultSkybox->setCubemap(_defaultSkyboxTexture);
2013 }
2014
2015 EntityTreeRenderer::setEntitiesShouldFadeFunction([this]() {2010 EntityTreeRenderer::setEntitiesShouldFadeFunction([this]() {
2016 SharedNodePointer entityServerNode = DependencyManager::get<NodeList>()->soloNodeOfType(NodeType::EntityServer);2011 SharedNodePointer entityServerNode = DependencyManager::get<NodeList>()->soloNodeOfType(NodeType::EntityServer);
2017 return entityServerNode && !isPhysicsEnabled();2012 return entityServerNode && !isPhysicsEnabled();
@@ -2461,7 +2456,6 @@ void Application::initializeGL() { · 443 unmodified lines
2461 DeadlockWatchdogThread::withPause([&] {2456 DeadlockWatchdogThread::withPause([&] {
2462 // Set up the render engine2457 // Set up the render engine
2463 render::CullFunctor cullFunctor = LODManager::shouldRender;2458 render::CullFunctor cullFunctor = LODManager::shouldRender;
2464 static const QString RENDER_FORWARD = "HIFI_RENDER_FORWARD";
2465 _renderEngine->addJob<UpdateSceneTask>("UpdateScene");2459 _renderEngine->addJob<UpdateSceneTask>("UpdateScene");
2466#ifndef Q_OS_ANDROID2460#ifndef Q_OS_ANDROID
2467 _renderEngine->addJob<SecondaryCameraRenderTask>("SecondaryCameraJob", cullFunctor, !DISABLE_DEFERRED);2461 _renderEngine->addJob<SecondaryCameraRenderTask>("SecondaryCameraJob", cullFunctor, !DISABLE_DEFERRED);
@@ -2681,7 +2675,6 @@ void Application::onDesktopRootContextCreated(QQmlContext* surfaceContext) { · 213 unmodified lines
2681 surfaceContext->setContextProperty("Overlays", &_overlays);2675 surfaceContext->setContextProperty("Overlays", &_overlays);
2682 surfaceContext->setContextProperty("Window", DependencyManager::get<WindowScriptingInterface>().data());2676 surfaceContext->setContextProperty("Window", DependencyManager::get<WindowScriptingInterface>().data());
2683 surfaceContext->setContextProperty("MenuInterface", MenuScriptingInterface::getInstance());2677 surfaceContext->setContextProperty("MenuInterface", MenuScriptingInterface::getInstance());
2684 surfaceContext->setContextProperty("Stats", Stats::getInstance());
2685 surfaceContext->setContextProperty("Settings", SettingsScriptingInterface::getInstance());2678 surfaceContext->setContextProperty("Settings", SettingsScriptingInterface::getInstance());
2686 surfaceContext->setContextProperty("ScriptDiscoveryService", DependencyManager::get<ScriptEngines>().data());2679 surfaceContext->setContextProperty("ScriptDiscoveryService", DependencyManager::get<ScriptEngines>().data());
2687 surfaceContext->setContextProperty("AvatarBookmarks", DependencyManager::get<AvatarBookmarks>().data());2680 surfaceContext->setContextProperty("AvatarBookmarks", DependencyManager::get<AvatarBookmarks>().data());
@@ -2711,7 +2704,6 @@ void Application::onDesktopRootContextCreated(QQmlContext* surfaceContext) { · 23 unmodified lines
2711 2704
2712 surfaceContext->setContextProperty("ApplicationCompositor", &getApplicationCompositor());2705 surfaceContext->setContextProperty("ApplicationCompositor", &getApplicationCompositor());
2713 2706
2714 surfaceContext->setContextProperty("AvatarInputs", AvatarInputs::getInstance());
2715 surfaceContext->setContextProperty("Selection", DependencyManager::get<SelectionScriptingInterface>().data());2707 surfaceContext->setContextProperty("Selection", DependencyManager::get<SelectionScriptingInterface>().data());
2716 surfaceContext->setContextProperty("ContextOverlay", DependencyManager::get<ContextOverlayInterface>().data());2708 surfaceContext->setContextProperty("ContextOverlay", DependencyManager::get<ContextOverlayInterface>().data());
2717 surfaceContext->setContextProperty("Wallet", DependencyManager::get<WalletScriptingInterface>().data());2709 surfaceContext->setContextProperty("Wallet", DependencyManager::get<WalletScriptingInterface>().data());
@@ -2726,6 +2718,9 @@ void Application::onDesktopRootContextCreated(QQmlContext* surfaceContext) { · 8 unmodified lines
2726void Application::onDesktopRootItemCreated(QQuickItem* rootItem) {2718void Application::onDesktopRootItemCreated(QQuickItem* rootItem) {
2727 Stats::show();2719 Stats::show();
2728 AvatarInputs::show();2720 AvatarInputs::show();
2721 auto surfaceContext = DependencyManager::get<OffscreenUi>()->getSurfaceContext();
2722 surfaceContext->setContextProperty("Stats", Stats::getInstance());
2723 surfaceContext->setContextProperty("AvatarInputs", AvatarInputs::getInstance());
2729}2724}
2730 2725
2731void Application::updateCamera(RenderArgs& renderArgs, float deltaTime) {2726void Application::updateCamera(RenderArgs& renderArgs, float deltaTime) {
@@ -6148,6 +6143,8 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe · 3416 unmodified lines
6148 scriptEngine->registerGlobalObject("Wallet", DependencyManager::get<WalletScriptingInterface>().data());6143 scriptEngine->registerGlobalObject("Wallet", DependencyManager::get<WalletScriptingInterface>().data());
6149 scriptEngine->registerGlobalObject("AddressManager", DependencyManager::get<AddressManager>().data());6144 scriptEngine->registerGlobalObject("AddressManager", DependencyManager::get<AddressManager>().data());
6150 6145
6146 scriptEngine->registerGlobalObject("App", this);
6147
6151 qScriptRegisterMetaType(scriptEngine.data(), OverlayIDtoScriptValue, OverlayIDfromScriptValue);6148 qScriptRegisterMetaType(scriptEngine.data(), OverlayIDtoScriptValue, OverlayIDfromScriptValue);
6152 6149
6153 DependencyManager::get<PickScriptingInterface>()->registerMetaTypes(scriptEngine.data());6150 DependencyManager::get<PickScriptingInterface>()->registerMetaTypes(scriptEngine.data());
@@ -6633,17 +6630,17 @@ void Application::addAssetToWorld(QString path, QString zipFile, bool isZip, boo · 479 unmodified lines
6633 6630
6634 addAssetToWorldInfo(filename, "Adding " + mapping.mid(1) + " to the Asset Server.");6631 addAssetToWorldInfo(filename, "Adding " + mapping.mid(1) + " to the Asset Server.");
6635 6632
6636 addAssetToWorldWithNewMapping(path, mapping, 0);6633 addAssetToWorldWithNewMapping(path, mapping, 0, isZip, isBlocks);
6637}6634}
6638 6635
6639void Application::addAssetToWorldWithNewMapping(QString filePath, QString mapping, int copy) {6636void Application::addAssetToWorldWithNewMapping(QString filePath, QString mapping, int copy, bool isZip, bool isBlocks) {
6640 auto request = DependencyManager::get<AssetClient>()->createGetMappingRequest(mapping);6637 auto request = DependencyManager::get<AssetClient>()->createGetMappingRequest(mapping);
6641 6638
6642 QObject::connect(request, &GetMappingRequest::finished, this, [=](GetMappingRequest* request) mutable {6639 QObject::connect(request, &GetMappingRequest::finished, this, [=](GetMappingRequest* request) mutable {
6643 const int MAX_COPY_COUNT = 100; // Limit number of duplicate assets; recursion guard.6640 const int MAX_COPY_COUNT = 100; // Limit number of duplicate assets; recursion guard.
6644 auto result = request->getError();6641 auto result = request->getError();
6645 if (result == GetMappingRequest::NotFound) {6642 if (result == GetMappingRequest::NotFound) {
6646 addAssetToWorldUpload(filePath, mapping);6643 addAssetToWorldUpload(filePath, mapping, isZip, isBlocks);
6647 } else if (result != GetMappingRequest::NoError) {6644 } else if (result != GetMappingRequest::NoError) {
6648 QString errorInfo = "Could not map asset name: "6645 QString errorInfo = "Could not map asset name: "
6649 + mapping.left(mapping.length() - QString::number(copy).length() - 1);6646 + mapping.left(mapping.length() - QString::number(copy).length() - 1);
@@ -6655,7 +6652,7 @@ void Application::addAssetToWorldWithNewMapping(QString filePath, QString mappin · 5 unmodified lines
6655 }6652 }
6656 copy++;6653 copy++;
6657 mapping = mapping.insert(mapping.lastIndexOf("."), "-" + QString::number(copy));6654 mapping = mapping.insert(mapping.lastIndexOf("."), "-" + QString::number(copy));
6658 addAssetToWorldWithNewMapping(filePath, mapping, copy);6655 addAssetToWorldWithNewMapping(filePath, mapping, copy, isZip, isBlocks);
6659 } else {6656 } else {
6660 QString errorInfo = "Too many copies of asset name: "6657 QString errorInfo = "Too many copies of asset name: "
6661 + mapping.left(mapping.length() - QString::number(copy).length() - 1);6658 + mapping.left(mapping.length() - QString::number(copy).length() - 1);
@@ -6668,7 +6665,7 @@ void Application::addAssetToWorldWithNewMapping(QString filePath, QString mappin · 6 unmodified lines
6668 request->start();6665 request->start();
6669}6666}
6670 6667
6671void Application::addAssetToWorldUpload(QString filePath, QString mapping) {6668void Application::addAssetToWorldUpload(QString filePath, QString mapping, bool isZip, bool isBlocks) {
6672 qInfo(interfaceapp) << "Uploading" << filePath << "to Asset Server as" << mapping;6669 qInfo(interfaceapp) << "Uploading" << filePath << "to Asset Server as" << mapping;
6673 auto upload = DependencyManager::get<AssetClient>()->createUpload(filePath);6670 auto upload = DependencyManager::get<AssetClient>()->createUpload(filePath);
6674 QObject::connect(upload, &AssetUpload::finished, this, [=](AssetUpload* upload, const QString& hash) mutable {6671 QObject::connect(upload, &AssetUpload::finished, this, [=](AssetUpload* upload, const QString& hash) mutable {
@@ -6677,7 +6674,7 @@ void Application::addAssetToWorldUpload(QString filePath, QString mapping) { · 2 unmodified lines
6677 qWarning(interfaceapp) << "Error downloading model: " + errorInfo;6674 qWarning(interfaceapp) << "Error downloading model: " + errorInfo;
6678 addAssetToWorldError(filenameFromPath(filePath), errorInfo);6675 addAssetToWorldError(filenameFromPath(filePath), errorInfo);
6679 } else {6676 } else {
6680 addAssetToWorldSetMapping(filePath, mapping, hash);6677 addAssetToWorldSetMapping(filePath, mapping, hash, isZip, isBlocks);
6681 }6678 }
6682 6679
6683 // Remove temporary directory created by Clara.io market place download.6680 // Remove temporary directory created by Clara.io market place download.
@@ -6694,7 +6691,7 @@ void Application::addAssetToWorldUpload(QString filePath, QString mapping) { · 10 unmodified lines
6694 upload->start();6691 upload->start();
6695}6692}
6696 6693
6697void Application::addAssetToWorldSetMapping(QString filePath, QString mapping, QString hash) {6694void Application::addAssetToWorldSetMapping(QString filePath, QString mapping, QString hash, bool isZip, bool isBlocks) {
6698 auto request = DependencyManager::get<AssetClient>()->createSetMappingRequest(mapping, hash);6695 auto request = DependencyManager::get<AssetClient>()->createSetMappingRequest(mapping, hash);
6699 connect(request, &SetMappingRequest::finished, this, [=](SetMappingRequest* request) mutable {6696 connect(request, &SetMappingRequest::finished, this, [=](SetMappingRequest* request) mutable {
6700 if (request->getError() != SetMappingRequest::NoError) {6697 if (request->getError() != SetMappingRequest::NoError) {
@@ -6702,9 +6699,10 @@ void Application::addAssetToWorldSetMapping(QString filePath, QString mapping, Q · 1 unmodified line
6702 qWarning(interfaceapp) << "Error downloading model: " + errorInfo;6699 qWarning(interfaceapp) << "Error downloading model: " + errorInfo;
6703 addAssetToWorldError(filenameFromPath(filePath), errorInfo);6700 addAssetToWorldError(filenameFromPath(filePath), errorInfo);
6704 } else {6701 } else {
6705 // to prevent files that aren't models from being loaded into world automatically6702 // to prevent files that aren't models or texture files from being loaded into world automatically
6706 if (filePath.toLower().endsWith(OBJ_EXTENSION) || filePath.toLower().endsWith(FBX_EXTENSION) || 6703 if ((filePath.toLower().endsWith(OBJ_EXTENSION) || filePath.toLower().endsWith(FBX_EXTENSION)) ||
6707 filePath.toLower().endsWith(JPG_EXTENSION) || filePath.toLower().endsWith(PNG_EXTENSION)) {6704 ((filePath.toLower().endsWith(JPG_EXTENSION) || filePath.toLower().endsWith(PNG_EXTENSION)) &&
6705 ((!isBlocks) && (!isZip)))) {
6708 addAssetToWorldAddEntity(filePath, mapping);6706 addAssetToWorldAddEntity(filePath, mapping);
6709 } else {6707 } else {
6710 qCDebug(interfaceapp) << "Zipped contents are not supported entity files";6708 qCDebug(interfaceapp) << "Zipped contents are not supported entity files";

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t