1 | // Copyright (C) 2017 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 | #ifndef QT3DANIMATION_ANIMATION_CLIPBLENDNODEVISITOR_P_H |
5 | #define QT3DANIMATION_ANIMATION_CLIPBLENDNODEVISITOR_P_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists for the convenience |
12 | // of other Qt classes. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | |
19 | #include <functional> |
20 | #include <Qt3DCore/qnodeid.h> |
21 | #include <private/qglobal_p.h> |
22 | |
23 | QT_BEGIN_NAMESPACE |
24 | |
25 | namespace Qt3DAnimation { |
26 | namespace Animation { |
27 | |
28 | class ClipBlendNodeManager; |
29 | class ClipBlendNode; |
30 | |
31 | using VisitFunction = std::function<void (ClipBlendNode *)>; |
32 | |
33 | class Q_AUTOTEST_EXPORT ClipBlendNodeVisitor |
34 | { |
35 | public: |
36 | enum TraversalOrder { |
37 | PreOrder, |
38 | PostOrder |
39 | }; |
40 | |
41 | enum NodeFilter { |
42 | VisitAllNodes, |
43 | VisitOnlyDependencies |
44 | }; |
45 | |
46 | explicit ClipBlendNodeVisitor(ClipBlendNodeManager *manager, |
47 | TraversalOrder order = PostOrder, |
48 | NodeFilter filter = VisitAllNodes); |
49 | |
50 | void traverse(Qt3DCore::QNodeId rootId, const VisitFunction &visitFunction) const; |
51 | |
52 | private: |
53 | void visitPreOrderAllNodes(ClipBlendNode *node, const VisitFunction &visitFunction) const; |
54 | void visitPostOrderAllNodes(ClipBlendNode *node, const VisitFunction &visitFunction) const; |
55 | |
56 | void visitPreOrderDependencyNodes(ClipBlendNode *node, const VisitFunction &visitFunction) const; |
57 | void visitPostOrderDependencyNodes(ClipBlendNode *node, const VisitFunction &visitFunction) const; |
58 | |
59 | ClipBlendNodeManager *m_manager; |
60 | TraversalOrder m_order; |
61 | NodeFilter m_filter; |
62 | }; |
63 | |
64 | } // Animation |
65 | } // Qt3DAnimation |
66 | |
67 | QT_END_NAMESPACE |
68 | |
69 | #endif // QT3DANIMATION_ANIMATION_CLIPBLENDNODEVISITOR_P_H |
70 | |