mirror of https://github.com/qt/qt3d.git
Add accessor to retrieve frontend node from an id
Useful later to sync backend changes back to the frontend. Change-Id: I874d140fc97462b8e186b66c882647db26d5678e Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
This commit is contained in:
parent
89392ac9ae
commit
2dabe5fc1e
|
|
@ -62,6 +62,7 @@
|
|||
#include <Qt3DCore/private/qtickclockservice_p.h>
|
||||
#include <Qt3DCore/private/qnodevisitor_p.h>
|
||||
#include <Qt3DCore/private/qnode_p.h>
|
||||
#include <Qt3DCore/private/qscene_p.h>
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
|
||||
|
|
@ -379,6 +380,24 @@ void QAspectManager::setPostConstructorInit(NodePostConstructorInit *postConstru
|
|||
m_postConstructorInit = postConstructorInit;
|
||||
}
|
||||
|
||||
QNode *QAspectManager::lookupNode(QNodeId id) const
|
||||
{
|
||||
if (!m_root)
|
||||
return nullptr;
|
||||
|
||||
QNodePrivate *d = QNodePrivate::get(m_root);
|
||||
return d->m_scene ? d->m_scene->lookupNode(id) : nullptr;
|
||||
}
|
||||
|
||||
QVector<QNode *> QAspectManager::lookupNodes(const QVector<QNodeId> &ids) const
|
||||
{
|
||||
if (!m_root)
|
||||
return {};
|
||||
|
||||
QNodePrivate *d = QNodePrivate::get(m_root);
|
||||
return d->m_scene ? d->m_scene->lookupNodes(ids) : QVector<QNode *>{};
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
\brief Drives the Qt3D simulation loop in the main thread
|
||||
|
|
|
|||
|
|
@ -108,6 +108,9 @@ public:
|
|||
QServiceLocator *serviceLocator() const;
|
||||
void setPostConstructorInit(NodePostConstructorInit *postConstructorInit);
|
||||
|
||||
QNode *lookupNode(QNodeId id) const;
|
||||
QVector<QNode *> lookupNodes(const QVector<QNodeId> &ids) const;
|
||||
|
||||
private:
|
||||
bool event(QEvent *event) override;
|
||||
void requestNextFrame();
|
||||
|
|
|
|||
Loading…
Reference in New Issue