Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 1 file). Show all
Unified · Split
| @@ -45,7 +45,17 @@ EntityItemID EntityScriptingInterface::addEntity(const EntityItemProperties& pro · 44 unmodified lines | ||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | EntityItemID EntityScriptingInterface::getEntityItemID(const QString& uuid) { |
| 48 | − return EntityItemID(QUuid(uuid)); | |
| 48 | + EntityItemID entityID = EntityItemID(QUuid(uuid), UNKNOWN_ENTITY_TOKEN, false); | |
| 49 | + | |
| 50 | + _entityTree->lockForRead(); | |
| 51 | + EntityItem* entity = const_cast<EntityItem*>(_entityTree->findEntityByEntityItemID(entityID)); | |
| 52 | + _entityTree->unlock(); | |
| 53 | + | |
| 54 | + if (entity) { | |
| 55 | + return entity->getEntityItemID(); | |
| 56 | + } | |
| 57 | + | |
| 58 | + return entityID; | |
| 49 | 59 | } |
| 50 | 60 | |
| 51 | 61 | EntityItemID EntityScriptingInterface::identifyEntity(EntityItemID entityID) { |