[Bf-blender-cvs] [02cdf856f6b] functions: fix attribute initialization
Jacques Lucke
noreply at git.blender.org
Thu Sep 5 19:12:14 CEST 2019
Commit: 02cdf856f6bb009b1d538d054461b1b6d8553e85
Author: Jacques Lucke
Date: Thu Sep 5 19:07:08 2019 +0200
Branches: functions
https://developer.blender.org/rB02cdf856f6bb009b1d538d054461b1b6d8553e85
fix attribute initialization
===================================================================
M source/blender/blenkernel/BKE_attributes_ref.hpp
M source/blender/blenlib/BLI_index_range.hpp
===================================================================
diff --git a/source/blender/blenkernel/BKE_attributes_ref.hpp b/source/blender/blenkernel/BKE_attributes_ref.hpp
index b7476402745..c0d4f38d6d7 100644
--- a/source/blender/blenkernel/BKE_attributes_ref.hpp
+++ b/source/blender/blenkernel/BKE_attributes_ref.hpp
@@ -361,7 +361,7 @@ class AttributesRef {
AttributeType type = m_info->type_of(index);
uint element_size = size_of_attribute_type(type);
- for (uint i : m_range) {
+ for (uint i = 0; i < m_range.size(); i++) {
memcpy(POINTER_OFFSET(dst, element_size * i), default_value, element_size);
}
}
diff --git a/source/blender/blenlib/BLI_index_range.hpp b/source/blender/blenlib/BLI_index_range.hpp
index d6083df6ffa..270686ed611 100644
--- a/source/blender/blenlib/BLI_index_range.hpp
+++ b/source/blender/blenlib/BLI_index_range.hpp
@@ -26,6 +26,7 @@
#include <cmath>
#include <algorithm>
+#include <iostream>
#include "BLI_utildefines.h"
@@ -184,6 +185,12 @@ class IndexRange {
* works for some ranges. The range must be within [0, RANGE_AS_ARRAY_REF_MAX_LEN].
*/
ArrayRef<uint> as_array_ref() const;
+
+ friend std::ostream &operator<<(std::ostream &stream, IndexRange range)
+ {
+ stream << "[" << range.start() << ", " << range.one_after_last() << ")";
+ return stream;
+ }
};
} // namespace BLI
More information about the Bf-blender-cvs
mailing list