1 | // Copyright (C) 2014 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 "layer_p.h" |
5 | #include <Qt3DRender/qlayer.h> |
6 | #include <Qt3DRender/private/qlayer_p.h> |
7 | #include <Qt3DRender/private/stringtoint_p.h> |
8 | #include <QVariant> |
9 | |
10 | QT_BEGIN_NAMESPACE |
11 | |
12 | using namespace Qt3DCore; |
13 | |
14 | namespace Qt3DRender { |
15 | namespace Render { |
16 | |
17 | Layer::Layer() |
18 | : BackendNode() |
19 | , m_recursive(false) |
20 | { |
21 | } |
22 | |
23 | Layer::~Layer() |
24 | { |
25 | cleanup(); |
26 | } |
27 | |
28 | void Layer::cleanup() |
29 | { |
30 | QBackendNode::setEnabled(false); |
31 | } |
32 | |
33 | void Layer::syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime) |
34 | { |
35 | const QLayer *node = qobject_cast<const QLayer *>(object: frontEnd); |
36 | if (!node) |
37 | return; |
38 | |
39 | const bool oldEnabled = isEnabled(); |
40 | BackendNode::syncFromFrontEnd(frontEnd, firstTime); |
41 | |
42 | if (isEnabled() != oldEnabled || firstTime) |
43 | markDirty(changes: AbstractRenderer::LayersDirty); |
44 | |
45 | if (node->recursive() != m_recursive) { |
46 | m_recursive = node->recursive(); |
47 | markDirty(changes: AbstractRenderer::LayersDirty); |
48 | } |
49 | } |
50 | |
51 | bool Layer::recursive() const |
52 | { |
53 | return m_recursive; |
54 | } |
55 | |
56 | void Layer::setRecursive(bool recursive) |
57 | { |
58 | m_recursive = recursive; |
59 | } |
60 | |
61 | } // namespace Render |
62 | } // namespace Qt3DRender |
63 | |
64 | QT_END_NAMESPACE |
65 |