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:
authorHans Goudey <h.goudey@me.com>2022-07-07 16:49:23 +0300
committerHans Goudey <h.goudey@me.com>2022-07-07 16:49:23 +0300
commita91f9c2c01401285208f2962f3be339a5012ec2a (patch)
tree737a6d476e10b7d00269bd1f5943fdd2bfc2a18e
parentf0ac55f51965c2abb811b2759241225762a06c94 (diff)
Cleanup: Use generic index mask utility
This may lead to improved performance from multithreading as well.
-rw-r--r--source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc19
1 files changed, 5 insertions, 14 deletions
diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc b/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc
index 6955f23e1c2..1b01dd64c74 100644
--- a/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc
+++ b/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
+#include "BLI_index_mask_ops.hh"
#include "BLI_virtual_array.hh"
#include "BKE_context.h"
@@ -235,20 +236,10 @@ bool GeometryDataSource::has_selection_filter() const
return true;
}
-static IndexMask index_mask_from_bool_array(const VArray<bool> &selection,
- Vector<int64_t> &indices)
-{
- for (const int i : selection.index_range()) {
- if (selection[i]) {
- indices.append(i);
- }
- }
- return IndexMask(indices);
-}
-
IndexMask GeometryDataSource::apply_selection_filter(Vector<int64_t> &indices) const
{
std::lock_guard lock{mutex_};
+ const IndexMask full_range(this->tot_rows());
BLI_assert(object_eval_->mode == OB_MODE_EDIT);
BLI_assert(component_->type() == GEO_COMPONENT_TYPE_MESH);
@@ -277,7 +268,7 @@ IndexMask GeometryDataSource::apply_selection_filter(Vector<int64_t> &indices) c
}),
ATTR_DOMAIN_POINT,
domain_);
- return index_mask_from_bool_array(selection, indices);
+ return index_mask_ops::find_indices_from_virtual_array(full_range, selection, 1024, indices);
}
if (mesh_eval->totvert == bm->totvert) {
@@ -290,10 +281,10 @@ IndexMask GeometryDataSource::apply_selection_filter(Vector<int64_t> &indices) c
}),
ATTR_DOMAIN_POINT,
domain_);
- return index_mask_from_bool_array(selection, indices);
+ return index_mask_ops::find_indices_from_virtual_array(full_range, selection, 2048, indices);
}
- return IndexMask(mesh_eval->totvert);
+ return full_range;
}
void VolumeDataSource::foreach_default_column_ids(