Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 7 files). Show all
Unified · Split
| @@ -68,11 +68,11 @@ void bidForSimulationOwnership(EntityItemProperties& properties) { · 67 unmodified lines | ||
| 68 | 68 | |
| 69 | 69 | |
| 70 | 70 | |
| 71 | −EntityItemID EntityScriptingInterface::addEntity(const EntityItemProperties& properties) { | |
| 71 | +QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties) { | |
| 72 | 72 | |
| 73 | 73 | EntityItemProperties propertiesWithSimID = properties; |
| 74 | 74 | |
| 75 | − EntityItemID id = EntityItemID(QUuid::createUuid()); | |
| 75 | + EntityItemID id = EntityItemID(UNKNOWN_ENTITY_ID); | |
| 76 | 76 | |
| 77 | 77 | // If we have a local entity tree set, then also update it. |
| 78 | 78 | bool success = true; |
| @@ -95,10 +95,10 @@ EntityItemID EntityScriptingInterface::addEntity(const EntityItemProperties& pro · 16 unmodified lines | ||
| 95 | 95 | queueEntityMessage(PacketTypeEntityAddOrEdit, id, propertiesWithSimID); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | − return id; | |
| 98 | + return id.id; | |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | −EntityItemProperties EntityScriptingInterface::getEntityProperties(EntityItemID identity) { | |
| 101 | +EntityItemProperties EntityScriptingInterface::getEntityProperties(QUuid identity) { | |
| 102 | 102 | EntityItemProperties results; |
| 103 | 103 | if (_entityTree) { |
| 104 | 104 | _entityTree->lockForRead(); |
| @@ -126,7 +126,7 @@ EntityItemProperties EntityScriptingInterface::getEntityProperties(EntityItemID · 21 unmodified lines | ||
| 126 | 126 | return results; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | −EntityItemID EntityScriptingInterface::editEntity(EntityItemID id, const EntityItemProperties& properties) { | |
| 129 | +QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& properties) { | |
| 130 | 130 | EntityItemID entityID(id); |
| 131 | 131 | // If we have a local entity tree set, then also update it. |
| 132 | 132 | if (_entityTree) { |
| @@ -153,7 +153,7 @@ EntityItemID EntityScriptingInterface::editEntity(EntityItemID id, const EntityI · 20 unmodified lines | ||
| 153 | 153 | return id; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | −void EntityScriptingInterface::deleteEntity(EntityItemID id) { | |
| 156 | +void EntityScriptingInterface::deleteEntity(QUuid id) { | |
| 157 | 157 | EntityItemID entityID(id); |
| 158 | 158 | bool shouldDelete = true; |
| 159 | 159 | |
| @@ -179,17 +179,17 @@ void EntityScriptingInterface::deleteEntity(EntityItemID id) { · 19 unmodified lines | ||
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | −EntityItemID EntityScriptingInterface::findClosestEntity(const glm::vec3& center, float radius) const { | |
| 183 | − QUuid result; | |
| 182 | +QUuid EntityScriptingInterface::findClosestEntity(const glm::vec3& center, float radius) const { | |
| 183 | + EntityItemID result; | |
| 184 | 184 | if (_entityTree) { |
| 185 | 185 | _entityTree->lockForRead(); |
| 186 | 186 | const EntityItem* closestEntity = _entityTree->findClosestEntity(center, radius); |
| 187 | 187 | _entityTree->unlock(); |
| 188 | 188 | if (closestEntity) { |
| 189 | − result = closestEntity->getEntityItemID().id; | |
| 189 | + result = closestEntity->getEntityItemID(); | |
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | − return result; | |
| 192 | + return result.id; | |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | |
| @@ -201,8 +201,8 @@ void EntityScriptingInterface::dumpTree() const { · 5 unmodified lines | ||
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | −QVector<EntityItemID> EntityScriptingInterface::findEntities(const glm::vec3& center, float radius) const { | |
| 205 | − QVector<EntityItemID> result; | |
| 204 | +QVector<QUuid> EntityScriptingInterface::findEntities(const glm::vec3& center, float radius) const { | |
| 205 | + QVector<QUuid> result; | |
| 206 | 206 | if (_entityTree) { |
| 207 | 207 | _entityTree->lockForRead(); |
| 208 | 208 | QVector<const EntityItem*> entities; |
| @@ -210,14 +210,14 @@ QVector<EntityItemID> EntityScriptingInterface::findEntities(const glm::vec3& ce · 1 unmodified line | ||
| 210 | 210 | _entityTree->unlock(); |
| 211 | 211 | |
| 212 | 212 | foreach (const EntityItem* entity, entities) { |
| 213 | − result << entity->getEntityItemID(); | |
| 213 | + result << entity->getEntityItemID().id; | |
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | return result; |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | −QVector<EntityItemID> EntityScriptingInterface::findEntitiesInBox(const glm::vec3& corner, const glm::vec3& dimensions) const { | |
| 220 | − QVector<EntityItemID> result; | |
| 219 | +QVector<QUuid> EntityScriptingInterface::findEntitiesInBox(const glm::vec3& corner, const glm::vec3& dimensions) const { | |
| 220 | + QVector<QUuid> result; | |
| 221 | 221 | if (_entityTree) { |
| 222 | 222 | _entityTree->lockForRead(); |
| 223 | 223 | AABox box(corner, dimensions); |
| @@ -226,7 +226,7 @@ QVector<EntityItemID> EntityScriptingInterface::findEntitiesInBox(const glm::vec · 2 unmodified lines | ||
| 226 | 226 | _entityTree->unlock(); |
| 227 | 227 | |
| 228 | 228 | foreach (const EntityItem* entity, entities) { |
| 229 | − result << entity->getEntityItemID(); | |
| 229 | + result << entity->getEntityItemID().id; | |
| 230 | 230 | } |
| 231 | 231 | } |
| 232 | 232 | return result; |
| @@ -353,7 +353,8 @@ void RayToEntityIntersectionResultFromScriptValue(const QScriptValue& object, Ra · 120 unmodified lines | ||
| 353 | 353 | value.intersects = object.property("intersects").toVariant().toBool(); |
| 354 | 354 | value.accurate = object.property("accurate").toVariant().toBool(); |
| 355 | 355 | QScriptValue entityIDValue = object.property("entityID"); |
| 356 | − EntityItemIDfromScriptValue(entityIDValue, value.entityID); | |
| 356 | + // EntityItemIDfromScriptValue(entityIDValue, value.entityID); | |
| 357 | + quuidFromScriptValue(entityIDValue, value.entityID); | |
| 357 | 358 | QScriptValue entityPropertiesValue = object.property("properties"); |
| 358 | 359 | if (entityPropertiesValue.isValid()) { |
| 359 | 360 | EntityItemPropertiesFromScriptValue(entityPropertiesValue, value.properties); |