Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2022-09-29 14:03:15 +0300
committerJacques Lucke <jacques@blender.org>2022-09-29 14:03:15 +0300
commitdb0ef8b00d3c92751ff80a3fc061a4e663639d4b (patch)
tree4a88d6a9eb1212046ef6d33fd45431f81578c6dd
parent5ffbabb24c8cca4ab2802811ecdbcdb484745107 (diff)
Fix T101410: ignore dangling reroute inputs
For consistency with other node systems in Blender and older versions of geometry nodes, dangling reroute inputs should not affect the output. When an input socket is linked to dangling reroutes, its own value should be used instead.
-rw-r--r--source/blender/nodes/intern/geometry_nodes_lazy_function.cc33
1 files changed, 33 insertions, 0 deletions
diff --git a/source/blender/nodes/intern/geometry_nodes_lazy_function.cc b/source/blender/nodes/intern/geometry_nodes_lazy_function.cc
index 0dec27da0bd..eca0bef3e65 100644
--- a/source/blender/nodes/intern/geometry_nodes_lazy_function.cc
+++ b/source/blender/nodes/intern/geometry_nodes_lazy_function.cc
@@ -1071,6 +1071,12 @@ struct GeometryNodesLazyFunctionGraphBuilder {
void insert_links_from_socket(const bNodeSocket &from_bsocket, lf::OutputSocket &from_lf_socket)
{
+ const bNode &from_bnode = from_bsocket.owner_node();
+ if (this->is_dangling_reroute_input(from_bnode)) {
+ /* Dangling reroutes should not be used as source of values. */
+ return;
+ }
+
const Span<const bNodeLink *> links_from_bsocket = from_bsocket.directly_linked_links();
struct TypeWithLinks {
@@ -1166,6 +1172,33 @@ struct GeometryNodesLazyFunctionGraphBuilder {
}
}
+ bool is_dangling_reroute_input(const bNode &node)
+ {
+ if (!node.is_reroute()) {
+ return false;
+ }
+ const bNode *iter_node = &node;
+ /* It is guaranteed at a higher level that there are no link cycles. */
+ while (true) {
+ const Span<const bNodeLink *> links = iter_node->input_socket(0).directly_linked_links();
+ BLI_assert(links.size() <= 1);
+ if (links.is_empty()) {
+ return true;
+ }
+ const bNodeLink &link = *links[0];
+ if (!link.is_available()) {
+ return false;
+ }
+ if (link.is_muted()) {
+ return false;
+ }
+ iter_node = link.fromnode;
+ if (!iter_node->is_reroute()) {
+ return false;
+ }
+ }
+ }
+
lf::OutputSocket *insert_type_conversion_if_necessary(
lf::OutputSocket &from_socket,
const CPPType &to_type,