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) {

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to