[Bf-blender-cvs] [f509bd37b16] temp-nodes-group-declarations: Fix build errors
Hans Goudey
noreply at git.blender.org
Fri Dec 16 00:18:39 CET 2022
Commit: f509bd37b166d7f46e542eb7b188927a2625a454
Author: Hans Goudey
Date: Thu Dec 15 17:18:34 2022 -0600
Branches: temp-nodes-group-declarations
https://developer.blender.org/rBf509bd37b166d7f46e542eb7b188927a2625a454
Fix build errors
===================================================================
M source/blender/nodes/NOD_common.h
M source/blender/nodes/composite/nodes/node_composite_common.cc
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_declarations.cc
M source/blender/nodes/shader/nodes/node_shader_common.cc
M source/blender/nodes/texture/nodes/node_texture_common.cc
===================================================================
diff --git a/source/blender/nodes/NOD_common.h b/source/blender/nodes/NOD_common.h
index c1091bf87ce..d860e60864c 100644
--- a/source/blender/nodes/NOD_common.h
+++ b/source/blender/nodes/NOD_common.h
@@ -31,7 +31,7 @@ void node_internal_links_create(struct bNodeTree *ntree, struct bNode *node);
namespace blender::nodes {
-bool node_group_declare_dynamic_fn(const bNodeTree &node_tree,
+bool node_group_declare_dynamic(const bNodeTree &node_tree,
const bNode &node,
NodeDeclaration &r_declaration);
diff --git a/source/blender/nodes/composite/nodes/node_composite_common.cc b/source/blender/nodes/composite/nodes/node_composite_common.cc
index 9088a244e49..5c3a2c87b9f 100644
--- a/source/blender/nodes/composite/nodes/node_composite_common.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_common.cc
@@ -32,7 +32,7 @@ void register_node_type_cmp_group()
node_type_size(&ntype, 140, 60, 400);
ntype.labelfunc = node_group_label;
- ntype.declare_dynamic = blender::nodes::node_group_declare_dynamic_fn;
+ ntype.declare_dynamic = blender::nodes::node_group_declare_dynamic;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_common.cc b/source/blender/nodes/geometry/nodes/node_geo_common.cc
index 4f490d3d1e1..2c819172efe 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_common.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_common.cc
@@ -3,6 +3,7 @@
#include "BKE_node.h"
#include "NOD_geometry.h"
+#include "NOD_node_declaration.hh"
#include "NOD_common.h"
#include "node_common.h"
@@ -10,16 +11,25 @@
namespace blender::nodes {
-static void node_declare(const bNodeTree &node_tree,
+static bool node_declare(const bNodeTree &node_tree,
const bNode &node,
NodeDeclaration &r_declaration)
{
- if (!node.id) {
- return;
+ if (!node_group_declare_dynamic(node_tree, node, r_declaration)) {
+ return false;
}
- blender::nodes::node_group_declare_dynamic_fn(node_tree, node, r_declaration);
- FieldInferencingInterface field_interface = calculate_field_inferencing()
+ const bNodeTree &group = reinterpret_cast<const bNodeTree &>(*node.id);
+ const FieldInferencingInterface field_interface = field_inferencing::calculate_field_inferencing(
+ group);
+ for (const int i : r_declaration.inputs_.index_range()) {
+ r_declaration.inputs_[i]->input_field_type_ = field_interface.inputs[i];
+ }
+ for (const int i : r_declaration.outputs_.index_range()) {
+ r_declaration.outputs_[i]->output_field_dependency_ = field_interface.outputs[i];
+ }
+
+ return true;
}
} // namespace blender::nodes
diff --git a/source/blender/nodes/intern/node_common.cc b/source/blender/nodes/intern/node_common.cc
index 8d36ca6c0b0..e1164515634 100644
--- a/source/blender/nodes/intern/node_common.cc
+++ b/source/blender/nodes/intern/node_common.cc
@@ -204,31 +204,30 @@ static SocketDeclarationPtr declataion_for_interface_socket(const bNodeSocket &i
dst->identifier_ = io_socket.identifier;
dst->in_out_ = eNodeSocketInOut(io_socket.in_out);
dst->description_ = io_socket.description;
+ dst->hide_value_ = io_socket.flag & SOCK_HIDE_VALUE;
+ return dst;
}
-bool node_group_declare_dynamic_fn(const bNodeTree & /*node_tree*/,
- const bNode &node,
- NodeDeclaration &r_declaration)
+bool node_group_declare_dynamic(const bNodeTree & /*node_tree*/,
+ const bNode &node,
+ NodeDeclaration &r_declaration)
{
- if (!node.id) {
+ const bNodeTree *group = reinterpret_cast<const bNodeTree *>(node.id);
+ if (!group) {
return false;
}
- else if (ID_IS_LINKED(node.id) && (node.id->tag & LIB_TAG_MISSING)) {
+ if (ID_IS_LINKED(&group->id) && (group->id.tag & LIB_TAG_MISSING)) {
/* TODO: Restore the behavior that keeps the sockets until the ID is found. */
return false;
}
- const bNodeTree &group = *reinterpret_cast<const bNodeTree *>(node.id);
-
- Vector<SocketDeclarationPtr> inputs;
- Vector<SocketDeclarationPtr> outputs;
/* TODO: Specialize for geometry nodes and fields. */
/* TODO: Figure out how this should work for custom node trees / #SOCK_CUSTOM. */
- LISTBASE_FOREACH (const bNodeSocket *, input, &group.inputs) {
- inputs.append(declataion_for_interface_socket(*input));
+ LISTBASE_FOREACH (const bNodeSocket *, input, &group->inputs) {
+ r_declaration.inputs_.append(declataion_for_interface_socket(*input));
}
- LISTBASE_FOREACH (const bNodeSocket *, output, &group.outputs) {
- outputs.append(declataion_for_interface_socket(*output));
+ LISTBASE_FOREACH (const bNodeSocket *, output, &group->outputs) {
+ r_declaration.outputs_.append(declataion_for_interface_socket(*output));
}
return true;
@@ -438,9 +437,9 @@ static SocketDeclarationPtr extend_declaration(const eNodeSocketInOut in_out)
return decl;
}
-static bool group_input_declare_dynamic_fn(const bNodeTree &node_tree,
- const bNode &node,
- NodeDeclaration &r_declaration)
+static bool group_input_declare_dynamic(const bNodeTree &node_tree,
+ const bNode & /*node*/,
+ NodeDeclaration &r_declaration)
{
LISTBASE_FOREACH (const bNodeSocket *, input, &node_tree.inputs) {
r_declaration.outputs_.append(declataion_for_interface_socket(*input));
@@ -449,11 +448,12 @@ static bool group_input_declare_dynamic_fn(const bNodeTree &node_tree,
if (!ID_IS_LINKED(&node_tree.id)) {
r_declaration.outputs_.append(extend_declaration(SOCK_OUT));
}
+ return true;
}
-static bool group_output_declare_dynamic_fn(const bNodeTree &node_tree,
- const bNode &node,
- NodeDeclaration &r_declaration)
+static bool group_output_declare_dynamic(const bNodeTree &node_tree,
+ const bNode & /*node*/,
+ NodeDeclaration &r_declaration)
{
LISTBASE_FOREACH (const bNodeSocket *, input, &node_tree.inputs) {
r_declaration.inputs_.append(declataion_for_interface_socket(*input));
@@ -462,6 +462,7 @@ static bool group_output_declare_dynamic_fn(const bNodeTree &node_tree,
if (!ID_IS_LINKED(&node_tree.id)) {
r_declaration.inputs_.append(extend_declaration(SOCK_OUT));
}
+ return true;
}
} // namespace blender::nodes
@@ -475,7 +476,7 @@ void register_node_type_group_input()
node_type_base(ntype, NODE_GROUP_INPUT, "Group Input", NODE_CLASS_INTERFACE);
node_type_size(ntype, 140, 80, 400);
/* TODO: Update declaration when linking to the extension sockets. */
- ntype->declare_dynamic = blender::nodes::group_input_declare_dynamic_fn;
+ ntype->declare_dynamic = blender::nodes::group_input_declare_dynamic;
nodeRegisterType(ntype);
}
@@ -500,7 +501,7 @@ void register_node_type_group_output()
node_type_base(ntype, NODE_GROUP_OUTPUT, "Group Output", NODE_CLASS_INTERFACE);
node_type_size(ntype, 140, 80, 400);
/* TODO: Update declaration when linking to the extension sockets. */
- // ntype->declare_dynamic = //;
+ ntype->declare_dynamic = blender::nodes::group_output_declare_dynamic;
ntype->no_muting = true;
diff --git a/source/blender/nodes/intern/node_socket_declarations.cc b/source/blender/nodes/intern/node_socket_declarations.cc
index 654cdf207fe..e89083498cc 100644
--- a/source/blender/nodes/intern/node_socket_declarations.cc
+++ b/source/blender/nodes/intern/node_socket_declarations.cc
@@ -529,7 +529,9 @@ bool Extend::can_connect(const bNodeSocket & /*socket*/) const
return false;
}
-bNodeSocket &Extend::update_or_build(bNodeTree &ntree, bNode &node, bNodeSocket &socket) const
+bNodeSocket &Extend::update_or_build(bNodeTree & /*ntree*/,
+ bNode & /*node*/,
+ bNodeSocket &socket) const
{
this->set_common_flags(socket);
return socket;
diff --git a/source/blender/nodes/shader/nodes/node_shader_common.cc b/source/blender/nodes/shader/nodes/node_shader_common.cc
index 241df971f64..ac918ba0fdd 100644
--- a/source/blender/nodes/shader/nodes/node_shader_common.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_common.cc
@@ -95,7 +95,7 @@ void register_node_type_sh_group()
node_type_size(&ntype, 140, 60, 400);
ntype.labelfunc = node_group_label;
- ntype.declare_dynamic = blender::nodes::node_group_declare_dynamic_fn;
+ ntype.declare_dynamic = blender::nodes::node_group_declare_dynamic;
ntype.gpu_fn = gpu_group_execute;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/texture/nodes/node_texture_common.cc b/source/blender/nodes/texture/nodes/node_texture_common.cc
index 913ed1eb2d0..988195d852a 100644
--- a/source/blender/nodes/texture/nodes/node_texture_common.cc
+++ b/source/blender/nodes/texture/nodes/node_texture_common.cc
@@ -157,7 +157,7 @@ void register_node_type_tex_group(void)
node_type_size(&ntype, 140, 60, 400);
ntype.labelfunc = node_group_label;
- ntype.declare_dynamic = blender::nodes::node_group_declare_dynamic_fn;
+ ntype.declare_dynamic = blender::nodes::node_group_declare_dynamic;
ntype.init_exec_fn = group_initexec;
ntype.free_exec_fn = group_freeexec;
ntype.exec_fn = group_execute;
More information about the Bf-blender-cvs
mailing list