Nodes: cleanup node declaration finalization
* Extract function for building anonymous attribute references. * Use is-function-node state directly during building instead of during finalization. Pull Request: https://projects.blender.org/blender/blender/pulls/119677
This commit is contained in:
parent
787818d21d
commit
82f434f444
|
@ -569,6 +569,8 @@ class NodeDeclarationBuilder {
|
|||
/* Mark the most recent builder as 'complete' when changing builders
|
||||
* so no more items can be added. */
|
||||
void set_active_panel_builder(const PanelDeclarationBuilder *panel_builder);
|
||||
|
||||
void build_remaining_anonymous_attribute_relations();
|
||||
};
|
||||
|
||||
namespace implicit_field_inputs {
|
||||
|
@ -696,6 +698,15 @@ inline typename DeclType::Builder &NodeDeclarationBuilder::add_socket(StringRef
|
|||
output_socket_builders_.append(&*socket_decl_builder);
|
||||
}
|
||||
|
||||
if (is_function_node_) {
|
||||
if (in_out == SOCK_IN) {
|
||||
socket_decl_builder->supports_field();
|
||||
}
|
||||
else {
|
||||
socket_decl_builder->dependent_field();
|
||||
}
|
||||
}
|
||||
|
||||
Builder &socket_decl_builder_ref = *socket_decl_builder;
|
||||
socket_builders_.append(std::move(socket_decl_builder));
|
||||
|
||||
|
|
|
@ -33,21 +33,8 @@ void build_node_declaration(const bNodeType &typeinfo,
|
|||
node_decl_builder.finalize();
|
||||
}
|
||||
|
||||
void NodeDeclarationBuilder::finalize()
|
||||
void NodeDeclarationBuilder::build_remaining_anonymous_attribute_relations()
|
||||
{
|
||||
if (is_function_node_) {
|
||||
for (BaseSocketDeclarationBuilder *socket_builder : input_socket_builders_) {
|
||||
if (socket_builder->decl_base_->input_field_type != InputSocketFieldType::Implicit) {
|
||||
socket_builder->decl_base_->input_field_type = InputSocketFieldType::IsSupported;
|
||||
}
|
||||
}
|
||||
for (BaseSocketDeclarationBuilder *socket_builder : output_socket_builders_) {
|
||||
socket_builder->decl_base_->output_field_dependency =
|
||||
OutputFieldDependency::ForDependentField();
|
||||
socket_builder->reference_pass_all_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
Vector<int> geometry_inputs;
|
||||
for (const int i : declaration_.inputs.index_range()) {
|
||||
if (dynamic_cast<decl::Geometry *>(declaration_.inputs[i])) {
|
||||
|
@ -96,7 +83,11 @@ void NodeDeclarationBuilder::finalize()
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NodeDeclarationBuilder::finalize()
|
||||
{
|
||||
this->build_remaining_anonymous_attribute_relations();
|
||||
BLI_assert(declaration_.is_valid());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue