Commit: fac0723e92e451bc6c5937a41426d8f576bf89cb
Author: Hans Goudey
Date:   Thu Sep 2 15:57:35 2021 -0500
Branches: temp-geometry-nodes-fields
https://developer.blender.org/rBfac0723e92e451bc6c5937a41426d8f576bf89cb

Add a special case for a selection span

This will probably end up being a utility used elsewhere,
so it's worth adding this case.

===================================================================

M       source/blender/nodes/geometry/nodes/node_geo_set_position.cc

===================================================================

diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_position.cc 
b/source/blender/nodes/geometry/nodes/node_geo_set_position.cc
index a4d969efbf1..fb2e82664f6 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_set_position.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_set_position.cc
@@ -37,9 +37,19 @@ static IndexMask index_mask_from_selection_varray(const 
VArray<bool> &selection,
     }
     return IndexRange(0);
   }
-  for (const int i : selection.index_range()) {
-    if (selection[i]) {
-      r_indices.append(i);
+  if (selection.is_span()) {
+    Span<bool> selection_span = selection.get_internal_span();
+    for (const int i : selection_span.index_range()) {
+      if (selection_span[i]) {
+        r_indices.append(i);
+      }
+    }
+  }
+  else {
+    for (const int i : selection.index_range()) {
+      if (selection[i]) {
+        r_indices.append(i);
+      }
     }
   }
   return r_indices.as_span();

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to