| 1 | // Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #include "executor_p.h" |
| 5 | |
| 6 | #include <Qt3DLogic/qframeaction.h> |
| 7 | #include <Qt3DCore/qnode.h> |
| 8 | #include <QtCore/qsemaphore.h> |
| 9 | |
| 10 | #include <Qt3DCore/private/qscene_p.h> |
| 11 | |
| 12 | QT_BEGIN_NAMESPACE |
| 13 | |
| 14 | |
| 15 | namespace Qt3DLogic { |
| 16 | namespace Logic { |
| 17 | |
| 18 | using namespace Qt3DCore; |
| 19 | |
| 20 | Executor::Executor(QObject *parent) |
| 21 | : QObject(parent) |
| 22 | , m_scene(nullptr) |
| 23 | { |
| 24 | } |
| 25 | |
| 26 | /*! |
| 27 | Called from context of main thread |
| 28 | */ |
| 29 | void Executor::processLogicFrameUpdates(const QList<QNodeId> &nodeIds, float dt) |
| 30 | { |
| 31 | if (!m_scene || nodeIds.isEmpty()) |
| 32 | return; |
| 33 | |
| 34 | const QList<QNode *> nodes = m_scene->lookupNodes(ids: nodeIds); |
| 35 | for (QNode *node : nodes) { |
| 36 | QFrameAction *frameAction = qobject_cast<QFrameAction *>(object: node); |
| 37 | if (frameAction && frameAction->isEnabled()) |
| 38 | frameAction->onTriggered(dt); |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | } // namespace Logic |
| 43 | } // namespace Qt3DLogic |
| 44 | |
| 45 | QT_END_NAMESPACE |
| 46 | |
| 47 | #include "moc_executor_p.cpp" |
| 48 |
