Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 1 file). Show all
Unified · Split
| @@ -481,11 +481,15 @@ QUuid EntityScriptingInterface::addEntityInternal(const EntityItemProperties& pr · 480 unmodified lines | ||
| 481 | 481 | _activityTracking.addedEntityCount++; |
| 482 | 482 | |
| 483 | 483 | auto nodeList = DependencyManager::get<NodeList>(); |
| 484 | − const auto sessionID = nodeList->getSessionUUID(); | |
| 484 | + auto sessionID = nodeList->getSessionUUID(); | |
| 485 | 485 | |
| 486 | 486 | EntityItemProperties propertiesWithSimID = properties; |
| 487 | 487 | propertiesWithSimID.setEntityHostType(entityHostType); |
| 488 | 488 | if (entityHostType == entity::HostType::AVATAR) { |
| 489 | + if (sessionID.isNull()) { | |
| 490 | + // null sessionID is unacceptable in this case | |
| 491 | + sessionID = AVATAR_SELF_ID; | |
| 492 | + } | |
| 489 | 493 | propertiesWithSimID.setOwningAvatarID(sessionID); |
| 490 | 494 | } else if (entityHostType == entity::HostType::LOCAL) { |
| 491 | 495 | // For now, local entities are always collisionless |
| @@ -801,7 +805,7 @@ QUuid EntityScriptingInterface::editEntity(const QUuid& id, const EntityItemProp · 309 unmodified lines | ||
| 801 | 805 | return; |
| 802 | 806 | } |
| 803 | 807 | |
| 804 | − if (entity->isAvatarEntity() && entity->getOwningAvatarID() != sessionID) { | |
| 808 | + if (entity->isAvatarEntity() && entity->getOwningAvatarID() != sessionID && entity->getOwningAvatarID() != AVATAR_SELF_ID) { | |
| 805 | 809 | // don't edit other avatar's avatarEntities |
| 806 | 810 | properties = EntityItemProperties(); |
| 807 | 811 | return; |