History

Add Entities.getChildrenIDs() method

David Rowe committed 10 years ago

Commit 44fe7c11 parent 35b80ba2 files · +22 −0Browse files

Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 2 files). Show all

Unified · Split

libraries/entities/src/EntityScriptingInterface.cpp+21−0
@@ -1121,6 +1121,27 @@ QStringList EntityScriptingInterface::getJointNames(const QUuid& entityID) { · 1120 unmodified lines
1121 return result;1121 return result;
1122}1122}
1123 1123
1124QVector<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
1124QVector<QUuid> EntityScriptingInterface::getChildrenIDsOfJoint(const QUuid& parentID, int jointIndex) {1145QVector<QUuid> EntityScriptingInterface::getChildrenIDsOfJoint(const QUuid& parentID, int jointIndex) {
1125 QVector<QUuid> result;1146 QVector<QUuid> result;
1126 if (!_entityTree) {1147 if (!_entityTree) {