-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnodegroup.h
89 lines (64 loc) · 1.67 KB
/
nodegroup.h
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#pragma once
#include "node.h"
namespace En
{
class NodeGroup : public QObject
{
Q_OBJECT
// maybe change this to a QSet? can it be ordered?
QVector<Node*> m_nodes;
// Probably move this to some kind of 'project' object
QPointer<Node> m_outputNode;
Host* m_host;
public:
NodeGroup();
virtual ~NodeGroup();
void setHost(Host* host) {
m_host = host;
}
Host* host() const {
return m_host;
}
Node* outputNode() const
{
return m_outputNode;
}
void setOutputNode(Node* node)
{
if (!m_nodes.contains(node)) {
return;
}
m_outputNode = node;
emit outputNodeChanged(node);
}
void addNode(Node* node);
void removeNode(Node* node);
void deleteNode(Node* node);
int numChildNodes() const
{
return m_nodes.size();
}
Node* childNode(unsigned index) const
{
return m_nodes[index];
}
const QVector<Node*>& childNodes() const
{
return m_nodes;
}
/// Very slow way to get the node dependencies. TODO: cache this somehow? Or maintain node connections separately...
QList<Node*> dependentNodes(Node* node) const;
// is this necessary!?
void emitNodeInputsChanged(Node* node)
{
emit nodeInputsChanged(node);
}
signals:
void nodeAdded(Node* node);
void nodePreRemoved(Node* node);
void nodeRemoved(Node* node);
void nodePreDeleted(Node* node); // should probably move this to something more core? don't want to have to monitor every group for this
void nodeInputsChanged(Node* node);
void outputNodeChanged(Node* node);
};
} // namespace En