diff options
author | Hans Goudey <h.goudey@me.com> | 2021-09-28 20:05:42 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-09-28 20:05:42 +0300 |
commit | 797064544ea3e176c511f7ff7c1303498a783182 (patch) | |
tree | ee3cef6afe9024da7e1496361a7b7a0bb62f93ae /source/blender/blenkernel/intern | |
parent | 44e4f077a9d7b5b609f6199874802675d75f7266 (diff) |
Geometry Nodes: Only show attribute toggle for field inputs
Change the toggle to switch between an attribute and a single value to
only display for inputs that are fields, as determined statically by
the field inferencing added in rB61f3d4eb7c7db7. This means the field
inferencing must be calculated on file load, since it's used in the UI.
Differential Revision: https://developer.blender.org/D12623
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/node.cc | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index f2843e5f88e..c8ba7991f31 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -104,6 +104,7 @@ using blender::Span; using blender::Stack; using blender::Vector; using blender::VectorSet; +using blender::nodes::FieldInferencingInterface; using blender::nodes::InputSocketFieldType; using blender::nodes::NodeDeclaration; using blender::nodes::OutputFieldDependency; @@ -823,6 +824,11 @@ void ntreeBlendReadData(BlendDataReader *reader, bNodeTree *ntree) /* TODO: should be dealt by new generic cache handling of IDs... */ ntree->previews = nullptr; + if (ntree->type == NTREE_GEOMETRY) { + /* Update field referencing for the geometry nodes modifier. */ + ntree->update |= NTREE_UPDATE_FIELD_INFERENCING; + } + /* type verification is in lib-link */ } @@ -4456,24 +4462,6 @@ void ntreeUpdateAllNew(Main *main) FOREACH_NODETREE_END; } -/** - * Information about how a node interacts with fields. - */ -struct FieldInferencingInterface { - Vector<InputSocketFieldType> inputs; - Vector<OutputFieldDependency> outputs; - - friend bool operator==(const FieldInferencingInterface &a, const FieldInferencingInterface &b) - { - return a.inputs == b.inputs && a.outputs == b.outputs; - } - - friend bool operator!=(const FieldInferencingInterface &a, const FieldInferencingInterface &b) - { - return !(a == b); - } -}; - static FieldInferencingInterface *node_field_inferencing_interface_copy( const FieldInferencingInterface &field_inferencing_interface) { |