Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 4 files). Show all
Unified · Split
| @@ -1660,14 +1660,28 @@ QVector<QUuid> EntityScriptingInterface::getChildrenIDs(const QUuid& parentID) { · 1659 unmodified lines | |||
| 1660 | return result; | 1660 | return result; |
| 1661 | } | 1661 | } |
| 1662 | 1662 | ||
| 1663 | EntityItemPointer entity = _entityTree->findEntityByEntityItemID(parentID); | 1663 | //EntityItemPointer entity = _entityTree->findEntityByEntityItemID(parentID); |
| 1664 | if (!entity) { | 1664 | //if (!entity) { |
| 1665 | qCDebug(entities) << "EntityScriptingInterface::getChildrenIDs - no entity with ID" << parentID; | 1665 | // qCDebug(entities) << "EntityScriptingInterface::getChildrenIDs - no entity with ID" << parentID; |
| 1666 | return result; | 1666 | // return result; |
| 1667 | } | 1667 | //} |
| 1668 | |||
| 1669 | _entityTree->withReadLock([&] { | 1668 | _entityTree->withReadLock([&] { |
| 1670 | entity->forEachChild([&](SpatiallyNestablePointer child) { | 1669 | QSharedPointer<SpatialParentFinder> parentFinder = DependencyManager::get<SpatialParentFinder>(); |
| 1670 | if (!parentFinder) { | ||
| 1671 | return; | ||
| 1672 | } | ||
| 1673 | bool success; | ||
| 1674 | SpatiallyNestableWeakPointer parentWP = parentFinder->find(parentID, success); | ||
| 1675 | if (!success) { | ||
| 1676 | return; | ||
| 1677 | } | ||
| 1678 | SpatiallyNestablePointer parent = parentWP.lock(); | ||
| 1679 | if (!parent) { | ||
| 1680 | return; | ||
| 1681 | } | ||
| 1682 | //_entityTree->withReadLock([&] { | ||
| 1683 | //entity->forEachChild([&](SpatiallyNestablePointer child) { | ||
| 1684 | parent->forEachChild([&](SpatiallyNestablePointer child) { | ||
| 1671 | result.push_back(child->getID()); | 1685 | result.push_back(child->getID()); |
| 1672 | }); | 1686 | }); |
| 1673 | }); | 1687 | }); |