From e5ee7e9a2df93d7f28f9e1f8bc0eb2d33dfadfb4 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Thu, 14 Jan 2021 15:52:08 +0100 Subject: Geometry Nodes: don't delete existing attribute before new attribute is computed This fixes the behavior of some nodes when the same attribute name is used for input and output. If both attributes have a different type, they can't exist at the same time. Therefore, the input attribute has to be removed in order to create the output attribute. Previously, the input attribute was remove before it was used in any computations. Now, the output is written to a temporary buffer and only later saved in the geometry component. This allows both attributes to coexist within the node. The temporary attribute is only create when necessary. The normal case without name collisions still works the same as before. Differential Revision: https://developer.blender.org/D10109 Ref T83793. --- source/blender/functions/FN_spans.hh | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source/blender/functions') diff --git a/source/blender/functions/FN_spans.hh b/source/blender/functions/FN_spans.hh index 2c1257f9ad2..41c930581a4 100644 --- a/source/blender/functions/FN_spans.hh +++ b/source/blender/functions/FN_spans.hh @@ -161,6 +161,14 @@ class GMutableSpan { void *operator[](int64_t index) { + BLI_assert(index >= 0); + BLI_assert(index < size_); + return POINTER_OFFSET(data_, type_->size() * index); + } + + void *operator[](int64_t index) const + { + BLI_assert(index >= 0); BLI_assert(index < size_); return POINTER_OFFSET(data_, type_->size() * index); } -- cgit v1.2.3