[Bf-blender-cvs] [660e240acf6] temp-nodes-group-declarations: Basic startup works
Hans Goudey
noreply at git.blender.org
Fri Dec 16 00:43:13 CET 2022
Commit: 660e240acf6af8756b086effc3913bc2b65e3e79
Author: Hans Goudey
Date: Thu Dec 15 17:43:08 2022 -0600
Branches: temp-nodes-group-declarations
https://developer.blender.org/rB660e240acf6af8756b086effc3913bc2b65e3e79
Basic startup works
===================================================================
M source/blender/blenkernel/BKE_node_runtime.hh
M source/blender/blenkernel/intern/node_tree_field_inferencing.cc
M source/blender/blenkernel/intern/node_tree_update.cc
M source/blender/nodes/NOD_node_declaration.hh
M source/blender/nodes/geometry/nodes/node_geo_common.cc
===================================================================
diff --git a/source/blender/blenkernel/BKE_node_runtime.hh b/source/blender/blenkernel/BKE_node_runtime.hh
index 7f0e7f66936..a5ec387158a 100644
--- a/source/blender/blenkernel/BKE_node_runtime.hh
+++ b/source/blender/blenkernel/BKE_node_runtime.hh
@@ -324,6 +324,9 @@ inline bool topology_cache_is_available(const bNodeSocket &socket)
namespace node_field_inferencing {
bool update_field_inferencing(const bNodeTree &tree);
+void calculate_field_interface(const bNodeTree &tree,
+ nodes::FieldInferencingInterface &r_interface);
+
} // namespace node_field_inferencing
} // namespace blender::bke
diff --git a/source/blender/blenkernel/intern/node_tree_field_inferencing.cc b/source/blender/blenkernel/intern/node_tree_field_inferencing.cc
index b828586ba0a..2ca30286cd5 100644
--- a/source/blender/blenkernel/intern/node_tree_field_inferencing.cc
+++ b/source/blender/blenkernel/intern/node_tree_field_inferencing.cc
@@ -486,33 +486,30 @@ static void update_socket_shapes(const bNodeTree &tree,
}
}
-FieldInferencingInterface calculate_field_inferencing(const bNodeTree &tree)
+void calculate_field_interface(const bNodeTree &tree, FieldInferencingInterface &r_interface)
{
- FieldInferencingInterface interface;
-
tree.ensure_topology_cache();
- interface.inputs.resize(BLI_listbase_count(&tree.inputs), InputSocketFieldType::IsSupported);
- interface.outputs.resize(BLI_listbase_count(&tree.outputs),
- OutputFieldDependency::ForDataSource());
+ r_interface.inputs.resize(BLI_listbase_count(&tree.inputs), InputSocketFieldType::IsSupported);
+ r_interface.outputs.resize(BLI_listbase_count(&tree.outputs),
+ OutputFieldDependency::ForDataSource());
/* Keep track of the state of all sockets. The index into this array is #SocketRef::id(). */
Array<SocketFieldState> field_state_by_socket_id(tree.all_sockets().size());
propagate_data_requirements_from_right_to_left(tree, field_state_by_socket_id);
- determine_group_input_states(tree, interface, field_state_by_socket_id);
+ determine_group_input_states(tree, r_interface, field_state_by_socket_id);
propagate_field_status_from_left_to_right(tree, field_state_by_socket_id);
- determine_group_output_states(tree, interface, field_state_by_socket_id);
+ determine_group_output_states(tree, r_interface, field_state_by_socket_id);
update_socket_shapes(tree, field_state_by_socket_id);
-
- return interface;
}
bool update_field_inferencing(const bNodeTree &tree)
{
/* Create new inferencing interface for this node group. */
std::unique_ptr<FieldInferencingInterface> new_inferencing_interface =
- std::make_unique<FieldInferencingInterface>(calculate_field_inferencing(tree));
+ std::make_unique<FieldInferencingInterface>();
+ calculate_field_interface(tree, *new_inferencing_interface);
/* Update the previous group interface. */
const bool group_interface_changed = !tree.runtime->field_inferencing_interface ||
diff --git a/source/blender/blenkernel/intern/node_tree_update.cc b/source/blender/blenkernel/intern/node_tree_update.cc
index c818259c086..b1cae45ba45 100644
--- a/source/blender/blenkernel/intern/node_tree_update.cc
+++ b/source/blender/blenkernel/intern/node_tree_update.cc
@@ -546,12 +546,12 @@ class NodeTreeMainUpdater {
if (ntype.updatefunc) {
ntype.updatefunc(&ntree, node);
}
- if (ntype.declare_dynamic) {
- if (!node->runtime->declaration) {
- node->runtime->declaration = new blender::nodes::NodeDeclaration();
- }
- build_node_declaration_dynamic(ntree, *node, *node->runtime->declaration);
- }
+ // if (ntype.declare_dynamic) {
+ // if (!node->runtime->declaration) {
+ // node->runtime->declaration = new blender::nodes::NodeDeclaration();
+ // }
+ // build_node_declaration_dynamic(ntree, *node, *node->runtime->declaration);
+ // }
}
if (ELEM(node->type, NODE_GROUP_INPUT, NODE_GROUP_OUTPUT)) {
group_inout_nodes.append(node);
@@ -563,7 +563,12 @@ class NodeTreeMainUpdater {
* supposed to create the new interface socket. */
if (ntree.runtime->changed_flag & NTREE_CHANGED_INTERFACE) {
for (bNode *node : group_inout_nodes) {
- node->typeinfo->updatefunc(&ntree, node);
+ if (node->typeinfo->declare_dynamic) {
+ if (!node->runtime->declaration) {
+ node->runtime->declaration = new blender::nodes::NodeDeclaration();
+ }
+ build_node_declaration_dynamic(ntree, *node, *node->runtime->declaration);
+ }
}
}
}
diff --git a/source/blender/nodes/NOD_node_declaration.hh b/source/blender/nodes/NOD_node_declaration.hh
index 9c0f9c5bab2..f67806a4cd4 100644
--- a/source/blender/nodes/NOD_node_declaration.hh
+++ b/source/blender/nodes/NOD_node_declaration.hh
@@ -64,7 +64,6 @@ struct FieldInferencingInterface {
Vector<InputSocketFieldType> inputs;
Vector<OutputFieldDependency> outputs;
};
-FieldInferencingInterface calculate_field_inferencing(const bNodeTree &tree);
using ImplicitInputValueFn = std::function<void(const bNode &node, void *r_value)>;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_common.cc b/source/blender/nodes/geometry/nodes/node_geo_common.cc
index 2c819172efe..46d6d18fa74 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_common.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_common.cc
@@ -20,8 +20,8 @@ static bool node_declare(const bNodeTree &node_tree,
}
const bNodeTree &group = reinterpret_cast<const bNodeTree &>(*node.id);
- const FieldInferencingInterface field_interface = field_inferencing::calculate_field_inferencing(
- group);
+ FieldInferencingInterface field_interface;
+ bke::node_field_inferencing::calculate_field_interface(group, field_interface);
for (const int i : r_declaration.inputs_.index_range()) {
r_declaration.inputs_[i]->input_field_type_ = field_interface.inputs[i];
}
More information about the Bf-blender-cvs
mailing list