Showing the changes to interface/src/Application.cpp (1 of 35 files). Show all
Unified · Split
| @@ -1593,7 +1593,38 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 1592 unmodified lines | ||
| 1593 | 1593 | } |
| 1594 | 1594 | }); |
| 1595 | 1595 | |
| 1596 | − EntityTree::setAddMaterialToAvatarOperator([](const QUuid& avatarID, graphics::MaterialPointer material, const QString& parentMaterialName) { | |
| 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) { | |
| 1597 | 1628 | auto avatarManager = DependencyManager::get<AvatarManager>(); |
| 1598 | 1629 | auto avatar = avatarManager->getAvatarBySessionID(avatarID); |
| 1599 | 1630 | if (avatar) { |
| @@ -1602,7 +1633,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 2 unmodified lines | ||
| 1602 | 1633 | } |
| 1603 | 1634 | return false; |
| 1604 | 1635 | }); |
| 1605 | − EntityTree::setRemoveMaterialFromAvatarOperator([](const QUuid& avatarID, graphics::MaterialPointer material, const QString& parentMaterialName) { | |
| 1636 | + EntityTree::setRemoveMaterialFromAvatarOperator([](const QUuid& avatarID, graphics::MaterialPointer material, const std::string& parentMaterialName) { | |
| 1606 | 1637 | auto avatarManager = DependencyManager::get<AvatarManager>(); |
| 1607 | 1638 | auto avatar = avatarManager->getAvatarBySessionID(avatarID); |
| 1608 | 1639 | if (avatar) { |
| @@ -1612,7 +1643,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 3 unmodified lines | ||
| 1612 | 1643 | return false; |
| 1613 | 1644 | }); |
| 1614 | 1645 | |
| 1615 | − EntityTree::setAddMaterialToOverlayOperator([&](const QUuid& overlayID, graphics::MaterialPointer material, const QString& parentMaterialName) { | |
| 1646 | + EntityTree::setAddMaterialToOverlayOperator([&](const QUuid& overlayID, graphics::MaterialLayer material, const std::string& parentMaterialName) { | |
| 1616 | 1647 | auto overlay = _overlays.getOverlay(overlayID); |
| 1617 | 1648 | if (overlay) { |
| 1618 | 1649 | overlay->addMaterial(material, parentMaterialName); |
| @@ -1620,7 +1651,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 1 unmodified line | ||
| 1620 | 1651 | } |
| 1621 | 1652 | return false; |
| 1622 | 1653 | }); |
| 1623 | − EntityTree::setRemoveMaterialFromOverlayOperator([&](const QUuid& overlayID, graphics::MaterialPointer material, const QString& parentMaterialName) { | |
| 1654 | + EntityTree::setRemoveMaterialFromOverlayOperator([&](const QUuid& overlayID, graphics::MaterialPointer material, const std::string& parentMaterialName) { | |
| 1624 | 1655 | auto overlay = _overlays.getOverlay(overlayID); |
| 1625 | 1656 | if (overlay) { |
| 1626 | 1657 | overlay->removeMaterial(material, parentMaterialName); |