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 | using namespace Qt3DCore; |
15 | |
16 | namespace Qt3DLogic { |
17 | namespace Logic { |
18 | |
19 | Executor::Executor(QObject *parent) |
20 | : QObject(parent) |
21 | , m_scene(nullptr) |
22 | { |
23 | } |
24 | |
25 | /*! |
26 | Called from context of main thread |
27 | */ |
28 | void Executor::processLogicFrameUpdates(const QList<QNodeId> &nodeIds, float dt) |
29 | { |
30 | if (!m_scene || nodeIds.isEmpty()) |
31 | return; |
32 | |
33 | const QList<QNode *> nodes = m_scene->lookupNodes(ids: nodeIds); |
34 | for (QNode *node : nodes) { |
35 | QFrameAction *frameAction = qobject_cast<QFrameAction *>(object: node); |
36 | if (frameAction && frameAction->isEnabled()) |
37 | frameAction->onTriggered(dt); |
38 | } |
39 | } |
40 | |
41 | } // namespace Logic |
42 | } // namespace Qt3DLogic |
43 | |
44 | QT_END_NAMESPACE |
45 | |
46 | #include "moc_executor_p.cpp" |
47 |