mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 00:13:53 +02:00
isChildOfParent
This commit is contained in:
parent
cb0e01bfa4
commit
c52f893273
2 changed files with 22 additions and 0 deletions
|
@ -1318,6 +1318,27 @@ QVector<QUuid> EntityScriptingInterface::getChildrenIDs(const QUuid& parentID) {
|
|||
return result;
|
||||
}
|
||||
|
||||
bool EntityScriptingInterface::isChildOfParent(QUuid childID, QUuid parentID) {
|
||||
bool isChild = false;
|
||||
|
||||
if(!_entityTree) {
|
||||
return isChild;
|
||||
}
|
||||
|
||||
_entityTree->withReadLock([&] {
|
||||
EntityItemPointer parent = _entityTree->findEntityByEntityItemID(parentID);
|
||||
parent->forEachDescendant([&](SpatiallyNestablePointer descendant) {
|
||||
if(descendant->getID() == childID) {
|
||||
isChild = true;
|
||||
return;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
qDebug() << "Is Child of parent? : " << isChild;
|
||||
return isChild;
|
||||
}
|
||||
|
||||
QVector<QUuid> EntityScriptingInterface::getChildrenIDsOfJoint(const QUuid& parentID, int jointIndex) {
|
||||
QVector<QUuid> result;
|
||||
if (!_entityTree) {
|
||||
|
|
|
@ -255,6 +255,7 @@ public slots:
|
|||
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 bool isChildOfParent(QUuid childID, QUuid parnetID);
|
||||
|
||||
Q_INVOKABLE QUuid getKeyboardFocusEntity() const;
|
||||
Q_INVOKABLE void setKeyboardFocusEntity(QUuid id);
|
||||
|
|
Loading…
Reference in a new issue