From 871c717c6ec2b869c8de337da87b67fb8374db07 Mon Sep 17 00:00:00 2001
From: Hans Goudey <hans@blender.org>
Date: Wed, 8 Nov 2023 10:46:59 +0100
Subject: [PATCH] Fix: Remove support for node tool data-block inputs for 4.0

There are two bugs with data-block inputs currently. One is #113383,
where clicking the "Clear" button on the data-block picker closes the
redo panel. The worse issue is that storing pointer properties in
operators isn't safe at all. Deleting the data-block doesn't clear
the pointer property in operator storage, for example.

The proper solution is to reuse some code from the existing data-block
picker but back it with a `session_uuid` integer property instead of an
actual pointer. This makes lookups safe without depending on the name.
However, doing that for 4.0 is too risky, so for now we will just not
support data-block inputs in the redo panel.

Pull Request: https://projects.blender.org/blender/blender/pulls/114621
---
 .../blender/editors/geometry/node_group_operator.cc | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/source/blender/editors/geometry/node_group_operator.cc b/source/blender/editors/geometry/node_group_operator.cc
index 5fea392b30e..2827fa62c30 100644
--- a/source/blender/editors/geometry/node_group_operator.cc
+++ b/source/blender/editors/geometry/node_group_operator.cc
@@ -330,6 +330,19 @@ static int run_node_group_exec(bContext *C, wmOperator *op)
     BKE_report(op->reports, RPT_ERROR, "Node group must have a group output node");
     return OPERATOR_CANCELLED;
   }
+  for (const bNodeTreeInterfaceSocket *input : node_tree->interface_inputs()) {
+    if (STR_ELEM(input->socket_type,
+                 "NodeSocketObject",
+                 "NodeSocketImage",
+                 "NodeSocketGeometry",
+                 "NodeSocketCollection",
+                 "NodeSocketTexture",
+                 "NodeSocketMaterial"))
+    {
+      BKE_report(op->reports, RPT_ERROR, "Data-block inputs are unsupported");
+      return OPERATOR_CANCELLED;
+    }
+  }
 
   IDProperty *properties = replace_inputs_evaluated_data_blocks(*op->properties, *depsgraph);
   BLI_SCOPED_DEFER([&]() { IDP_FreeProperty_ex(properties, false); });
-- 
GitLab