Commit: a91f9c2c01401285208f2962f3be339a5012ec2a Author: Hans Goudey Date: Thu Jul 7 08:49:23 2022 -0500 Branches: master https://developer.blender.org/rBa91f9c2c01401285208f2962f3be339a5012ec2a
Cleanup: Use generic index mask utility This may lead to improved performance from multithreading as well. =================================================================== M source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc =================================================================== 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( _______________________________________________ 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