Fix: unconnected multi socket input crashes

The crash would only happen when the output of the Join Geometry node is used.
This commit is contained in:
Jacques Lucke 2021-03-09 09:45:18 +01:00
parent dc3e9048ae
commit 07a9d39f57
2 changed files with 14 additions and 6 deletions

View File

@ -424,6 +424,10 @@ class GeometryNodesEvaluator {
if (socket_ref->bsocket()->type != SOCK_GEOMETRY) {
continue;
}
if (socket_ref->is_multi_input_socket()) {
/* Not needed currently. */
continue;
}
bNodeTree *btree_cow = node->btree();
bNodeTree *btree_original = (bNodeTree *)DEG_get_original_id((ID *)btree_cow);

View File

@ -120,13 +120,17 @@ class GeoNodeExecParams {
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)) {
int index = 0;
while (true) {
std::string sub_identifier = identifier;
if (index > 0) {
sub_identifier += "[" + std::to_string(index) + "]";
}
if (!input_values_.contains(sub_identifier)) {
break;
}
values.append(input_values_.extract<T>(sub_identifier));
i++;
sub_identifier = identifier + "[" + std::to_string(i) + "]";
index++;
}
return values;
}