Fix T92327: use default value when field is passed into data socket

Previously, the computed value passed into the data socket could depend
on the actual field a bit. However, given that the link is marked as invalid
in the ui, the user should not depend on this behavior.
Using a default value is consistent with other cases when there are
invalid links.
This commit is contained in:
Jacques Lucke 2021-10-24 17:53:19 +02:00
parent 6ce383a9df
commit cc388651eb
Notes: blender-bot 2023-02-14 07:39:44 +01:00
Referenced by issue #92451, Operator Search Crash!!!
Referenced by issue #92327, Geometry Nodes: Random Value node connected to Subdivision Mesh level socket gives error, but still appears to function.
1 changed files with 6 additions and 0 deletions

View File

@ -477,6 +477,12 @@ Vector<const GVArray *> evaluate_fields(ResourceScope &scope,
void evaluate_constant_field(const GField &field, void *r_value)
{
if (field.node().depends_on_input()) {
const CPPType &type = field.cpp_type();
type.copy_construct(type.default_value(), r_value);
return;
}
ResourceScope scope;
FieldContext context;
Vector<const GVArray *> varrays = evaluate_fields(scope, {field}, IndexRange(1), context);