diff options
author | Hans Goudey <h.goudey@me.com> | 2021-04-22 16:05:02 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-04-22 16:05:02 +0300 |
commit | b9a7b40924f6284af5867cb63078dc79c714a675 (patch) | |
tree | 76a455cc2ab73f930c3176aa0e518452d5f00a22 /source/blender/blenkernel/BKE_geometry_set.hh | |
parent | f6efacfec74e0c20fffc75e05007df01536d8924 (diff) |
Geometry Nodes: Get attribute domain and type without allocation
Because we use virtual classes (and for other reasons), we had to do a
small allocation when simply retrieving the data type and domain of an
existing attribute. This happened quite a lot actually-- to determine
these values for result attributes.
This patch adds a simple function to retrieve this meta data without
building the virtual array. This should lower the overhead of every
attribute node, though the difference probably won't be noticible
unless a tree has very many nodes.
Differential Revision: https://developer.blender.org/D11047
Diffstat (limited to 'source/blender/blenkernel/BKE_geometry_set.hh')
-rw-r--r-- | source/blender/blenkernel/BKE_geometry_set.hh | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_geometry_set.hh b/source/blender/blenkernel/BKE_geometry_set.hh index 38f692fee0e..e9545cba1f1 100644 --- a/source/blender/blenkernel/BKE_geometry_set.hh +++ b/source/blender/blenkernel/BKE_geometry_set.hh @@ -102,6 +102,10 @@ class GeometryComponent { /* Return true when any attribute with this name exists, including built in attributes. */ bool attribute_exists(const blender::StringRef attribute_name) const; + /* Return the data type and domain of an attribute with the given name if it exists. */ + std::optional<AttributeMetaData> attribute_get_meta_data( + const blender::StringRef attribute_name) const; + /* Returns true when the geometry component supports this attribute domain. */ bool attribute_domain_supported(const AttributeDomain domain) const; /* Can only be used with supported domain types. */ |