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 | 140 | if (entity) { |
| 141 | 141 | // make sure the properties has a type, so that the encode can know which properties to include |
| 142 | 142 | properties.setType(entity->getType()); |
| 143 | − if (properties.hasTerseUpdateChanges()) { | |
| 143 | + bool hasTerseUpdateChanges = properties.hasTerseUpdateChanges(); | |
| 144 | + bool hasPhysicsChanges = properties.hasMiscPhysicsChanges() || hasTerseUpdateChanges; | |
| 145 | + if (hasPhysicsChanges) { | |
| 144 | 146 | auto nodeList = DependencyManager::get<NodeList>(); |
| 145 | 147 | const QUuid myNodeID = nodeList->getSessionUUID(); |
| 146 | 148 | |
| 147 | 149 | if (entity->getSimulatorID() == myNodeID) { |
| 148 | 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 | 154 | // TODO: if we knew that ONLY TerseUpdate properties have changed in properties AND the object |
| 151 | 155 | // is dynamic AND it is active in the physics simulation then we could chose to NOT queue an update |
| 152 | 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 | 562 | return false; |
| 559 | 563 | } |
| 560 | 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 | 570 | return true; |
| 563 | 571 | } |
| 564 | 572 | return false; |
| @@ -574,7 +582,11 @@ bool EntityScriptingInterface::updateAction(const QUuid& entityID, const QUuid& · 9 unmodified lines | ||
| 574 | 582 | return actionWorker(entityID, [&](EntitySimulation* simulation, EntityItemPointer entity) { |
| 575 | 583 | bool success = entity->updateAction(simulation, actionID, arguments); |
| 576 | 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 | 591 | return success; |
| 580 | 592 | }); |