mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 15:17:42 +02:00
Add Entities.getChildrenIDs() method
This commit is contained in:
parent
35b80ba066
commit
44fe7c1144
2 changed files with 22 additions and 0 deletions
|
@ -1121,6 +1121,27 @@ QStringList EntityScriptingInterface::getJointNames(const QUuid& entityID) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVector<QUuid> EntityScriptingInterface::getChildrenIDs(const QUuid& parentID) {
|
||||||
|
QVector<QUuid> result;
|
||||||
|
if (!_entityTree) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
EntityItemPointer entity = _entityTree->findEntityByEntityItemID(parentID);
|
||||||
|
if (!entity) {
|
||||||
|
qDebug() << "EntityScriptingInterface::getChildrenIDs - no entity with ID" << parentID;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
_entityTree->withReadLock([&] {
|
||||||
|
entity->forEachChild([&](SpatiallyNestablePointer child) {
|
||||||
|
result.push_back(child->getID());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
QVector<QUuid> EntityScriptingInterface::getChildrenIDsOfJoint(const QUuid& parentID, int jointIndex) {
|
QVector<QUuid> EntityScriptingInterface::getChildrenIDsOfJoint(const QUuid& parentID, int jointIndex) {
|
||||||
QVector<QUuid> result;
|
QVector<QUuid> result;
|
||||||
if (!_entityTree) {
|
if (!_entityTree) {
|
||||||
|
|
|
@ -171,6 +171,7 @@ public slots:
|
||||||
|
|
||||||
Q_INVOKABLE int getJointIndex(const QUuid& entityID, const QString& name);
|
Q_INVOKABLE int getJointIndex(const QUuid& entityID, const QString& name);
|
||||||
Q_INVOKABLE QStringList getJointNames(const QUuid& entityID);
|
Q_INVOKABLE QStringList getJointNames(const QUuid& entityID);
|
||||||
|
Q_INVOKABLE QVector<QUuid> getChildrenIDs(const QUuid& parentID);
|
||||||
Q_INVOKABLE QVector<QUuid> getChildrenIDsOfJoint(const QUuid& parentID, int jointIndex);
|
Q_INVOKABLE QVector<QUuid> getChildrenIDsOfJoint(const QUuid& parentID, int jointIndex);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
Loading…
Reference in a new issue