Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-02-23 17:15:23 +0300
committerJacques Lucke <jacques@blender.org>2021-02-23 17:15:29 +0300
commit18be02b8590b0d7d8bbf9e26b1c49264e9fadd99 (patch)
treedf0ee89b42bce516687d4f6560f70aefdf10c502 /source/blender/blenkernel/BKE_geometry_set.hh
parent420f538fadfdd7f9713db9aea44cd7829cbc2ef4 (diff)
Geometry Nodes: improve accessing attribute meta data
This allows accessing attribute meta data like domain and data type without having to create a `ReadAttribute`. I kept the `attribute_names` method for now to keep the patch more self contained. Differential Revision: https://developer.blender.org/D10511
Diffstat (limited to 'source/blender/blenkernel/BKE_geometry_set.hh')
-rw-r--r--source/blender/blenkernel/BKE_geometry_set.hh17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_geometry_set.hh b/source/blender/blenkernel/BKE_geometry_set.hh
index 5b1882d0d4c..ad01814ce82 100644
--- a/source/blender/blenkernel/BKE_geometry_set.hh
+++ b/source/blender/blenkernel/BKE_geometry_set.hh
@@ -25,6 +25,7 @@
#include "BLI_float3.hh"
#include "BLI_float4x4.hh"
+#include "BLI_function_ref.hh"
#include "BLI_hash.hh"
#include "BLI_map.hh"
#include "BLI_set.hh"
@@ -129,6 +130,20 @@ class OutputAttributePtr {
};
/**
+ * Contains information about an attribute in a geometry component.
+ * More information can be added in the future. E.g. whether the attribute is builtin and how it is
+ * stored (uv map, vertex group, ...).
+ */
+struct AttributeMetaData {
+ AttributeDomain domain;
+ CustomDataType data_type;
+};
+
+/* Returns false when the iteration should be stopped. */
+using AttributeForeachCallback = blender::FunctionRef<bool(blender::StringRefNull attribute_name,
+ const AttributeMetaData &meta_data)>;
+
+/**
* This is the base class for specialized geometry component types.
*/
class GeometryComponent {
@@ -185,6 +200,8 @@ class GeometryComponent {
const CustomDataType data_type);
blender::Set<std::string> attribute_names() const;
+ void attribute_foreach(const AttributeForeachCallback callback) const;
+
virtual bool is_empty() const;
/* Get a read-only attribute for the given domain and data type.