diff options
author | Jacques Lucke <jacques@blender.org> | 2021-01-14 17:52:08 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-01-14 17:52:08 +0300 |
commit | e5ee7e9a2df93d7f28f9e1f8bc0eb2d33dfadfb4 (patch) | |
tree | f36c7d02bc3441c75b6233fcaa4b0611df883248 /source/blender/functions | |
parent | 53bd58993e2f6d35452242762402c20343d6eef3 (diff) |
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.
Diffstat (limited to 'source/blender/functions')
-rw-r--r-- | source/blender/functions/FN_spans.hh | 8 |
1 files changed, 8 insertions, 0 deletions
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); } |