History

CR

SamGondelman committed 8 years ago

Commit 2d754ed1 parent 324eefc35 files · +346 −299Browse files

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

Unified · Split

interface/src/Application.cpp+35−4
@@ -1593,7 +1593,38 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 1592 unmodified lines
15931593 }
15941594 });
15951595
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) {
15971628 auto avatarManager = DependencyManager::get<AvatarManager>();
15981629 auto avatar = avatarManager->getAvatarBySessionID(avatarID);
15991630 if (avatar) {
@@ -1602,7 +1633,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 2 unmodified lines
16021633 }
16031634 return false;
16041635 });
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) {
16061637 auto avatarManager = DependencyManager::get<AvatarManager>();
16071638 auto avatar = avatarManager->getAvatarBySessionID(avatarID);
16081639 if (avatar) {
@@ -1612,7 +1643,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 3 unmodified lines
16121643 return false;
16131644 });
16141645
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) {
16161647 auto overlay = _overlays.getOverlay(overlayID);
16171648 if (overlay) {
16181649 overlay->addMaterial(material, parentMaterialName);
@@ -1620,7 +1651,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 1 unmodified line
16201651 }
16211652 return false;
16221653 });
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) {
16241655 auto overlay = _overlays.getOverlay(overlayID);
16251656 if (overlay) {
16261657 overlay->removeMaterial(material, parentMaterialName);

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