Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 5 files). Show all
Unified · Split
| @@ -140,13 +140,17 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, EntityItemProperties proper · 139 unmodified lines | |||
| 140 | if (entity) { | 140 | if (entity) { |
| 141 | // make sure the properties has a type, so that the encode can know which properties to include | 141 | // make sure the properties has a type, so that the encode can know which properties to include |
| 142 | properties.setType(entity->getType()); | 142 | properties.setType(entity->getType()); |
| 143 | if (properties.hasTerseUpdateChanges()) { | 143 | bool hasTerseUpdateChanges = properties.hasTerseUpdateChanges(); |
| 144 | bool hasPhysicsChanges = properties.hasMiscPhysicsChanges() || hasTerseUpdateChanges; | ||
| 145 | if (hasPhysicsChanges) { | ||
| 144 | auto nodeList = DependencyManager::get<NodeList>(); | 146 | auto nodeList = DependencyManager::get<NodeList>(); |
| 145 | const QUuid myNodeID = nodeList->getSessionUUID(); | 147 | const QUuid myNodeID = nodeList->getSessionUUID(); |
| 146 | 148 | ||
| 147 | if (entity->getSimulatorID() == myNodeID) { | 149 | if (entity->getSimulatorID() == myNodeID) { |
| 148 | // we think we already own the simulation, so make sure to send ALL TerseUpdate properties | 150 | // we think we already own the simulation, so make sure to send ALL TerseUpdate properties |
| 149 | entity->getAllTerseUpdateProperties(properties); | 151 | if (hasTerseUpdateChanges) { |
| 152 | entity->getAllTerseUpdateProperties(properties); | ||
| 153 | } | ||
| 150 | // TODO: if we knew that ONLY TerseUpdate properties have changed in properties AND the object | 154 | // TODO: if we knew that ONLY TerseUpdate properties have changed in properties AND the object |
| 151 | // is dynamic AND it is active in the physics simulation then we could chose to NOT queue an update | 155 | // is dynamic AND it is active in the physics simulation then we could chose to NOT queue an update |
| 152 | // and instead let the physics simulation decide when to send a terse update. This would remove | 156 | // and instead let the physics simulation decide when to send a terse update. This would remove |
| @@ -558,7 +562,11 @@ QUuid EntityScriptingInterface::addAction(const QString& actionTypeString, · 405 unmodified lines | |||
| 558 | return false; | 562 | return false; |
| 559 | } | 563 | } |
| 560 | if (actionFactory->factory(simulation, actionType, actionID, entity, arguments)) { | 564 | if (actionFactory->factory(simulation, actionType, actionID, entity, arguments)) { |
| 561 | entity->flagForOwnership(); | 565 | auto nodeList = DependencyManager::get<NodeList>(); |
| 566 | const QUuid myNodeID = nodeList->getSessionUUID(); | ||
| 567 | if (entity->getSimulatorID() != myNodeID) { | ||
| 568 | entity->flagForOwnership(); | ||
| 569 | } | ||
| 562 | return true; | 570 | return true; |
| 563 | } | 571 | } |
| 564 | return false; | 572 | return false; |
| @@ -574,7 +582,11 @@ bool EntityScriptingInterface::updateAction(const QUuid& entityID, const QUuid& · 9 unmodified lines | |||
| 574 | return actionWorker(entityID, [&](EntitySimulation* simulation, EntityItemPointer entity) { | 582 | return actionWorker(entityID, [&](EntitySimulation* simulation, EntityItemPointer entity) { |
| 575 | bool success = entity->updateAction(simulation, actionID, arguments); | 583 | bool success = entity->updateAction(simulation, actionID, arguments); |
| 576 | if (success) { | 584 | if (success) { |
| 577 | entity->flagForOwnership(); | 585 | auto nodeList = DependencyManager::get<NodeList>(); |
| 586 | const QUuid myNodeID = nodeList->getSessionUUID(); | ||
| 587 | if (entity->getSimulatorID() != myNodeID) { | ||
| 588 | entity->flagForOwnership(); | ||
| 589 | } | ||
| 578 | } | 590 | } |
| 579 | return success; | 591 | return success; |
| 580 | }); | 592 | }); |