[Bf-blender-cvs] [aadb7ef0718] master: Geometry Nodes: add utility to print an attribute id.
Jacques Lucke
noreply at git.blender.org
Thu Sep 23 13:46:40 CEST 2021
Commit: aadb7ef0718af9c54fa97d0ce10e3967a80cea2e
Author: Jacques Lucke
Date: Thu Sep 23 13:46:13 2021 +0200
Branches: master
https://developer.blender.org/rBaadb7ef0718af9c54fa97d0ce10e3967a80cea2e
Geometry Nodes: add utility to print an attribute id.
===================================================================
M source/blender/blenkernel/BKE_attribute_access.hh
M source/blender/blenkernel/intern/attribute_access.cc
===================================================================
diff --git a/source/blender/blenkernel/BKE_attribute_access.hh b/source/blender/blenkernel/BKE_attribute_access.hh
index cf54e7efa0d..77db479f525 100644
--- a/source/blender/blenkernel/BKE_attribute_access.hh
+++ b/source/blender/blenkernel/BKE_attribute_access.hh
@@ -101,6 +101,8 @@ class AttributeIDRef {
BLI_assert(this->is_anonymous());
return *anonymous_id_;
}
+
+ friend std::ostream &operator<<(std::ostream &stream, const AttributeIDRef &attribute_id);
};
} // namespace blender::bke
diff --git a/source/blender/blenkernel/intern/attribute_access.cc b/source/blender/blenkernel/intern/attribute_access.cc
index 8c4f87be91f..c2837b522c4 100644
--- a/source/blender/blenkernel/intern/attribute_access.cc
+++ b/source/blender/blenkernel/intern/attribute_access.cc
@@ -55,6 +55,21 @@ using blender::fn::GVArray_For_SingleValue;
namespace blender::bke {
+std::ostream &operator<<(std::ostream &stream, const AttributeIDRef &attribute_id)
+{
+ if (attribute_id.is_named()) {
+ stream << attribute_id.name();
+ }
+ else if (attribute_id.is_anonymous()) {
+ const AnonymousAttributeID &anonymous_id = attribute_id.anonymous_id();
+ stream << "<" << BKE_anonymous_attribute_id_debug_name(&anonymous_id) << ">";
+ }
+ else {
+ stream << "<none>";
+ }
+ return stream;
+}
+
const blender::fn::CPPType *custom_data_type_to_cpp_type(const CustomDataType type)
{
switch (type) {
More information about the Bf-blender-cvs
mailing list