Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 66 files). Show all
Unified · Split
| @@ -1688,15 +1688,21 @@ QVector<QUuid> EntityScriptingInterface::getChildrenIDs(const QUuid& parentID) { · 1687 unmodified lines | ||
| 1688 | 1688 | if (!_entityTree) { |
| 1689 | 1689 | return result; |
| 1690 | 1690 | } |
| 1691 | − | |
| 1692 | − EntityItemPointer entity = _entityTree->findEntityByEntityItemID(parentID); | |
| 1693 | − if (!entity) { | |
| 1694 | − qCDebug(entities) << "EntityScriptingInterface::getChildrenIDs - no entity with ID" << parentID; | |
| 1695 | − return result; | |
| 1696 | − } | |
| 1697 | − | |
| 1698 | 1691 | _entityTree->withReadLock([&] { |
| 1699 | − entity->forEachChild([&](SpatiallyNestablePointer child) { | |
| 1692 | + QSharedPointer<SpatialParentFinder> parentFinder = DependencyManager::get<SpatialParentFinder>(); | |
| 1693 | + if (!parentFinder) { | |
| 1694 | + return; | |
| 1695 | + } | |
| 1696 | + bool success; | |
| 1697 | + SpatiallyNestableWeakPointer parentWP = parentFinder->find(parentID, success); | |
| 1698 | + if (!success) { | |
| 1699 | + return; | |
| 1700 | + } | |
| 1701 | + SpatiallyNestablePointer parent = parentWP.lock(); | |
| 1702 | + if (!parent) { | |
| 1703 | + return; | |
| 1704 | + } | |
| 1705 | + parent->forEachChild([&](SpatiallyNestablePointer child) { | |
| 1700 | 1706 | result.push_back(child->getID()); |
| 1701 | 1707 | }); |
| 1702 | 1708 | }); |