Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -1121,6 +1121,27 @@ QStringList EntityScriptingInterface::getJointNames(const QUuid& entityID) { · 1120 unmodified lines | ||
| 1121 | 1121 | return result; |
| 1122 | 1122 | } |
| 1123 | 1123 | |
| 1124 | +QVector<QUuid> EntityScriptingInterface::getChildrenIDs(const QUuid& parentID) { | |
| 1125 | + QVector<QUuid> result; | |
| 1126 | + if (!_entityTree) { | |
| 1127 | + return result; | |
| 1128 | + } | |
| 1129 | + | |
| 1130 | + EntityItemPointer entity = _entityTree->findEntityByEntityItemID(parentID); | |
| 1131 | + if (!entity) { | |
| 1132 | + qDebug() << "EntityScriptingInterface::getChildrenIDs - no entity with ID" << parentID; | |
| 1133 | + return result; | |
| 1134 | + } | |
| 1135 | + | |
| 1136 | + _entityTree->withReadLock([&] { | |
| 1137 | + entity->forEachChild([&](SpatiallyNestablePointer child) { | |
| 1138 | + result.push_back(child->getID()); | |
| 1139 | + }); | |
| 1140 | + }); | |
| 1141 | + | |
| 1142 | + return result; | |
| 1143 | +} | |
| 1144 | + | |
| 1124 | 1145 | QVector<QUuid> EntityScriptingInterface::getChildrenIDsOfJoint(const QUuid& parentID, int jointIndex) { |
| 1125 | 1146 | QVector<QUuid> result; |
| 1126 | 1147 | if (!_entityTree) { |