[Bf-blender-cvs] [e76e8fe87aa] temp-nodes-group-declarations: Various cleanups, making the diff smaller
Hans Goudey
noreply at git.blender.org
Tue Dec 27 22:41:09 CET 2022
Commit: e76e8fe87aa401e9d122bfb5651aaab279160897
Author: Hans Goudey
Date: Tue Dec 27 16:40:58 2022 -0500
Branches: temp-nodes-group-declarations
https://developer.blender.org/rBe76e8fe87aa401e9d122bfb5651aaab279160897
Various cleanups, making the diff smaller
===================================================================
M source/blender/blenkernel/BKE_node_runtime.hh
M source/blender/blenkernel/intern/node_tree_field_inferencing.cc
M source/blender/nodes/NOD_node_declaration.hh
M source/blender/nodes/NOD_socket.h
M source/blender/nodes/NOD_socket_declarations.hh
M source/blender/nodes/geometry/nodes/node_geo_common.cc
M source/blender/nodes/intern/node_common.cc
M source/blender/nodes/intern/node_socket.cc
===================================================================
diff --git a/source/blender/blenkernel/BKE_node_runtime.hh b/source/blender/blenkernel/BKE_node_runtime.hh
index 43e8bcd94af..2c9f05c08a6 100644
--- a/source/blender/blenkernel/BKE_node_runtime.hh
+++ b/source/blender/blenkernel/BKE_node_runtime.hh
@@ -326,10 +326,7 @@ 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 879dafd9d7d..5c527e29131 100644
--- a/source/blender/blenkernel/intern/node_tree_field_inferencing.cc
+++ b/source/blender/blenkernel/intern/node_tree_field_inferencing.cc
@@ -506,7 +506,7 @@ static void prepare_inferencing_interfaces(
}
}
-void calculate_field_interface(const bNodeTree &tree, FieldInferencingInterface &r_interface)
+bool update_field_inferencing(const bNodeTree &tree)
{
tree.ensure_topology_cache();
@@ -516,27 +516,23 @@ void calculate_field_interface(const bNodeTree &tree, FieldInferencingInterface
prepare_inferencing_interfaces(nodes, interface_by_node, scope);
/* Create new inferencing interface for this node group. */
- r_interface.inputs.resize(BLI_listbase_count(&tree.inputs), InputSocketFieldType::IsSupported);
- r_interface.outputs.resize(BLI_listbase_count(&tree.outputs),
- OutputFieldDependency::ForDataSource());
+ std::unique_ptr<FieldInferencingInterface> new_inferencing_interface =
+ std::make_unique<FieldInferencingInterface>();
+ new_inferencing_interface->inputs.resize(BLI_listbase_count(&tree.inputs),
+ InputSocketFieldType::IsSupported);
+ new_inferencing_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, interface_by_node, field_state_by_socket_id);
- determine_group_input_states(tree, r_interface, field_state_by_socket_id);
+ determine_group_input_states(tree, *new_inferencing_interface, field_state_by_socket_id);
propagate_field_status_from_left_to_right(tree, interface_by_node, field_state_by_socket_id);
- determine_group_output_states(tree, r_interface, interface_by_node, field_state_by_socket_id);
+ determine_group_output_states(
+ tree, *new_inferencing_interface, interface_by_node, field_state_by_socket_id);
update_socket_shapes(tree, field_state_by_socket_id);
-}
-
-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_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/nodes/NOD_node_declaration.hh b/source/blender/nodes/NOD_node_declaration.hh
index 27c5001da6a..d549263f036 100644
--- a/source/blender/nodes/NOD_node_declaration.hh
+++ b/source/blender/nodes/NOD_node_declaration.hh
@@ -319,11 +319,6 @@ class NodeDeclaration {
friend NodeDeclarationBuilder;
public:
- NodeDeclaration() = default;
- NodeDeclaration(Vector<SocketDeclarationPtr> inputs, Vector<SocketDeclarationPtr> outputs)
- : inputs_(std::move(inputs)), outputs_(std::move(outputs))
- {
- }
bool matches(const bNode &node) const;
Span<SocketDeclarationPtr> inputs() const;
diff --git a/source/blender/nodes/NOD_socket.h b/source/blender/nodes/NOD_socket.h
index fba4c90d813..a803014f8cd 100644
--- a/source/blender/nodes/NOD_socket.h
+++ b/source/blender/nodes/NOD_socket.h
@@ -28,6 +28,7 @@ struct bNodeSocket *node_add_socket_from_template(struct bNodeTree *ntree,
eNodeSocketInOut in_out);
void node_verify_sockets(struct bNodeTree *ntree, struct bNode *node, bool do_id_user);
+
void node_socket_init_default_value(struct bNodeSocket *sock);
void node_socket_copy_default_value(struct bNodeSocket *to, const struct bNodeSocket *from);
void register_standard_node_socket_types(void);
@@ -40,7 +41,6 @@ void register_standard_node_socket_types(void);
namespace blender::nodes {
-
void update_node_declaration_and_sockets(bNodeTree &ntree, bNode &node);
} // namespace blender::nodes
diff --git a/source/blender/nodes/NOD_socket_declarations.hh b/source/blender/nodes/NOD_socket_declarations.hh
index 993e30b4fbd..f7828301e4b 100644
--- a/source/blender/nodes/NOD_socket_declarations.hh
+++ b/source/blender/nodes/NOD_socket_declarations.hh
@@ -20,7 +20,6 @@ class Float : public SocketDeclaration {
float soft_max_value = FLT_MAX;
PropertySubType subtype = PROP_NONE;
- private:
friend FloatBuilder;
using Builder = FloatBuilder;
@@ -48,7 +47,6 @@ class Int : public SocketDeclaration {
int soft_max_value = INT32_MAX;
PropertySubType subtype = PROP_NONE;
- private:
friend IntBuilder;
using Builder = IntBuilder;
@@ -76,7 +74,6 @@ class Vector : public SocketDeclaration {
float soft_max_value = FLT_MAX;
PropertySubType subtype = PROP_NONE;
- private:
friend VectorBuilder;
using Builder = VectorBuilder;
@@ -121,7 +118,6 @@ class Color : public SocketDeclaration {
public:
ColorGeometry4f default_value;
- private:
friend ColorBuilder;
using Builder = ColorBuilder;
@@ -142,7 +138,6 @@ class String : public SocketDeclaration {
public:
std::string default_value;
- private:
friend StringBuilder;
using Builder = StringBuilder;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_common.cc b/source/blender/nodes/geometry/nodes/node_geo_common.cc
index 731d86d7bc1..b9912c20543 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_common.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_common.cc
@@ -27,8 +27,7 @@ static void node_declare(const bNodeTree &node_tree,
return;
}
- FieldInferencingInterface field_interface;
- bke::node_field_inferencing::calculate_field_interface(*group, field_interface);
+ const FieldInferencingInterface &field_interface = *group->runtime->field_inferencing_interface;
for (const int i : r_declaration.inputs_.index_range()) {
r_declaration.inputs_[i]->input_field_type_ = field_interface.inputs[i];
}
diff --git a/source/blender/nodes/intern/node_common.cc b/source/blender/nodes/intern/node_common.cc
index 514e3f88b2b..4dc1dc8083b 100644
--- a/source/blender/nodes/intern/node_common.cc
+++ b/source/blender/nodes/intern/node_common.cc
@@ -131,27 +131,27 @@ static SocketDeclarationPtr declaration_for_interface_socket(const bNodeSocket &
case SOCK_FLOAT: {
const auto &value = *io_socket.default_value_typed<bNodeSocketValueFloat>();
std::unique_ptr<decl::Float> decl = std::make_unique<decl::Float>();
- decl->subtype_ = PropertySubType(io_socket.typeinfo->subtype);
- decl->default_value_ = value.value;
- decl->soft_min_value_ = value.min;
- decl->soft_max_value_ = value.max;
+ decl->subtype = PropertySubType(io_socket.typeinfo->subtype);
+ decl->default_value = value.value;
+ decl->soft_min_value = value.min;
+ decl->soft_max_value = value.max;
dst = std::move(decl);
break;
}
case SOCK_VECTOR: {
const auto &value = *io_socket.default_value_typed<bNodeSocketValueVector>();
std::unique_ptr<decl::Vector> decl = std::make_unique<decl::Vector>();
- decl->subtype_ = PropertySubType(io_socket.typeinfo->subtype);
- decl->default_value_ = value.value;
- decl->soft_min_value_ = value.min;
- decl->soft_max_value_ = value.max;
+ decl->subtype = PropertySubType(io_socket.typeinfo->subtype);
+ decl->default_value = value.value;
+ decl->soft_min_value = value.min;
+ decl->soft_max_value = value.max;
dst = std::move(decl);
break;
}
case SOCK_RGBA: {
const auto &value = *io_socket.default_value_typed<bNodeSocketValueRGBA>();
std::unique_ptr<decl::Color> decl = std::make_unique<decl::Color>();
- decl->default_value_ = value.value;
+ decl->default_value = value.value;
dst = std::move(decl);
break;
}
@@ -163,29 +163,28 @@ static SocketDeclarationPtr declaration_for_interface_socket(const bNodeSocket &
case SOCK_BOOLEAN: {
const auto &value = *io_socket.default_value_typed<bNodeSocketValueBoolean>();
std::unique_ptr<decl::Bool> decl = std::make_unique<decl::Bool>();
- decl->default_value_ = value.value;
+ decl->default_value = value.value;
dst = std::move(decl);
break;
}
case SOCK_INT: {
const auto &value = *io_socket.default_value_typed<bNodeSocketValueInt>();
std::unique_ptr<decl::Int> decl = std::make_unique<decl::Int>();
- decl->subtype_ = PropertySubType(io_socket.typeinfo->subtype);
- decl->default_value_ = value.value;
- decl->soft_min_value_ = value.min;
- decl->soft_max_value_ = value.max;
+ decl->subtype = PropertySubType(io_socket.typeinfo->subtype);
+ decl->default_value = value.value;
+ decl->soft_min_value = value.min;
+ decl->soft_max_value = value.max;
dst = std::move(decl);
break;
}
case SOCK_STRING: {
const auto &value = *io_socket.default_value_typed<bNodeSocketValueString>();
std::unique_ptr<decl::String> decl = std::make_unique<decl::String>();
- decl->default_value_ = value.value;
+ decl->default_value = value.value;
dst = std::move(decl);
break;
}
case SOCK_OBJECT:
- /* TODO: What hap
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list