[Bf-blender-cvs] [cc388651eb4] master: Fix T92327: use default value when field is passed into data socket
Jacques Lucke
noreply at git.blender.org
Sun Oct 24 17:53:49 CEST 2021
Commit: cc388651eb48e73470c53c185840f74d950cb38d
Author: Jacques Lucke
Date: Sun Oct 24 17:53:19 2021 +0200
Branches: master
https://developer.blender.org/rBcc388651eb48e73470c53c185840f74d950cb38d
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.
===================================================================
M source/blender/functions/intern/field.cc
===================================================================
diff --git a/source/blender/functions/intern/field.cc b/source/blender/functions/intern/field.cc
index c6125b65c5e..5c13db9ec17 100644
--- a/source/blender/functions/intern/field.cc
+++ b/source/blender/functions/intern/field.cc
@@ -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);
More information about the Bf-blender-cvs
mailing list