Geometry Nodes: use lazy-function directly for switch node #105696

Merged
Jacques Lucke merged 9 commits from JacquesLucke/blender:switch-node-separate-api into main 2023-03-14 14:09:39 +01:00
3 changed files with 8 additions and 5 deletions
Showing only changes of commit b7ebfdc451 - Show all commits

View File

@ -221,9 +221,7 @@ class GeometryNodesLazyFunctionLogger : public fn::lazy_function::GraphExecutor:
const lf::Context &context) const override;
};
namespace node_geo_switch_cc {
std::unique_ptr<LazyFunction> get_switch_node_lazy_function(const bNode &node);
Review

I'm not sure how I feel about these unity build namespaces leaking to separate files. Maybe the public function from that file should be in the blender::nodes namespace like other cases. Or blender::nodes::geometry? (though that could be done elsewhere too)

I'm not sure how I feel about these unity build namespaces leaking to separate files. Maybe the public function from that file should be in the `blender::nodes` namespace like other cases. Or `blender::nodes::geometry`? (though that could be done elsewhere too)
}
/**
* Tells the lazy-function graph evaluator which nodes have side effects based on the current

View File

@ -253,12 +253,18 @@ class LazyFunctionForSwitchNode : public LazyFunction {
}
};
} // namespace blender::nodes::node_geo_switch_cc
namespace blender::nodes {
std::unique_ptr<LazyFunction> get_switch_node_lazy_function(const bNode &node)
{
using namespace node_geo_switch_cc;
BLI_assert(node.type == GEO_NODE_SWITCH);
return std::make_unique<LazyFunctionForSwitchNode>(node);
}
} // namespace blender::nodes::node_geo_switch_cc
} // namespace blender::nodes
void register_node_type_geo_switch()
{

View File

@ -1575,8 +1575,7 @@ struct GeometryNodesLazyFunctionGraphBuilder {
void handle_switch_node(const bNode &bnode)
{
std::unique_ptr<LazyFunction> lazy_function =
node_geo_switch_cc::get_switch_node_lazy_function(bnode);
std::unique_ptr<LazyFunction> lazy_function = get_switch_node_lazy_function(bnode);
lf::FunctionNode &lf_node = lf_graph_->add_function(*lazy_function);
lf_graph_info_->functions.append(std::move(lazy_function));