Functions: store derived node tree and network in map for future access

This commit is contained in:
Jacques Lucke 2020-07-10 14:20:39 +02:00
parent 295b3aefb0
commit 60133ff98d
2 changed files with 17 additions and 3 deletions

View File

@ -56,16 +56,30 @@ class MFNetworkTreeMap {
* Input sockets in a node tree can have multiple corresponding sockets in the generated
* MFNetwork. This is because nodes are allowed to expand into multiple multi-function nodes.
*/
const DerivedNodeTree &m_tree;
fn::MFNetwork &m_network;
Array<Vector<fn::MFSocket *, 1>> m_sockets_by_dsocket_id;
Array<fn::MFOutputSocket *> m_socket_by_group_input_id;
public:
MFNetworkTreeMap(const DerivedNodeTree &tree)
: m_sockets_by_dsocket_id(tree.sockets().size()),
MFNetworkTreeMap(const DerivedNodeTree &tree, fn::MFNetwork &network)
: m_tree(tree),
m_network(network),
m_sockets_by_dsocket_id(tree.sockets().size()),
m_socket_by_group_input_id(tree.group_inputs().size(), nullptr)
{
}
const DerivedNodeTree &tree() const
{
return m_tree;
}
const fn::MFNetwork &network() const
{
return m_network;
}
void add(const DSocket &dsocket, fn::MFSocket &socket)
{
BLI_assert(dsocket.is_input() == socket.is_input());

View File

@ -217,7 +217,7 @@ MFNetworkTreeMap insert_node_tree_into_mf_network(fn::MFNetwork &network,
const DerivedNodeTree &tree,
ResourceCollector &resources)
{
MFNetworkTreeMap network_map{tree};
MFNetworkTreeMap network_map{tree, network};
CommonMFNetworkBuilderData common{resources, network, network_map, tree};