diff options
author | Jacques Lucke <jacques@blender.org> | 2021-09-23 14:46:13 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-09-23 14:46:26 +0300 |
commit | aadb7ef0718af9c54fa97d0ce10e3967a80cea2e (patch) | |
tree | 51533ab6a9b39f0b17621b0cc047d891bd0a3449 /source/blender/blenkernel | |
parent | e86cf55667a74c469c325f1bae1868ac963fb87d (diff) |
Geometry Nodes: add utility to print an attribute id.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_attribute_access.hh | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/attribute_access.cc | 15 |
2 files changed, 17 insertions, 0 deletions
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) { |