Cleanup: Add type aliases for Multires and Dyntopo neighbor vectors
Pull Request: https://projects.blender.org/blender/blender/pulls/136701
This commit is contained in:
@@ -227,8 +227,9 @@ void BKE_subdiv_ccg_topology_counters(const SubdivCCG &subdiv_ccg,
|
||||
int &r_num_faces,
|
||||
int &r_num_loops);
|
||||
|
||||
using SubdivCCGNeighborCoords = blender::Vector<SubdivCCGCoord, 256>;
|
||||
struct SubdivCCGNeighbors {
|
||||
blender::Vector<SubdivCCGCoord, 256> coords;
|
||||
SubdivCCGNeighborCoords coords;
|
||||
int num_duplicates;
|
||||
|
||||
blender::Span<SubdivCCGCoord> unique() const
|
||||
|
||||
@@ -134,7 +134,7 @@ BLI_NOINLINE static void calc_neighbor_influence(const Span<float3> positions,
|
||||
const Set<BMVert *, 0> &verts,
|
||||
const MutableSpan<float3> translations)
|
||||
{
|
||||
Vector<BMVert *, 64> neighbors;
|
||||
BMeshNeighborVerts neighbors;
|
||||
int i = 0;
|
||||
for (BMVert *vert : verts) {
|
||||
const float3 &position = positions[i];
|
||||
|
||||
@@ -1102,7 +1102,7 @@ static void grow_shrink_visibility_bmesh(const Depsgraph &depsgraph,
|
||||
UNUSED_VARS(i);
|
||||
const Array<bool> prev_visibility = duplicate_visibility_bmesh(object);
|
||||
partialvis_update_bmesh_nodes(depsgraph, object, node_mask, action, [&](BMVert *vert) {
|
||||
Vector<BMVert *, 64> neighbors;
|
||||
BMeshNeighborVerts neighbors;
|
||||
for (BMVert *neighbor : vert_neighbors_get_bmesh(*vert, neighbors)) {
|
||||
if (prev_visibility[BM_elem_index_get(neighbor)] == action_to_hide(action)) {
|
||||
return true;
|
||||
|
||||
@@ -178,7 +178,7 @@ void average_neighbor_mask_bmesh(const int mask_offset,
|
||||
const Set<BMVert *, 0> &verts,
|
||||
const MutableSpan<float> new_masks)
|
||||
{
|
||||
Vector<BMVert *, 64> neighbors;
|
||||
BMeshNeighborVerts neighbors;
|
||||
int i = 0;
|
||||
for (BMVert *vert : verts) {
|
||||
new_masks[i] = average_masks(mask_offset, vert_neighbors_get_bmesh(*vert, neighbors));
|
||||
|
||||
@@ -382,7 +382,7 @@ bool vert_has_unique_face_set(const int /*face_set_offset*/, const BMVert & /*ve
|
||||
|
||||
} // namespace face_set
|
||||
|
||||
Span<BMVert *> vert_neighbors_get_bmesh(BMVert &vert, Vector<BMVert *, 64> &r_neighbors)
|
||||
Span<BMVert *> vert_neighbors_get_bmesh(BMVert &vert, BMeshNeighborVerts &r_neighbors)
|
||||
{
|
||||
r_neighbors.clear();
|
||||
BMIter liter;
|
||||
@@ -397,7 +397,7 @@ Span<BMVert *> vert_neighbors_get_bmesh(BMVert &vert, Vector<BMVert *, 64> &r_ne
|
||||
return r_neighbors;
|
||||
}
|
||||
|
||||
Span<BMVert *> vert_neighbors_get_interior_bmesh(BMVert &vert, Vector<BMVert *, 64> &r_neighbors)
|
||||
Span<BMVert *> vert_neighbors_get_interior_bmesh(BMVert &vert, BMeshNeighborVerts &r_neighbors)
|
||||
{
|
||||
r_neighbors.clear();
|
||||
BMIter liter;
|
||||
@@ -7769,7 +7769,7 @@ GroupedSpan<BMVert *> calc_vert_neighbors(Set<BMVert *, 0> verts,
|
||||
r_offset_data.resize(verts.size() + 1);
|
||||
r_data.clear();
|
||||
|
||||
Vector<BMVert *, 64> neighbor_data;
|
||||
BMeshNeighborVerts neighbor_data;
|
||||
int i = 0;
|
||||
for (BMVert *vert : verts) {
|
||||
r_offset_data[i] = r_data.size();
|
||||
@@ -7925,7 +7925,7 @@ void calc_vert_neighbors_interior(const Set<BMVert *, 0> &verts,
|
||||
MutableSpan<Vector<BMVert *>> result)
|
||||
{
|
||||
BLI_assert(verts.size() == result.size());
|
||||
Vector<BMVert *, 64> neighbor_data;
|
||||
BMeshNeighborVerts neighbor_data;
|
||||
|
||||
int i = 0;
|
||||
for (BMVert *vert : verts) {
|
||||
|
||||
@@ -509,7 +509,7 @@ static void calc_blurred_cavity_bmesh(const Cache &automasking,
|
||||
|
||||
const float3 starting_position = vert->co;
|
||||
|
||||
Vector<BMVert *, 64> neighbors;
|
||||
BMeshNeighborVerts neighbors;
|
||||
while (!queue.empty()) {
|
||||
const CavityBlurVert blurvert = queue.front();
|
||||
queue.pop();
|
||||
@@ -1472,7 +1472,7 @@ static void init_boundary_masking_bmesh(Object &object,
|
||||
}
|
||||
}
|
||||
|
||||
Vector<BMVert *, 64> neighbors;
|
||||
BMeshNeighborVerts neighbors;
|
||||
for (const int propagation_it : IndexRange(propagation_steps)) {
|
||||
for (const int i : IndexRange(num_verts)) {
|
||||
if (edge_distance[i] != EDGE_DISTANCE_INF) {
|
||||
|
||||
@@ -131,7 +131,7 @@ static bool is_vert_in_editable_boundary_bmesh(BMVert &initial_vert)
|
||||
int neighbor_count = 0;
|
||||
int boundary_vertex_count = 0;
|
||||
|
||||
Vector<BMVert *, 64> neighbors;
|
||||
BMeshNeighborVerts neighbors;
|
||||
for (BMVert *neighbor : vert_neighbors_get_bmesh(initial_vert, neighbors)) {
|
||||
if (!BM_elem_flag_test(neighbor, BM_ELEM_HIDDEN)) {
|
||||
neighbor_count++;
|
||||
@@ -696,7 +696,7 @@ static void edit_data_init_bmesh(BMesh *bm,
|
||||
|
||||
const int from_v_i = BM_elem_index_get(from_v);
|
||||
|
||||
Vector<BMVert *, 64> neighbors;
|
||||
BMeshNeighborVerts neighbors;
|
||||
for (BMVert *neighbor : vert_neighbors_get_bmesh(*from_v, neighbors)) {
|
||||
const int neighbor_idx = BM_elem_index_get(neighbor);
|
||||
if (BM_elem_flag_test(neighbor, BM_ELEM_HIDDEN) ||
|
||||
|
||||
@@ -158,7 +158,7 @@ static GroupedSpan<int> calc_vert_neighbor_indices_bmesh(const BMesh &bm,
|
||||
Vector<int> &r_offset_data,
|
||||
Vector<int> &r_data)
|
||||
{
|
||||
Vector<BMVert *, 64> neighbors;
|
||||
BMeshNeighborVerts neighbors;
|
||||
|
||||
r_offset_data.resize(verts.size() + 1);
|
||||
r_data.clear();
|
||||
|
||||
@@ -633,7 +633,7 @@ static void dyntopo_detail_size_sample_from_surface(Object &ob,
|
||||
BMVert *active_vertex = std::get<BMVert *>(ss.active_vert());
|
||||
|
||||
float len_accum = 0;
|
||||
Vector<BMVert *, 64> neighbors;
|
||||
BMeshNeighborVerts neighbors;
|
||||
for (BMVert *neighbor : vert_neighbors_get_bmesh(*active_vertex, neighbors)) {
|
||||
len_accum += len_v3v3(active_vertex->co, neighbor->co);
|
||||
}
|
||||
|
||||
@@ -513,7 +513,7 @@ static IndexMask boundary_from_enabled(Object &object,
|
||||
case bke::pbvh::Type::BMesh: {
|
||||
return IndexMask::from_predicate(enabled_mask, GrainSize(1024), memory, [&](const int vert) {
|
||||
BMVert *bm_vert = BM_vert_at_index(ss.bm, vert);
|
||||
Vector<BMVert *, 64> neighbors;
|
||||
BMeshNeighborVerts neighbors;
|
||||
for (const BMVert *neighbor : vert_neighbors_get_bmesh(*bm_vert, neighbors)) {
|
||||
if (!enabled_verts[BM_elem_index_get(neighbor)]) {
|
||||
return true;
|
||||
|
||||
@@ -606,7 +606,7 @@ static void grow_mask_bmesh(const int mask_offset,
|
||||
{
|
||||
const Set<BMVert *, 0> &verts = BKE_pbvh_bmesh_node_unique_verts(&node);
|
||||
|
||||
Vector<BMVert *, 64> neighbors;
|
||||
BMeshNeighborVerts neighbors;
|
||||
int i = 0;
|
||||
for (BMVert *vert : verts) {
|
||||
new_mask[i] = BM_ELEM_CD_GET_FLOAT(vert, mask_offset);
|
||||
@@ -625,7 +625,7 @@ static void shrink_mask_bmesh(const int mask_offset,
|
||||
{
|
||||
const Set<BMVert *, 0> &verts = BKE_pbvh_bmesh_node_unique_verts(&node);
|
||||
|
||||
Vector<BMVert *, 64> neighbors;
|
||||
BMeshNeighborVerts neighbors;
|
||||
int i = 0;
|
||||
for (BMVert *vert : verts) {
|
||||
new_mask[i] = BM_ELEM_CD_GET_FLOAT(vert, mask_offset);
|
||||
|
||||
@@ -1752,7 +1752,7 @@ static void calc_sharpen_filter(const Depsgraph &depsgraph,
|
||||
tls.translations.resize(verts.size());
|
||||
const MutableSpan<float3> translations = tls.translations;
|
||||
|
||||
Vector<BMVert *, 64> neighbors;
|
||||
BMeshNeighborVerts neighbors;
|
||||
|
||||
int i = 0;
|
||||
for (BMVert *vert : verts) {
|
||||
|
||||
@@ -165,7 +165,7 @@ void FillDataGrids::execute(
|
||||
void FillDataBMesh::execute(Object &object, FunctionRef<bool(BMVert *from_v, BMVert *to_v)> func)
|
||||
{
|
||||
BMesh *bm = object.sculpt->bm;
|
||||
Vector<BMVert *, 64> neighbors;
|
||||
BMeshNeighborVerts neighbors;
|
||||
while (!this->queue.empty()) {
|
||||
BMVert *from_v = this->queue.front();
|
||||
this->queue.pop();
|
||||
|
||||
@@ -551,8 +551,9 @@ namespace blender::ed::sculpt_paint {
|
||||
*/
|
||||
Span<float3> vert_positions_for_grab_active_get(const Depsgraph &depsgraph, const Object &object);
|
||||
|
||||
Span<BMVert *> vert_neighbors_get_bmesh(BMVert &vert, Vector<BMVert *, 64> &r_neighbors);
|
||||
Span<BMVert *> vert_neighbors_get_interior_bmesh(BMVert &vert, Vector<BMVert *, 64> &r_neighbors);
|
||||
using BMeshNeighborVerts = Vector<BMVert *, 64>;
|
||||
Span<BMVert *> vert_neighbors_get_bmesh(BMVert &vert, BMeshNeighborVerts &r_neighbors);
|
||||
Span<BMVert *> vert_neighbors_get_interior_bmesh(BMVert &vert, BMeshNeighborVerts &r_neighbors);
|
||||
|
||||
Span<int> vert_neighbors_get_mesh(OffsetIndices<int> faces,
|
||||
Span<int> corner_verts,
|
||||
|
||||
@@ -467,7 +467,7 @@ static void grow_factors_bmesh(const ePaintSymmetryFlags symm,
|
||||
{
|
||||
const Set<BMVert *, 0> &verts = BKE_pbvh_bmesh_node_unique_verts(&node);
|
||||
|
||||
Vector<BMVert *, 64> neighbors;
|
||||
BMeshNeighborVerts neighbors;
|
||||
|
||||
for (BMVert *bm_vert : verts) {
|
||||
const int vert = BM_elem_index_get(bm_vert);
|
||||
@@ -1370,7 +1370,7 @@ static std::unique_ptr<IKChain> ik_chain_init_face_sets_bmesh(Object &object,
|
||||
SegmentData current_data = {std::get<BMVert *>(ss.active_vert()), SCULPT_FACE_SET_NONE};
|
||||
|
||||
const int symm = SCULPT_mesh_symmetry_xyz_get(object);
|
||||
Vector<BMVert *, 64> neighbors;
|
||||
BMeshNeighborVerts neighbors;
|
||||
for (const int i : ik_chain->segments.index_range()) {
|
||||
const bool is_first_iteration = i == 0;
|
||||
|
||||
|
||||
@@ -242,7 +242,7 @@ void average_data_grids(const SubdivCCG &subdiv_ccg,
|
||||
template<typename T>
|
||||
void average_data_bmesh(const Span<T> src, const Set<BMVert *, 0> &verts, const MutableSpan<T> dst)
|
||||
{
|
||||
Vector<BMVert *, 64> neighbor_data;
|
||||
BMeshNeighborVerts neighbor_data;
|
||||
|
||||
int i = 0;
|
||||
for (BMVert *vert : verts) {
|
||||
@@ -285,7 +285,7 @@ void neighbor_position_average_bmesh(const Set<BMVert *, 0> &verts,
|
||||
const MutableSpan<float3> new_positions)
|
||||
{
|
||||
BLI_assert(verts.size() == new_positions.size());
|
||||
Vector<BMVert *, 64> neighbor_data;
|
||||
BMeshNeighborVerts neighbor_data;
|
||||
|
||||
int i = 0;
|
||||
for (BMVert *vert : verts) {
|
||||
@@ -304,7 +304,7 @@ static void neighbor_position_average_interior_bmesh_impl(const Set<BMVert *, 0>
|
||||
if constexpr (use_factors) {
|
||||
BLI_assert(new_positions.size() == factors.size());
|
||||
}
|
||||
Vector<BMVert *, 64> neighbor_data;
|
||||
BMeshNeighborVerts neighbor_data;
|
||||
|
||||
int i = 0;
|
||||
for (BMVert *vert : verts) {
|
||||
@@ -598,7 +598,7 @@ void calc_relaxed_translations_grids(const SubdivCCG &subdiv_ccg,
|
||||
|
||||
SubdivCCGNeighbors neighbor_storage;
|
||||
BKE_subdiv_ccg_neighbor_coords_get(subdiv_ccg, coord, false, neighbor_storage);
|
||||
Vector<SubdivCCGCoord, 256> &neighbors = neighbor_storage.coords;
|
||||
SubdivCCGNeighborCoords &neighbors = neighbor_storage.coords;
|
||||
|
||||
/* Don't modify corner vertices */
|
||||
if (neighbors.size() <= 2) {
|
||||
@@ -662,7 +662,7 @@ void calc_relaxed_translations_bmesh(const Set<BMVert *, 0> &verts,
|
||||
BLI_assert(verts.size() == factors.size());
|
||||
BLI_assert(verts.size() == translations.size());
|
||||
|
||||
Vector<BMVert *, 64> neighbors;
|
||||
BMeshNeighborVerts neighbors;
|
||||
|
||||
int i = 0;
|
||||
for (BMVert *vert : verts) {
|
||||
|
||||
Reference in New Issue
Block a user