History

Merge remote-tracking branch 'upstream/master' into feature/quest

Brad Davis committed 7 years ago

Commit d60dcb92 parents 44851bb 051ab6182 files · +2091 −1749Browse files

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

Unified · Split

interface/src/Application.cpp+13−23
@@ -1918,46 +1918,34 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 1917 unmodified lines
1918 }1918 }
1919 }, Qt::QueuedConnection);1919 }, Qt::QueuedConnection);
1920 1920
1921 EntityTree::setAddMaterialToEntityOperator([this](const QUuid& entityID, graphics::MaterialLayer material, const std::string& parentMaterialName) {1921 EntityTreeRenderer::setAddMaterialToEntityOperator([this](const QUuid& entityID, graphics::MaterialLayer material, const std::string& parentMaterialName) {
1922 if (_aboutToQuit) {1922 if (_aboutToQuit) {
1923 return false;1923 return false;
1924 }1924 }
1925 1925
1926 // try to find the renderable
1927 auto renderable = getEntities()->renderableForEntityId(entityID);1926 auto renderable = getEntities()->renderableForEntityId(entityID);
1928 if (renderable) {1927 if (renderable) {
1929 renderable->addMaterial(material, parentMaterialName);1928 renderable->addMaterial(material, parentMaterialName);
1930 }
1931
1932 // even if we don't find it, try to find the entity
1933 auto entity = getEntities()->getEntity(entityID);
1934 if (entity) {
1935 entity->addMaterial(material, parentMaterialName);
1936 return true;1929 return true;
1937 }1930 }
1931
1938 return false;1932 return false;
1939 });1933 });
1940 EntityTree::setRemoveMaterialFromEntityOperator([this](const QUuid& entityID, graphics::MaterialPointer material, const std::string& parentMaterialName) {1934 EntityTreeRenderer::setRemoveMaterialFromEntityOperator([this](const QUuid& entityID, graphics::MaterialPointer material, const std::string& parentMaterialName) {
1941 if (_aboutToQuit) {1935 if (_aboutToQuit) {
1942 return false;1936 return false;
1943 }1937 }
1944 1938
1945 // try to find the renderable
1946 auto renderable = getEntities()->renderableForEntityId(entityID);1939 auto renderable = getEntities()->renderableForEntityId(entityID);
1947 if (renderable) {1940 if (renderable) {
1948 renderable->removeMaterial(material, parentMaterialName);1941 renderable->removeMaterial(material, parentMaterialName);
1949 }
1950
1951 // even if we don't find it, try to find the entity
1952 auto entity = getEntities()->getEntity(entityID);
1953 if (entity) {
1954 entity->removeMaterial(material, parentMaterialName);
1955 return true;1942 return true;
1956 }1943 }
1944
1957 return false;1945 return false;
1958 });1946 });
1959 1947
1960 EntityTree::setAddMaterialToAvatarOperator([](const QUuid& avatarID, graphics::MaterialLayer material, const std::string& parentMaterialName) {1948 EntityTreeRenderer::setAddMaterialToAvatarOperator([](const QUuid& avatarID, graphics::MaterialLayer material, const std::string& parentMaterialName) {
1961 auto avatarManager = DependencyManager::get<AvatarManager>();1949 auto avatarManager = DependencyManager::get<AvatarManager>();
1962 auto avatar = avatarManager->getAvatarBySessionID(avatarID);1950 auto avatar = avatarManager->getAvatarBySessionID(avatarID);
1963 if (avatar) {1951 if (avatar) {
@@ -1966,7 +1954,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 2 unmodified lines
1966 }1954 }
1967 return false;1955 return false;
1968 });1956 });
1969 EntityTree::setRemoveMaterialFromAvatarOperator([](const QUuid& avatarID, graphics::MaterialPointer material, const std::string& parentMaterialName) {1957 EntityTreeRenderer::setRemoveMaterialFromAvatarOperator([](const QUuid& avatarID, graphics::MaterialPointer material, const std::string& parentMaterialName) {
1970 auto avatarManager = DependencyManager::get<AvatarManager>();1958 auto avatarManager = DependencyManager::get<AvatarManager>();
1971 auto avatar = avatarManager->getAvatarBySessionID(avatarID);1959 auto avatar = avatarManager->getAvatarBySessionID(avatarID);
1972 if (avatar) {1960 if (avatar) {
@@ -2289,7 +2277,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 316 unmodified lines
2289 2277
2290 // Setup the mouse ray pick and related operators2278 // Setup the mouse ray pick and related operators
2291 {2279 {
2292 auto mouseRayPick = std::make_shared<RayPick>(Vectors::ZERO, Vectors::UP, PickFilter(PickScriptingInterface::PICK_ENTITIES()), 0.0f, true);2280 auto mouseRayPick = std::make_shared<RayPick>(Vectors::ZERO, Vectors::UP, PickFilter(PickScriptingInterface::PICK_ENTITIES() | PickScriptingInterface::PICK_LOCAL_ENTITIES()), 0.0f, true);
2293 mouseRayPick->parentTransform = std::make_shared<MouseTransformNode>();2281 mouseRayPick->parentTransform = std::make_shared<MouseTransformNode>();
2294 mouseRayPick->setJointState(PickQuery::JOINT_STATE_MOUSE);2282 mouseRayPick->setJointState(PickQuery::JOINT_STATE_MOUSE);
2295 auto mouseRayPickID = DependencyManager::get<PickManager>()->addPick(PickQuery::Ray, mouseRayPick);2283 auto mouseRayPickID = DependencyManager::get<PickManager>()->addPick(PickQuery::Ray, mouseRayPick);
@@ -6999,17 +6987,19 @@ void Application::nodeActivated(SharedNodePointer node) { · 4703 unmodified lines
6999 6987
7000#if !defined(DISABLE_QML)6988#if !defined(DISABLE_QML)
7001 auto offscreenUi = getOffscreenUI();6989 auto offscreenUi = getOffscreenUI();
7002 auto assetDialog = offscreenUi ? offscreenUi->getRootItem()->findChild<QQuickItem*>("AssetServer") : nullptr;
7003 6990
7004 if (assetDialog) {6991 if (offscreenUi) {
7005 auto nodeList = DependencyManager::get<NodeList>();6992 auto nodeList = DependencyManager::get<NodeList>();
7006 6993
7007 if (nodeList->getThisNodeCanWriteAssets()) {6994 if (nodeList->getThisNodeCanWriteAssets()) {
7008 // call reload on the shown asset browser dialog to get the mappings (if permissions allow)6995 // call reload on the shown asset browser dialog to get the mappings (if permissions allow)
7009 QMetaObject::invokeMethod(assetDialog, "reload");6996 auto assetDialog = offscreenUi ? offscreenUi->getRootItem()->findChild<QQuickItem*>("AssetServer") : nullptr;
6997 if (assetDialog) {
6998 QMetaObject::invokeMethod(assetDialog, "reload");
6999 }
7010 } else {7000 } else {
7011 // we switched to an Asset Server that we can't modify, hide the Asset Browser7001 // we switched to an Asset Server that we can't modify, hide the Asset Browser
7012 assetDialog->setVisible(false);7002 offscreenUi->hide("AssetServer");
7013 }7003 }
7014 }7004 }
7015#endif7005#endif