aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmldesigner/components/effectmaker/compositionnode.h
blob: 840abde96ea551017f8062741f9803b93be2857d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#pragma once

#include "effectmakeruniformsmodel.h"

#include <QObject>

namespace QmlDesigner {

class CompositionNode : public QObject
{
    Q_OBJECT

    Q_PROPERTY(QString nodeName MEMBER m_name CONSTANT)
    Q_PROPERTY(bool nodeEnabled  READ isEnabled WRITE setIsEnabled NOTIFY isEnabledChanged)
    Q_PROPERTY(QObject *nodeUniformsModel READ uniformsModel NOTIFY uniformsModelChanged)

public:
    enum NodeType {
        SourceNode = 0,
        DestinationNode,
        CustomNode
    };

    CompositionNode(const QString &qenPath);

    QString fragmentCode() const;
    QString vertexCode() const;
    QString description() const;

    QObject *uniformsModel();

    QStringList requiredNodes() const;

    NodeType type() const;

    bool isEnabled() const;
    void setIsEnabled(bool newIsEnabled);

signals:
    void uniformsModelChanged();
    void isEnabledChanged();

private:
    void parse(const QString &qenPath);

    QString m_name;
    NodeType m_type = CustomNode;
    QString m_fragmentCode;
    QString m_vertexCode;
    QString m_description;
    QStringList m_requiredNodes;
    bool m_isEnabled = true;

    EffectMakerUniformsModel m_unifomrsModel;
};

} // namespace QmlDesigner