Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -734,7 +734,7 @@ QVector<QUuid> EntityScriptingInterface::findEntitiesByType(const QString entity · 733 unmodified lines | ||
| 734 | 734 | return result; |
| 735 | 735 | } |
| 736 | 736 | |
| 737 | −QVector<QUuid> EntityScriptingInterface::findEntitiesByName(const QString entityName, const glm::vec3& center, float radius) const { | |
| 737 | +QVector<QUuid> EntityScriptingInterface::findEntitiesByName(const QString entityName, const glm::vec3& center, float radius, bool caseSensitiveSearch) const { | |
| 738 | 738 | |
| 739 | 739 | QVector<QUuid> result; |
| 740 | 740 | if (_entityTree) { |
| @@ -743,9 +743,21 @@ QVector<QUuid> EntityScriptingInterface::findEntitiesByName(const QString entity · 2 unmodified lines | ||
| 743 | 743 | _entityTree->findEntities(center, radius, entities); |
| 744 | 744 | }); |
| 745 | 745 | |
| 746 | − foreach(EntityItemPointer entity, entities) { | |
| 747 | − if (entity->getName() == entityName) { | |
| 748 | − result << entity->getEntityItemID(); | |
| 746 | + if (caseSensitiveSearch) { | |
| 747 | + foreach(EntityItemPointer entity, entities) { | |
| 748 | + if (entity->getName() == entityName) { | |
| 749 | + result << entity->getEntityItemID(); | |
| 750 | + } | |
| 751 | + } | |
| 752 | + | |
| 753 | + } else { | |
| 754 | + QString entityNameLowerCase = entityName.toLower(); | |
| 755 | + | |
| 756 | + foreach(EntityItemPointer entity, entities) { | |
| 757 | + QString entityItemLowerCase = entity->getName().toLower(); | |
| 758 | + if (entityItemLowerCase == entityNameLowerCase) { | |
| 759 | + result << entity->getEntityItemID(); | |
| 760 | + } | |
| 749 | 761 | } |
| 750 | 762 | } |
| 751 | 763 | } |