diff options
author | Jacques Lucke <jacques@blender.org> | 2021-11-04 20:25:48 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-11-04 20:25:48 +0300 |
commit | b7260ca4c9f4b7618c9c214f1270e31d6ed9886b (patch) | |
tree | c594b0f4623003846c0e41d02e5e74f57601468d /source/blender/blenkernel | |
parent | 2eed1afd114fa7f3e7a1be530924e4f11b68128d (diff) |
Fix T92799: handle undefined node group type in field inferencing
A group node could reference an undefined group when the group
was linked and its source file was not found on load. The field
inferencing code did not handle that case before.
With this change, the file provided in T92799 loads successfully.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/node.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index 6b409ae656e..0827a15dea0 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -4585,6 +4585,15 @@ static OutputFieldDependency get_interface_output_field_dependency(const NodeRef return socket_decl.output_field_dependency(); } +static FieldInferencingInterface get_dummy_field_inferencing_interface(const NodeRef &node) +{ + FieldInferencingInterface inferencing_interface; + inferencing_interface.inputs.append_n_times(InputSocketFieldType::None, node.inputs().size()); + inferencing_interface.outputs.append_n_times(OutputFieldDependency::ForDataSource(), + node.outputs().size()); + return inferencing_interface; +} + /** * Retrieves information about how the node interacts with fields. * In the future, this information can be stored in the node declaration. This would allow this @@ -4598,6 +4607,10 @@ static FieldInferencingInterface get_node_field_inferencing_interface(const Node if (group == nullptr) { return FieldInferencingInterface(); } + if (!ntreeIsRegistered(group)) { + /* This can happen when there is a linked node group that was not found (see T92799). */ + return get_dummy_field_inferencing_interface(node); + } if (group->field_inferencing_interface == nullptr) { /* Update group recursively. */ update_field_inferencing(*group); |