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