Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 23 files). Show all
Unified · Split
| @@ -766,7 +766,7 @@ bool EntityScriptingInterface::appendPoint(QUuid entityID, const glm::vec3& poin · 765 unmodified lines | |||
| 766 | 766 | ||
| 767 | 767 | ||
| 768 | bool EntityScriptingInterface::actionWorker(const QUuid& entityID, | 768 | bool EntityScriptingInterface::actionWorker(const QUuid& entityID, |
| 769 | std::function<bool(EntitySimulation*, EntityItemPointer)> actor) { | 769 | std::function<bool(EntitySimulationPointer, EntityItemPointer)> actor) { |
| 770 | if (!_entityTree) { | 770 | if (!_entityTree) { |
| 771 | return false; | 771 | return false; |
| 772 | } | 772 | } |
| @@ -774,7 +774,7 @@ bool EntityScriptingInterface::actionWorker(const QUuid& entityID, · 1 unmodified line | |||
| 774 | EntityItemPointer entity; | 774 | EntityItemPointer entity; |
| 775 | bool doTransmit = false; | 775 | bool doTransmit = false; |
| 776 | _entityTree->withWriteLock([&] { | 776 | _entityTree->withWriteLock([&] { |
| 777 | EntitySimulation* simulation = _entityTree->getSimulation(); | 777 | EntitySimulationPointer simulation = _entityTree->getSimulation(); |
| 778 | entity = _entityTree->findEntityByEntityItemID(entityID); | 778 | entity = _entityTree->findEntityByEntityItemID(entityID); |
| 779 | if (!entity) { | 779 | if (!entity) { |
| 780 | qDebug() << "actionWorker -- unknown entity" << entityID; | 780 | qDebug() << "actionWorker -- unknown entity" << entityID; |
| @@ -815,7 +815,7 @@ QUuid EntityScriptingInterface::addAction(const QString& actionTypeString, · 34 unmodified lines | |||
| 815 | QUuid actionID = QUuid::createUuid(); | 815 | QUuid actionID = QUuid::createUuid(); |
| 816 | auto actionFactory = DependencyManager::get<EntityActionFactoryInterface>(); | 816 | auto actionFactory = DependencyManager::get<EntityActionFactoryInterface>(); |
| 817 | bool success = false; | 817 | bool success = false; |
| 818 | actionWorker(entityID, [&](EntitySimulation* simulation, EntityItemPointer entity) { | 818 | actionWorker(entityID, [&](EntitySimulationPointer simulation, EntityItemPointer entity) { |
| 819 | // create this action even if the entity doesn't have physics info. it will often be the | 819 | // create this action even if the entity doesn't have physics info. it will often be the |
| 820 | // case that a script adds an action immediately after an object is created, and the physicsInfo | 820 | // case that a script adds an action immediately after an object is created, and the physicsInfo |
| 821 | // is computed asynchronously. | 821 | // is computed asynchronously. |
| @@ -843,7 +843,7 @@ QUuid EntityScriptingInterface::addAction(const QString& actionTypeString, · 21 unmodified lines | |||
| 843 | 843 | ||
| 844 | 844 | ||
| 845 | bool EntityScriptingInterface::updateAction(const QUuid& entityID, const QUuid& actionID, const QVariantMap& arguments) { | 845 | bool EntityScriptingInterface::updateAction(const QUuid& entityID, const QUuid& actionID, const QVariantMap& arguments) { |
| 846 | return actionWorker(entityID, [&](EntitySimulation* simulation, EntityItemPointer entity) { | 846 | return actionWorker(entityID, [&](EntitySimulationPointer simulation, EntityItemPointer entity) { |
| 847 | bool success = entity->updateAction(simulation, actionID, arguments); | 847 | bool success = entity->updateAction(simulation, actionID, arguments); |
| 848 | if (success) { | 848 | if (success) { |
| 849 | entity->grabSimulationOwnership(); | 849 | entity->grabSimulationOwnership(); |
| @@ -854,7 +854,7 @@ bool EntityScriptingInterface::updateAction(const QUuid& entityID, const QUuid& · 4 unmodified lines | |||
| 854 | 854 | ||
| 855 | bool EntityScriptingInterface::deleteAction(const QUuid& entityID, const QUuid& actionID) { | 855 | bool EntityScriptingInterface::deleteAction(const QUuid& entityID, const QUuid& actionID) { |
| 856 | bool success = false; | 856 | bool success = false; |
| 857 | actionWorker(entityID, [&](EntitySimulation* simulation, EntityItemPointer entity) { | 857 | actionWorker(entityID, [&](EntitySimulationPointer simulation, EntityItemPointer entity) { |
| 858 | success = entity->removeAction(simulation, actionID); | 858 | success = entity->removeAction(simulation, actionID); |
| 859 | if (success) { | 859 | if (success) { |
| 860 | // reduce from grab to poke | 860 | // reduce from grab to poke |
| @@ -867,7 +867,7 @@ bool EntityScriptingInterface::deleteAction(const QUuid& entityID, const QUuid& · 6 unmodified lines | |||
| 867 | 867 | ||
| 868 | QVector<QUuid> EntityScriptingInterface::getActionIDs(const QUuid& entityID) { | 868 | QVector<QUuid> EntityScriptingInterface::getActionIDs(const QUuid& entityID) { |
| 869 | QVector<QUuid> result; | 869 | QVector<QUuid> result; |
| 870 | actionWorker(entityID, [&](EntitySimulation* simulation, EntityItemPointer entity) { | 870 | actionWorker(entityID, [&](EntitySimulationPointer simulation, EntityItemPointer entity) { |
| 871 | QList<QUuid> actionIDs = entity->getActionIDs(); | 871 | QList<QUuid> actionIDs = entity->getActionIDs(); |
| 872 | result = QVector<QUuid>::fromList(actionIDs); | 872 | result = QVector<QUuid>::fromList(actionIDs); |
| 873 | return false; // don't send an edit packet | 873 | return false; // don't send an edit packet |
| @@ -877,7 +877,7 @@ QVector<QUuid> EntityScriptingInterface::getActionIDs(const QUuid& entityID) { · 3 unmodified lines | |||
| 877 | 877 | ||
| 878 | QVariantMap EntityScriptingInterface::getActionArguments(const QUuid& entityID, const QUuid& actionID) { | 878 | QVariantMap EntityScriptingInterface::getActionArguments(const QUuid& entityID, const QUuid& actionID) { |
| 879 | QVariantMap result; | 879 | QVariantMap result; |
| 880 | actionWorker(entityID, [&](EntitySimulation* simulation, EntityItemPointer entity) { | 880 | actionWorker(entityID, [&](EntitySimulationPointer simulation, EntityItemPointer entity) { |
| 881 | result = entity->getActionArguments(actionID); | 881 | result = entity->getActionArguments(actionID); |
| 882 | return false; // don't send an edit packet | 882 | return false; // don't send an edit packet |
| 883 | }); | 883 | }); |