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:
authorFabian Schempp <fabian_schempp>2021-02-03 20:02:01 +0300
committerHans Goudey <h.goudey@me.com>2021-02-03 20:03:00 +0300
commitc5514d3a2a03242ddc43f83be4bb72df7f85469f (patch)
treeb7db84dd1f3f8586d287486749b2a812acc9724e /source/blender/nodes/NOD_geometry_exec.hh
parent894cc9c91592041a47c33300d784eac4e6412162 (diff)
Geometry Nodes: Multi-Input Sockets
Normally sockets only have one input link. This commit adds the back-end changes needed to use multiple input links per socket. Multi-input sockets can be defined with a new flag in `bNodeSocketType`. The changes necessary to make the sockets work in the geometry nodes evaluator are generalizing input socket values as a vector of values, and supporting this in the derived node tree structure. This patch should contain no functional changes. Two upcoming patches will use this system for the "Join Geometry" node and expose link picking and updated display in the UI: D10069 and D10181. Reviewed By: Jacques Lucke, Hans Goudey Differential Revision: https://developer.blender.org/D10067
Diffstat (limited to 'source/blender/nodes/NOD_geometry_exec.hh')
-rw-r--r--source/blender/nodes/NOD_geometry_exec.hh19
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/nodes/NOD_geometry_exec.hh b/source/blender/nodes/NOD_geometry_exec.hh
index 454c9e96246..91d46e3951f 100644
--- a/source/blender/nodes/NOD_geometry_exec.hh
+++ b/source/blender/nodes/NOD_geometry_exec.hh
@@ -104,6 +104,25 @@ class GeoNodeExecParams {
}
/**
+ * Get input as vector for multi input socket with the given identifier.
+ *
+ * This method can only be called once for each identifier.
+ */
+ template<typename T> Vector<T> extract_multi_input(StringRef identifier)
+ {
+ Vector<T> values;
+ values.append(input_values_.extract<T>(identifier));
+ int i = 1;
+ std::string sub_identifier = identifier + "[1]";
+ while (input_values_.contains(sub_identifier)) {
+ values.append(input_values_.extract<T>(sub_identifier));
+ i++;
+ sub_identifier = identifier + "[" + std::to_string(i) + "]";
+ }
+ return values;
+ }
+
+ /**
* Get the input value for the input socket with the given identifier.
*
* This makes a copy of the value, which is fine for most types but should be avoided for