Showing the changes to interface/src/Application.cpp (1 of 12 files). Show all
Unified · Split
| @@ -1926,46 +1926,32 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 1925 unmodified lines | |||
| 1926 | } | 1926 | } |
| 1927 | }); | 1927 | }); |
| 1928 | 1928 | ||
| 1929 | EntityTree::setAddMaterialToEntityOperator([this](const QUuid& entityID, graphics::MaterialLayer material, const std::string& parentMaterialName) { | 1929 | EntityTreeRenderer::setAddMaterialToEntityOperator([this](const QUuid& entityID, graphics::MaterialLayer material, const std::string& parentMaterialName) { |
| 1930 | if (_aboutToQuit) { | 1930 | if (_aboutToQuit) { |
| 1931 | return false; | 1931 | return false; |
| 1932 | } | 1932 | } |
| 1933 | 1933 | ||
| 1934 | // try to find the renderable | ||
| 1935 | auto renderable = getEntities()->renderableForEntityId(entityID); | 1934 | auto renderable = getEntities()->renderableForEntityId(entityID); |
| 1936 | if (renderable) { | 1935 | if (renderable) { |
| 1937 | renderable->addMaterial(material, parentMaterialName); | 1936 | renderable->addMaterial(material, parentMaterialName); |
| 1938 | } | 1937 | } |
| 1939 | 1938 | ||
| 1940 | // even if we don't find it, try to find the entity | ||
| 1941 | auto entity = getEntities()->getEntity(entityID); | ||
| 1942 | if (entity) { | ||
| 1943 | entity->addMaterial(material, parentMaterialName); | ||
| 1944 | return true; | ||
| 1945 | } | ||
| 1946 | return false; | 1939 | return false; |
| 1947 | }); | 1940 | }); |
| 1948 | EntityTree::setRemoveMaterialFromEntityOperator([this](const QUuid& entityID, graphics::MaterialPointer material, const std::string& parentMaterialName) { | 1941 | EntityTreeRenderer::setRemoveMaterialFromEntityOperator([this](const QUuid& entityID, graphics::MaterialPointer material, const std::string& parentMaterialName) { |
| 1949 | if (_aboutToQuit) { | 1942 | if (_aboutToQuit) { |
| 1950 | return false; | 1943 | return false; |
| 1951 | } | 1944 | } |
| 1952 | 1945 | ||
| 1953 | // try to find the renderable | ||
| 1954 | auto renderable = getEntities()->renderableForEntityId(entityID); | 1946 | auto renderable = getEntities()->renderableForEntityId(entityID); |
| 1955 | if (renderable) { | 1947 | if (renderable) { |
| 1956 | renderable->removeMaterial(material, parentMaterialName); | 1948 | renderable->removeMaterial(material, parentMaterialName); |
| 1957 | } | 1949 | } |
| 1958 | 1950 | ||
| 1959 | // even if we don't find it, try to find the entity | ||
| 1960 | auto entity = getEntities()->getEntity(entityID); | ||
| 1961 | if (entity) { | ||
| 1962 | entity->removeMaterial(material, parentMaterialName); | ||
| 1963 | return true; | ||
| 1964 | } | ||
| 1965 | return false; | 1951 | return false; |
| 1966 | }); | 1952 | }); |
| 1967 | 1953 | ||
| 1968 | EntityTree::setAddMaterialToAvatarOperator([](const QUuid& avatarID, graphics::MaterialLayer material, const std::string& parentMaterialName) { | 1954 | EntityTreeRenderer::setAddMaterialToAvatarOperator([](const QUuid& avatarID, graphics::MaterialLayer material, const std::string& parentMaterialName) { |
| 1969 | auto avatarManager = DependencyManager::get<AvatarManager>(); | 1955 | auto avatarManager = DependencyManager::get<AvatarManager>(); |
| 1970 | auto avatar = avatarManager->getAvatarBySessionID(avatarID); | 1956 | auto avatar = avatarManager->getAvatarBySessionID(avatarID); |
| 1971 | if (avatar) { | 1957 | if (avatar) { |
| @@ -1974,7 +1960,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 2 unmodified lines | |||
| 1974 | } | 1960 | } |
| 1975 | return false; | 1961 | return false; |
| 1976 | }); | 1962 | }); |
| 1977 | EntityTree::setRemoveMaterialFromAvatarOperator([](const QUuid& avatarID, graphics::MaterialPointer material, const std::string& parentMaterialName) { | 1963 | EntityTreeRenderer::setRemoveMaterialFromAvatarOperator([](const QUuid& avatarID, graphics::MaterialPointer material, const std::string& parentMaterialName) { |
| 1978 | auto avatarManager = DependencyManager::get<AvatarManager>(); | 1964 | auto avatarManager = DependencyManager::get<AvatarManager>(); |
| 1979 | auto avatar = avatarManager->getAvatarBySessionID(avatarID); | 1965 | auto avatar = avatarManager->getAvatarBySessionID(avatarID); |
| 1980 | if (avatar) { | 1966 | if (avatar) { |
| @@ -1984,23 +1970,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 3 unmodified lines | |||
| 1984 | return false; | 1970 | return false; |
| 1985 | }); | 1971 | }); |
| 1986 | 1972 | ||
| 1987 | EntityTree::setAddMaterialToOverlayOperator([this](const QUuid& overlayID, graphics::MaterialLayer material, const std::string& parentMaterialName) { | ||
| 1988 | auto overlay = _overlays.getOverlay(overlayID); | ||
| 1989 | if (overlay) { | ||
| 1990 | overlay->addMaterial(material, parentMaterialName); | ||
| 1991 | return true; | ||
| 1992 | } | ||
| 1993 | return false; | ||
| 1994 | }); | ||
| 1995 | EntityTree::setRemoveMaterialFromOverlayOperator([this](const QUuid& overlayID, graphics::MaterialPointer material, const std::string& parentMaterialName) { | ||
| 1996 | auto overlay = _overlays.getOverlay(overlayID); | ||
| 1997 | if (overlay) { | ||
| 1998 | overlay->removeMaterial(material, parentMaterialName); | ||
| 1999 | return true; | ||
| 2000 | } | ||
| 2001 | return false; | ||
| 2002 | }); | ||
| 2003 | |||
| 2004 | // Keyboard focus handling for Web overlays. | 1973 | // Keyboard focus handling for Web overlays. |
| 2005 | auto overlays = &(qApp->getOverlays()); | 1974 | auto overlays = &(qApp->getOverlays()); |
| 2006 | connect(overlays, &Overlays::overlayDeleted, [this](const OverlayID& overlayID) { | 1975 | connect(overlays, &Overlays::overlayDeleted, [this](const OverlayID& overlayID) { |