2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2020-04-20 10:58:43 +02:00
|
|
|
|
2021-08-20 13:14:39 +02:00
|
|
|
#include "NOD_multi_function.hh"
|
2020-12-02 13:25:25 +01:00
|
|
|
|
2022-09-13 08:44:26 +02:00
|
|
|
#include "BKE_node_runtime.hh"
|
2022-08-31 12:15:57 +02:00
|
|
|
|
2020-12-02 13:25:25 +01:00
|
|
|
namespace blender::nodes {
|
2020-04-20 10:58:43 +02:00
|
|
|
|
2022-09-13 08:44:26 +02:00
|
|
|
NodeMultiFunctions::NodeMultiFunctions(const bNodeTree &tree)
|
2021-08-20 13:14:39 +02:00
|
|
|
{
|
2022-09-13 08:44:26 +02:00
|
|
|
tree.ensure_topology_cache();
|
|
|
|
|
for (const bNode *bnode : tree.all_nodes()) {
|
|
|
|
|
if (bnode->typeinfo->build_multi_function == nullptr) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
NodeMultiFunctionBuilder builder{*bnode, tree};
|
|
|
|
|
bnode->typeinfo->build_multi_function(builder);
|
|
|
|
|
if (builder.built_fn_ != nullptr) {
|
|
|
|
|
map_.add_new(bnode, {builder.built_fn_, std::move(builder.owned_built_fn_)});
|
2021-08-20 13:14:39 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-04-20 10:58:43 +02:00
|
|
|
|
2020-12-02 13:25:25 +01:00
|
|
|
} // namespace blender::nodes
|