Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 1 file). Show all
Unified · Split
| @@ -242,13 +242,12 @@ QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties · 241 unmodified lines | ||
| 242 | 242 | _activityTracking.addedEntityCount++; |
| 243 | 243 | |
| 244 | 244 | auto nodeList = DependencyManager::get<NodeList>(); |
| 245 | − auto sessionID = nodeList->getSessionUUID(); | |
| 245 | + const auto sessionID = nodeList->getSessionUUID(); | |
| 246 | 246 | |
| 247 | 247 | EntityItemProperties propertiesWithSimID = properties; |
| 248 | 248 | if (clientOnly) { |
| 249 | − const QUuid myNodeID = sessionID; | |
| 250 | 249 | propertiesWithSimID.setClientOnly(clientOnly); |
| 251 | − propertiesWithSimID.setOwningAvatarID(myNodeID); | |
| 250 | + propertiesWithSimID.setOwningAvatarID(sessionID); | |
| 252 | 251 | } |
| 253 | 252 | |
| 254 | 253 | propertiesWithSimID.setLastEditedBy(sessionID); |
| @@ -530,8 +529,7 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& · 275 unmodified lines | ||
| 530 | 529 | |
| 531 | 530 | _activityTracking.editedEntityCount++; |
| 532 | 531 | |
| 533 | − auto nodeList = DependencyManager::get<NodeList>(); | |
| 534 | − auto sessionID = nodeList->getSessionUUID(); | |
| 532 | + const auto sessionID = DependencyManager::get<NodeList>()->getSessionUUID(); | |
| 535 | 533 | |
| 536 | 534 | EntityItemProperties properties = scriptSideProperties; |
| 537 | 535 | properties.setLastEditedBy(sessionID); |
| @@ -550,7 +548,7 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& · 12 unmodified lines | ||
| 550 | 548 | return; |
| 551 | 549 | } |
| 552 | 550 | |
| 553 | − if (entity->getClientOnly() && entity->getOwningAvatarID() != nodeList->getSessionUUID()) { | |
| 551 | + if (entity->getClientOnly() && entity->getOwningAvatarID() != sessionID) { | |
| 554 | 552 | // don't edit other avatar's avatarEntities |
| 555 | 553 | return; |
| 556 | 554 | } |
| @@ -600,10 +598,7 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& · 43 unmodified lines | ||
| 600 | 598 | bool hasTransformOrVelocityChanges = properties.hasTransformOrVelocityChanges(); |
| 601 | 599 | bool hasPhysicsChanges = properties.hasMiscPhysicsChanges() || hasTransformOrVelocityChanges; |
| 602 | 600 | if (_bidOnSimulationOwnership && hasPhysicsChanges) { |
| 603 | − auto nodeList = DependencyManager::get<NodeList>(); | |
| 604 | − const QUuid myNodeID = nodeList->getSessionUUID(); | |
| 605 | − | |
| 606 | − if (entity->getSimulatorID() == myNodeID) { | |
| 601 | + if (entity->getSimulatorID() == sessionID) { | |
| 607 | 602 | // we think we already own the simulation, so make sure to send the full transform and all velocities |
| 608 | 603 | if (hasTransformOrVelocityChanges) { |
| 609 | 604 | entity->getTransformAndVelocityProperties(properties); |
| @@ -618,11 +613,11 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& · 8 unmodified lines | ||
| 618 | 613 | |
| 619 | 614 | if (entity->getSimulationPriority() < SCRIPT_POKE_SIMULATION_PRIORITY) { |
| 620 | 615 | // we re-assert our simulation ownership at a higher priority |
| 621 | − properties.setSimulationOwner(myNodeID, SCRIPT_POKE_SIMULATION_PRIORITY); | |
| 616 | + properties.setSimulationOwner(sessionID, SCRIPT_POKE_SIMULATION_PRIORITY); | |
| 622 | 617 | } |
| 623 | 618 | } else { |
| 624 | 619 | // we make a bid for simulation ownership |
| 625 | − properties.setSimulationOwner(myNodeID, SCRIPT_POKE_SIMULATION_PRIORITY); | |
| 620 | + properties.setSimulationOwner(sessionID, SCRIPT_POKE_SIMULATION_PRIORITY); | |
| 626 | 621 | entity->setScriptSimulationPriority(SCRIPT_POKE_SIMULATION_PRIORITY); |
| 627 | 622 | } |
| 628 | 623 | } |