Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 7 files). Show all
Unified · Split
| @@ -29,7 +29,7 @@ EntityItemID EntityScriptingInterface::addEntity(const EntityItemProperties& pro · 28 unmodified lines | |||
| 29 | // The application will keep track of creatorTokenID | 29 | // The application will keep track of creatorTokenID |
| 30 | uint32_t creatorTokenID = EntityItem::getNextCreatorTokenID(); | 30 | uint32_t creatorTokenID = EntityItem::getNextCreatorTokenID(); |
| 31 | 31 | ||
| 32 | EntityItemID id(NEW_MODEL, creatorTokenID, false ); | 32 | EntityItemID id(NEW_ENTITY, creatorTokenID, false ); |
| 33 | 33 | ||
| 34 | // queue the packet | 34 | // queue the packet |
| 35 | queueEntityMessage(PacketTypeEntityAddOrEdit, id, properties); | 35 | queueEntityMessage(PacketTypeEntityAddOrEdit, id, properties); |
| @@ -49,7 +49,7 @@ EntityItemID EntityScriptingInterface::identifyEntity(EntityItemID entityID) { · 13 unmodified lines | |||
| 49 | 49 | ||
| 50 | if (!entityID.isKnownID) { | 50 | if (!entityID.isKnownID) { |
| 51 | actualID = EntityItem::getIDfromCreatorTokenID(entityID.creatorTokenID); | 51 | actualID = EntityItem::getIDfromCreatorTokenID(entityID.creatorTokenID); |
| 52 | if (actualID == UNKNOWN_MODEL_ID) { | 52 | if (actualID == UNKNOWN_ENTITY_ID) { |
| 53 | return entityID; // bailing early | 53 | return entityID; // bailing early |
| 54 | } | 54 | } |
| 55 | 55 | ||
| @@ -92,7 +92,7 @@ EntityItemID EntityScriptingInterface::editEntity(EntityItemID entityID, const E · 36 unmodified lines | |||
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | // if at this point, we know the id, send the update to the model server | 94 | // if at this point, we know the id, send the update to the model server |
| 95 | if (actualID != UNKNOWN_MODEL_ID) { | 95 | if (actualID != UNKNOWN_ENTITY_ID) { |
| 96 | entityID.id = actualID; | 96 | entityID.id = actualID; |
| 97 | entityID.isKnownID = true; | 97 | entityID.isKnownID = true; |
| 98 | queueEntityMessage(PacketTypeEntityAddOrEdit, entityID, properties); | 98 | queueEntityMessage(PacketTypeEntityAddOrEdit, entityID, properties); |
| @@ -109,9 +109,9 @@ EntityItemID EntityScriptingInterface::editEntity(EntityItemID entityID, const E · 10 unmodified lines | |||
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | 111 | ||
| 112 | // TODO: This deleteEntity() method uses the PacketType_MODEL_ADD_OR_EDIT message to send | 112 | // TODO: This deleteEntity() method uses the PacketTypeEntityAddOrEdit message to send |
| 113 | // a changed model with a shouldDie() property set to true. This works and is currently the only | 113 | // a changed model with a shouldDie() property set to true. This works and is currently the only |
| 114 | // way to tell the model server to delete a model. But we should change this to use the PacketType_MODEL_ERASE | 114 | // way to tell the model server to delete a model. But we should change this to use the PacketTypeEntityErase |
| 115 | // message which takes a list of model id's to delete. | 115 | // message which takes a list of model id's to delete. |
| 116 | void EntityScriptingInterface::deleteEntity(EntityItemID entityID) { | 116 | void EntityScriptingInterface::deleteEntity(EntityItemID entityID) { |
| 117 | 117 | ||
| @@ -127,7 +127,7 @@ void EntityScriptingInterface::deleteEntity(EntityItemID entityID) { · 9 unmodified lines | |||
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | // if at this point, we know the id, send the update to the model server | 129 | // if at this point, we know the id, send the update to the model server |
| 130 | if (actualID != UNKNOWN_MODEL_ID) { | 130 | if (actualID != UNKNOWN_ENTITY_ID) { |
| 131 | entityID.id = actualID; | 131 | entityID.id = actualID; |
| 132 | entityID.isKnownID = true; | 132 | entityID.isKnownID = true; |
| 133 | queueEntityMessage(PacketTypeEntityAddOrEdit, entityID, properties); | 133 | queueEntityMessage(PacketTypeEntityAddOrEdit, entityID, properties); |
| @@ -142,7 +142,7 @@ void EntityScriptingInterface::deleteEntity(EntityItemID entityID) { · 8 unmodified lines | |||
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | EntityItemID EntityScriptingInterface::findClosestEntity(const glm::vec3& center, float radius) const { | 144 | EntityItemID EntityScriptingInterface::findClosestEntity(const glm::vec3& center, float radius) const { |
| 145 | EntityItemID result(UNKNOWN_MODEL_ID, UNKNOWN_MODEL_TOKEN, false); | 145 | EntityItemID result(UNKNOWN_ENTITY_ID, UNKNOWN_ENTITY_TOKEN, false); |
| 146 | if (_entityTree) { | 146 | if (_entityTree) { |
| 147 | _entityTree->lockForRead(); | 147 | _entityTree->lockForRead(); |
| 148 | const EntityItem* closestEntity = _entityTree->findClosestEntity(center/(float)TREE_SCALE, | 148 | const EntityItem* closestEntity = _entityTree->findClosestEntity(center/(float)TREE_SCALE, |
| @@ -166,7 +166,7 @@ QVector<EntityItemID> EntityScriptingInterface::findEntities(const glm::vec3& ce · 17 unmodified lines | |||
| 166 | _entityTree->unlock(); | 166 | _entityTree->unlock(); |
| 167 | 167 | ||
| 168 | foreach (const EntityItem* model, models) { | 168 | foreach (const EntityItem* model, models) { |
| 169 | EntityItemID thisEntityItemID(model->getID(), UNKNOWN_MODEL_TOKEN, true); | 169 | EntityItemID thisEntityItemID(model->getID(), UNKNOWN_ENTITY_TOKEN, true); |
| 170 | result << thisEntityItemID; | 170 | result << thisEntityItemID; |
| 171 | } | 171 | } |
| 172 | } | 172 | } |