handControllerGrab.js and WebTablet.js now parents objects to the AVATAR_SELF_ID parentID, instead of using MyAvatar.sessionUUID, which is unavailable when not connected to any domain. I removed several early returns handControllerGrab.js that prevented grabbing from working if MyAvatar.sessionUUID was invalid. There were places in the EntityItem.cpp and EntityScriptingInterface.cpp C++ that would log an error if parentID was set to AVATAR_SELF_ID. This was to prevent AVATAR_SELF_ID from ever going over the network. Instead, we now prevent this by replacing all outgoing references of AVATAR_SELF_ID with the sessionID of the current node.
Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 4 files). Show all
Unified · Split
| @@ -190,11 +190,6 @@ QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties · 189 unmodified lines | ||
| 190 | 190 | propertiesWithSimID.setOwningAvatarID(myNodeID); |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | − if (propertiesWithSimID.getParentID() == AVATAR_SELF_ID) { | |
| 194 | − qCDebug(entities) << "ERROR: Cannot set entity parent ID to the local-only MyAvatar ID"; | |
| 195 | − propertiesWithSimID.setParentID(QUuid()); | |
| 196 | − } | |
| 197 | − | |
| 198 | 193 | auto dimensions = propertiesWithSimID.getDimensions(); |
| 199 | 194 | float volume = dimensions.x * dimensions.y * dimensions.z; |
| 200 | 195 | auto density = propertiesWithSimID.getDensity(); |
| @@ -371,9 +366,6 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& · 170 unmodified lines | ||
| 371 | 366 | |
| 372 | 367 | if (!scriptSideProperties.parentIDChanged()) { |
| 373 | 368 | properties.setParentID(entity->getParentID()); |
| 374 | − } else if (scriptSideProperties.getParentID() == AVATAR_SELF_ID) { | |
| 375 | − qCDebug(entities) << "ERROR: Cannot set entity parent ID to the local-only MyAvatar ID"; | |
| 376 | − properties.setParentID(QUuid()); | |
| 377 | 369 | } |
| 378 | 370 | if (!scriptSideProperties.parentJointIndexChanged()) { |
| 379 | 371 | properties.setParentJointIndex(entity->getParentJointIndex()); |