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:
Diffstat (limited to 'source/blender/blenkernel/BKE_attribute.hh')
-rw-r--r--source/blender/blenkernel/BKE_attribute.hh26
1 files changed, 23 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_attribute.hh b/source/blender/blenkernel/BKE_attribute.hh
index b92d0d4326b..108993d91c0 100644
--- a/source/blender/blenkernel/BKE_attribute.hh
+++ b/source/blender/blenkernel/BKE_attribute.hh
@@ -351,8 +351,9 @@ class AttributeAccessor {
/**
* The data that actually owns the attributes, for example, a pointer to a #Mesh or #PointCloud
* Most commonly this is a pointer to a #Mesh or #PointCloud.
- * Under some circumstances this can be null. In that case most methods can't be used. Just e.g.
- * the #domain_size method works and returns 0 for every domain.
+ * Under some circumstances this can be null. In that case most methods can't be used. Allowed
+ * methods are #domain_size, #for_all and #is_builtin. We could potentially make these methods
+ * accessible without #AttributeAccessor and then #owner_ could always be non-null.
*
* \note This class cannot modify the owner's attributes, but the pointer is still non-const, so
* this class can be a base class for the mutable version.
@@ -509,7 +510,10 @@ class AttributeAccessor {
*/
bool for_all(const AttributeForeachCallback fn) const
{
- return fn_->for_all(owner_, fn);
+ if (owner_ != nullptr) {
+ return fn_->for_all(owner_, fn);
+ }
+ return true;
}
/**
@@ -662,6 +666,22 @@ class MutableAttributeAccessor : public AttributeAccessor {
void remove_anonymous();
};
+struct AttributeTransferData {
+ /* Expect that if an attribute exists, it is stored as a contiguous array internally anyway. */
+ GVArraySpan src;
+ AttributeMetaData meta_data;
+ bke::GSpanAttributeWriter dst;
+};
+/**
+ * Retrieve attribute arrays and writers for attributes that should be transferred between
+ * data-blocks of the same type.
+ */
+Vector<AttributeTransferData> retrieve_attributes_for_transfer(
+ const bke::AttributeAccessor &src_attributes,
+ bke::MutableAttributeAccessor &dst_attributes,
+ eAttrDomainMask domain_mask,
+ const Set<std::string> &skip = {});
+
bool allow_procedural_attribute_access(StringRef attribute_name);
extern const char *no_procedural_access_message;