Showing the changes to interface/src/Application.cpp (1 of 85 files). Show all
Unified · Split
| @@ -1593,6 +1593,73 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 1592 unmodified lines | |||
| 1593 | } | 1593 | } |
| 1594 | }); | 1594 | }); |
| 1595 | 1595 | ||
| 1596 | EntityTree::setAddMaterialToEntityOperator([&](const QUuid& entityID, graphics::MaterialLayer material, const std::string& parentMaterialName) { | ||
| 1597 | // try to find the renderable | ||
| 1598 | auto renderable = getEntities()->renderableForEntityId(entityID); | ||
| 1599 | if (renderable) { | ||
| 1600 | renderable->addMaterial(material, parentMaterialName); | ||
| 1601 | } | ||
| 1602 | |||
| 1603 | // even if we don't find it, try to find the entity | ||
| 1604 | auto entity = getEntities()->getEntity(entityID); | ||
| 1605 | if (entity) { | ||
| 1606 | entity->addMaterial(material, parentMaterialName); | ||
| 1607 | return true; | ||
| 1608 | } | ||
| 1609 | return false; | ||
| 1610 | }); | ||
| 1611 | EntityTree::setRemoveMaterialFromEntityOperator([&](const QUuid& entityID, graphics::MaterialPointer material, const std::string& parentMaterialName) { | ||
| 1612 | // try to find the renderable | ||
| 1613 | auto renderable = getEntities()->renderableForEntityId(entityID); | ||
| 1614 | if (renderable) { | ||
| 1615 | renderable->removeMaterial(material, parentMaterialName); | ||
| 1616 | } | ||
| 1617 | |||
| 1618 | // even if we don't find it, try to find the entity | ||
| 1619 | auto entity = getEntities()->getEntity(entityID); | ||
| 1620 | if (entity) { | ||
| 1621 | entity->removeMaterial(material, parentMaterialName); | ||
| 1622 | return true; | ||
| 1623 | } | ||
| 1624 | return false; | ||
| 1625 | }); | ||
| 1626 | |||
| 1627 | EntityTree::setAddMaterialToAvatarOperator([](const QUuid& avatarID, graphics::MaterialLayer material, const std::string& parentMaterialName) { | ||
| 1628 | auto avatarManager = DependencyManager::get<AvatarManager>(); | ||
| 1629 | auto avatar = avatarManager->getAvatarBySessionID(avatarID); | ||
| 1630 | if (avatar) { | ||
| 1631 | avatar->addMaterial(material, parentMaterialName); | ||
| 1632 | return true; | ||
| 1633 | } | ||
| 1634 | return false; | ||
| 1635 | }); | ||
| 1636 | EntityTree::setRemoveMaterialFromAvatarOperator([](const QUuid& avatarID, graphics::MaterialPointer material, const std::string& parentMaterialName) { | ||
| 1637 | auto avatarManager = DependencyManager::get<AvatarManager>(); | ||
| 1638 | auto avatar = avatarManager->getAvatarBySessionID(avatarID); | ||
| 1639 | if (avatar) { | ||
| 1640 | avatar->removeMaterial(material, parentMaterialName); | ||
| 1641 | return true; | ||
| 1642 | } | ||
| 1643 | return false; | ||
| 1644 | }); | ||
| 1645 | |||
| 1646 | EntityTree::setAddMaterialToOverlayOperator([&](const QUuid& overlayID, graphics::MaterialLayer material, const std::string& parentMaterialName) { | ||
| 1647 | auto overlay = _overlays.getOverlay(overlayID); | ||
| 1648 | if (overlay) { | ||
| 1649 | overlay->addMaterial(material, parentMaterialName); | ||
| 1650 | return true; | ||
| 1651 | } | ||
| 1652 | return false; | ||
| 1653 | }); | ||
| 1654 | EntityTree::setRemoveMaterialFromOverlayOperator([&](const QUuid& overlayID, graphics::MaterialPointer material, const std::string& parentMaterialName) { | ||
| 1655 | auto overlay = _overlays.getOverlay(overlayID); | ||
| 1656 | if (overlay) { | ||
| 1657 | overlay->removeMaterial(material, parentMaterialName); | ||
| 1658 | return true; | ||
| 1659 | } | ||
| 1660 | return false; | ||
| 1661 | }); | ||
| 1662 | |||
| 1596 | // Keyboard focus handling for Web overlays. | 1663 | // Keyboard focus handling for Web overlays. |
| 1597 | auto overlays = &(qApp->getOverlays()); | 1664 | auto overlays = &(qApp->getOverlays()); |
| 1598 | connect(overlays, &Overlays::overlayDeleted, [=](const OverlayID& overlayID) { | 1665 | connect(overlays, &Overlays::overlayDeleted, [=](const OverlayID& overlayID) { |