Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 69 files). Show all
Unified · Split
| @@ -79,7 +79,7 @@ QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties · 78 unmodified lines | ||
| 79 | 79 | bool success = true; |
| 80 | 80 | if (_entityTree) { |
| 81 | 81 | _entityTree->lockForWrite(); |
| 82 | − EntityItem* entity = _entityTree->addEntity(id, propertiesWithSimID); | |
| 82 | + EntityItemPointer entity = _entityTree->addEntity(id, propertiesWithSimID); | |
| 83 | 83 | if (entity) { |
| 84 | 84 | entity->setLastBroadcast(usecTimestampNow()); |
| 85 | 85 | // This Node is creating a new object. If it's in motion, set this Node as the simulator. |
| @@ -103,7 +103,8 @@ EntityItemProperties EntityScriptingInterface::getEntityProperties(QUuid identit · 17 unmodified lines | ||
| 103 | 103 | EntityItemProperties results; |
| 104 | 104 | if (_entityTree) { |
| 105 | 105 | _entityTree->lockForRead(); |
| 106 | − EntityItem* entity = const_cast<EntityItem*>(_entityTree->findEntityByEntityItemID(EntityItemID(identity))); | |
| 106 | + | |
| 107 | + EntityItemPointer entity = _entityTree->findEntityByEntityItemID(EntityItemID(identity)); | |
| 107 | 108 | |
| 108 | 109 | if (entity) { |
| 109 | 110 | results = entity->getProperties(); |
| @@ -138,7 +139,7 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& · 28 unmodified lines | ||
| 138 | 139 | |
| 139 | 140 | // make sure the properties has a type, so that the encode can know which properties to include |
| 140 | 141 | if (properties.getType() == EntityTypes::Unknown) { |
| 141 | − EntityItem* entity = _entityTree->findEntityByEntityItemID(entityID); | |
| 142 | + EntityItemPointer entity = _entityTree->findEntityByEntityItemID(entityID); | |
| 142 | 143 | if (entity) { |
| 143 | 144 | // we need to change the outgoing properties, so we make a copy, modify, and send. |
| 144 | 145 | EntityItemProperties modifiedProperties = properties; |
| @@ -162,7 +163,7 @@ void EntityScriptingInterface::deleteEntity(QUuid id) { · 17 unmodified lines | ||
| 162 | 163 | if (_entityTree) { |
| 163 | 164 | _entityTree->lockForWrite(); |
| 164 | 165 | |
| 165 | − EntityItem* entity = const_cast<EntityItem*>(_entityTree->findEntityByEntityItemID(entityID)); | |
| 166 | + EntityItemPointer entity = _entityTree->findEntityByEntityItemID(entityID); | |
| 166 | 167 | if (entity) { |
| 167 | 168 | if (entity->getLocked()) { |
| 168 | 169 | shouldDelete = false; |
| @@ -184,7 +185,7 @@ QUuid EntityScriptingInterface::findClosestEntity(const glm::vec3& center, float · 15 unmodified lines | ||
| 184 | 185 | EntityItemID result; |
| 185 | 186 | if (_entityTree) { |
| 186 | 187 | _entityTree->lockForRead(); |
| 187 | − const EntityItem* closestEntity = _entityTree->findClosestEntity(center, radius); | |
| 188 | + EntityItemPointer closestEntity = _entityTree->findClosestEntity(center, radius); | |
| 188 | 189 | _entityTree->unlock(); |
| 189 | 190 | if (closestEntity) { |
| 190 | 191 | result = closestEntity->getEntityItemID(); |
| @@ -206,11 +207,11 @@ QVector<QUuid> EntityScriptingInterface::findEntities(const glm::vec3& center, f · 15 unmodified lines | ||
| 206 | 207 | QVector<QUuid> result; |
| 207 | 208 | if (_entityTree) { |
| 208 | 209 | _entityTree->lockForRead(); |
| 209 | − QVector<const EntityItem*> entities; | |
| 210 | + QVector<EntityItemPointer> entities; | |
| 210 | 211 | _entityTree->findEntities(center, radius, entities); |
| 211 | 212 | _entityTree->unlock(); |
| 212 | 213 | |
| 213 | − foreach (const EntityItem* entity, entities) { | |
| 214 | + foreach (EntityItemPointer entity, entities) { | |
| 214 | 215 | result << entity->getEntityItemID(); |
| 215 | 216 | } |
| 216 | 217 | } |
| @@ -222,11 +223,11 @@ QVector<QUuid> EntityScriptingInterface::findEntitiesInBox(const glm::vec3& corn · 5 unmodified lines | ||
| 222 | 223 | if (_entityTree) { |
| 223 | 224 | _entityTree->lockForRead(); |
| 224 | 225 | AABox box(corner, dimensions); |
| 225 | − QVector<EntityItem*> entities; | |
| 226 | + QVector<EntityItemPointer> entities; | |
| 226 | 227 | _entityTree->findEntities(box, entities); |
| 227 | 228 | _entityTree->unlock(); |
| 228 | 229 | |
| 229 | − foreach (const EntityItem* entity, entities) { | |
| 230 | + foreach (EntityItemPointer entity, entities) { | |
| 230 | 231 | result << entity->getEntityItemID(); |
| 231 | 232 | } |
| 232 | 233 | } |
| @@ -249,7 +250,7 @@ RayToEntityIntersectionResult EntityScriptingInterface::findRayIntersectionWorke · 16 unmodified lines | ||
| 249 | 250 | RayToEntityIntersectionResult result; |
| 250 | 251 | if (_entityTree) { |
| 251 | 252 | OctreeElement* element; |
| 252 | − EntityItem* intersectedEntity = NULL; | |
| 253 | + EntityItemPointer intersectedEntity = NULL; | |
| 253 | 254 | result.intersects = _entityTree->findRayIntersection(ray.origin, ray.direction, element, result.distance, result.face, |
| 254 | 255 | (void**)&intersectedEntity, lockType, &result.accurate, |
| 255 | 256 | precisionPicking); |