From c2c369ebe693456b7048b3908f342f5667e0fd03 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 8 Sep 2022 11:22:30 +1000 Subject: Cleanup: prefer terms verts/polys over vertices/polygons Follows existing naming for the most part, also use "num" as a suffix in some instances (following our naming conventions). --- source/blender/editors/mesh/editface.cc | 12 +- .../blender/editors/mesh/editmesh_extrude_screw.c | 6 +- source/blender/editors/object/object_remesh.cc | 4 +- .../editors/sculpt_paint/paint_vertex_color_ops.cc | 4 +- source/blender/editors/sculpt_paint/sculpt.c | 14 +-- .../blender/editors/sculpt_paint/sculpt_boundary.c | 131 ++++++++++----------- .../blender/editors/sculpt_paint/sculpt_expand.c | 102 ++++++++-------- .../blender/editors/sculpt_paint/sculpt_face_set.c | 18 +-- .../blender/editors/sculpt_paint/sculpt_geodesic.c | 43 ++++--- .../blender/editors/sculpt_paint/sculpt_intern.h | 4 +- source/blender/editors/sculpt_paint/sculpt_ops.c | 27 ++--- source/blender/editors/sculpt_paint/sculpt_undo.c | 56 ++++----- source/blender/editors/space_info/info_stats.cc | 2 +- .../blender/editors/space_view3d/view3d_select.cc | 11 +- 14 files changed, 215 insertions(+), 219 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/mesh/editface.cc b/source/blender/editors/mesh/editface.cc index 26184acc8b4..68a30b0cd77 100644 --- a/source/blender/editors/mesh/editface.cc +++ b/source/blender/editors/mesh/editface.cc @@ -494,21 +494,21 @@ void paintvert_flush_flags(Object *ob) index_array = (const int *)CustomData_get_layer(&me_eval->vdata, CD_ORIGINDEX); - const Span vertices = me->verts_for_write(); - MutableSpan vertices_eval = me_eval->verts_for_write(); + const Span verts = me->verts_for_write(); + MutableSpan verts_eval = me_eval->verts_for_write(); if (index_array) { int orig_index; - for (const int i : vertices_eval.index_range()) { + for (const int i : verts_eval.index_range()) { orig_index = index_array[i]; if (orig_index != ORIGINDEX_NONE) { - vertices_eval[i].flag = vertices[index_array[i]].flag; + verts_eval[i].flag = verts[index_array[i]].flag; } } } else { - for (const int i : vertices_eval.index_range()) { - vertices_eval[i].flag = vertices[i].flag; + for (const int i : verts_eval.index_range()) { + verts_eval[i].flag = verts[i].flag; } } diff --git a/source/blender/editors/mesh/editmesh_extrude_screw.c b/source/blender/editors/mesh/editmesh_extrude_screw.c index cc493cab0f9..5addd67ab58 100644 --- a/source/blender/editors/mesh/editmesh_extrude_screw.c +++ b/source/blender/editors/mesh/editmesh_extrude_screw.c @@ -41,7 +41,7 @@ static int edbm_screw_exec(bContext *C, wmOperator *op) int valence; uint objects_empty_len = 0; uint failed_axis_len = 0; - uint failed_vertices_len = 0; + uint failed_verts_len = 0; turns = RNA_int_get(op->ptr, "turns"); steps = RNA_int_get(op->ptr, "steps"); @@ -97,7 +97,7 @@ static int edbm_screw_exec(bContext *C, wmOperator *op) } if (v1 == NULL || v2 == NULL) { - failed_vertices_len++; + failed_verts_len++; continue; } @@ -151,7 +151,7 @@ static int edbm_screw_exec(bContext *C, wmOperator *op) if (failed_axis_len == objects_len - objects_empty_len) { BKE_report(op->reports, RPT_ERROR, "Invalid/unset axis"); } - else if (failed_vertices_len == objects_len - objects_empty_len) { + else if (failed_verts_len == objects_len - objects_empty_len) { BKE_report(op->reports, RPT_ERROR, "You have to select a string of connected vertices too"); } diff --git a/source/blender/editors/object/object_remesh.cc b/source/blender/editors/object/object_remesh.cc index c93d7dc3ee5..09489c50e9d 100644 --- a/source/blender/editors/object/object_remesh.cc +++ b/source/blender/editors/object/object_remesh.cc @@ -131,8 +131,8 @@ static int voxel_remesh_exec(bContext *C, wmOperator *op) } /* Output mesh will be all smooth or all flat shading. */ - const Span polygons = mesh->polys(); - const bool smooth_normals = polygons.first().flag & ME_SMOOTH; + const Span polys = mesh->polys(); + const bool smooth_normals = polys.first().flag & ME_SMOOTH; float isovalue = 0.0f; if (mesh->flag & ME_REMESH_REPROJECT_VOLUME) { diff --git a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.cc b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.cc index 006ceb5f136..8f11774a16b 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.cc +++ b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.cc @@ -186,7 +186,7 @@ static IndexMask get_selected_indices(const Mesh &mesh, return IndexMask(attributes.domain_size(domain)); } -static void face_corner_color_equalize_vertices(Mesh &mesh, const IndexMask selection) +static void face_corner_color_equalize_verts(Mesh &mesh, const IndexMask selection) { using namespace blender; @@ -221,7 +221,7 @@ static bool vertex_color_smooth(Object *ob) Vector indices; const IndexMask selection = get_selected_indices(*me, ATTR_DOMAIN_CORNER, indices); - face_corner_color_equalize_vertices(*me, selection); + face_corner_color_equalize_verts(*me, selection); tag_object_after_update(ob); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 5a17d42468e..51ff064c58d 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -116,7 +116,7 @@ int SCULPT_vertex_count_get(SculptSession *ss) case PBVH_BMESH: return BM_mesh_elem_count(BKE_pbvh_get_bmesh(ss->pbvh), BM_VERT); case PBVH_GRIDS: - return BKE_pbvh_get_grid_num_vertices(ss->pbvh); + return BKE_pbvh_get_grid_num_verts(ss->pbvh); } return 0; @@ -562,7 +562,7 @@ bool SCULPT_vertex_has_face_set(SculptSession *ss, PBVHVertRef vertex, int face_ return true; } -void SCULPT_visibility_sync_all_face_sets_to_vertices(Object *ob) +void SCULPT_visibility_sync_all_face_sets_to_verts(Object *ob) { SculptSession *ss = ob->sculpt; Mesh *mesh = BKE_object_get_original_mesh(ob); @@ -1102,7 +1102,7 @@ void SCULPT_floodfill_init(SculptSession *ss, SculptFloodFill *flood) SCULPT_vertex_random_access_ensure(ss); flood->queue = BLI_gsqueue_new(sizeof(intptr_t)); - flood->visited_vertices = BLI_BITMAP_NEW(vertex_count, "visited vertices"); + flood->visited_verts = BLI_BITMAP_NEW(vertex_count, "visited verts"); } void SCULPT_floodfill_add_initial(SculptFloodFill *flood, PBVHVertRef vertex) @@ -1113,7 +1113,7 @@ void SCULPT_floodfill_add_initial(SculptFloodFill *flood, PBVHVertRef vertex) void SCULPT_floodfill_add_and_skip_initial(SculptFloodFill *flood, PBVHVertRef vertex) { BLI_gsqueue_push(flood->queue, &vertex); - BLI_BITMAP_ENABLE(flood->visited_vertices, vertex.i); + BLI_BITMAP_ENABLE(flood->visited_verts, vertex.i); } void SCULPT_floodfill_add_initial_with_symmetry(Sculpt *sd, @@ -1192,7 +1192,7 @@ void SCULPT_floodfill_execute(SculptSession *ss, const PBVHVertRef to_v = ni.vertex; int to_v_i = BKE_pbvh_vertex_to_index(ss->pbvh, to_v); - if (BLI_BITMAP_TEST(flood->visited_vertices, to_v_i)) { + if (BLI_BITMAP_TEST(flood->visited_verts, to_v_i)) { continue; } @@ -1200,7 +1200,7 @@ void SCULPT_floodfill_execute(SculptSession *ss, continue; } - BLI_BITMAP_ENABLE(flood->visited_vertices, BKE_pbvh_vertex_to_index(ss->pbvh, to_v)); + BLI_BITMAP_ENABLE(flood->visited_verts, BKE_pbvh_vertex_to_index(ss->pbvh, to_v)); if (func(ss, from_v, to_v, ni.is_duplicate, userdata)) { BLI_gsqueue_push(flood->queue, &to_v); @@ -1212,7 +1212,7 @@ void SCULPT_floodfill_execute(SculptSession *ss, void SCULPT_floodfill_free(SculptFloodFill *flood) { - MEM_SAFE_FREE(flood->visited_vertices); + MEM_SAFE_FREE(flood->visited_verts); BLI_gsqueue_free(flood->queue); flood->queue = NULL; } diff --git a/source/blender/editors/sculpt_paint/sculpt_boundary.c b/source/blender/editors/sculpt_paint/sculpt_boundary.c index 93da767e3c5..005892b88a0 100644 --- a/source/blender/editors/sculpt_paint/sculpt_boundary.c +++ b/source/blender/editors/sculpt_paint/sculpt_boundary.c @@ -128,22 +128,22 @@ static void sculpt_boundary_index_add(SculptBoundary *boundary, const PBVHVertRef new_vertex, const int new_index, const float distance, - GSet *included_vertices) + GSet *included_verts) { - boundary->vertices[boundary->num_vertices] = new_vertex; + boundary->verts[boundary->verts_num] = new_vertex; if (boundary->distance) { boundary->distance[new_index] = distance; } - if (included_vertices) { - BLI_gset_add(included_vertices, POINTER_FROM_INT(new_index)); + if (included_verts) { + BLI_gset_add(included_verts, POINTER_FROM_INT(new_index)); } - boundary->num_vertices++; - if (boundary->num_vertices >= boundary->vertices_capacity) { - boundary->vertices_capacity += BOUNDARY_INDICES_BLOCK_SIZE; - boundary->vertices = MEM_reallocN_id( - boundary->vertices, boundary->vertices_capacity * sizeof(PBVHVertRef), "boundary indices"); + boundary->verts_num++; + if (boundary->verts_num >= boundary->verts_capacity) { + boundary->verts_capacity += BOUNDARY_INDICES_BLOCK_SIZE; + boundary->verts = MEM_reallocN_id( + boundary->verts, boundary->verts_capacity * sizeof(PBVHVertRef), "boundary indices"); } }; @@ -152,11 +152,11 @@ static void sculpt_boundary_preview_edge_add(SculptBoundary *boundary, const PBVHVertRef v2) { - boundary->edges[boundary->num_edges].v1 = v1; - boundary->edges[boundary->num_edges].v2 = v2; - boundary->num_edges++; + boundary->edges[boundary->edges_num].v1 = v1; + boundary->edges[boundary->edges_num].v2 = v2; + boundary->edges_num++; - if (boundary->num_edges >= boundary->edges_capacity) { + if (boundary->edges_num >= boundary->edges_capacity) { boundary->edges_capacity += BOUNDARY_INDICES_BLOCK_SIZE; boundary->edges = MEM_reallocN_id(boundary->edges, boundary->edges_capacity * sizeof(SculptBoundaryPreviewEdge), @@ -209,7 +209,7 @@ static bool sculpt_boundary_is_vertex_in_editable_boundary(SculptSession *ss, typedef struct BoundaryFloodFillData { SculptBoundary *boundary; - GSet *included_vertices; + GSet *included_verts; EdgeSet *preview_edges; PBVHVertRef last_visited_vertex; @@ -233,7 +233,7 @@ static bool boundary_floodfill_cb( boundary->distance[from_v_i] + edge_len : 0.0f; sculpt_boundary_index_add( - boundary, to_v, to_v_i, distance_boundary_to_dst, data->included_vertices); + boundary, to_v, to_v_i, distance_boundary_to_dst, data->included_verts); if (!is_duplicate) { sculpt_boundary_preview_edge_add(boundary, from_v, to_v); } @@ -247,7 +247,7 @@ static void sculpt_boundary_indices_init(SculptSession *ss, { const int totvert = SCULPT_vertex_count_get(ss); - boundary->vertices = MEM_malloc_arrayN( + boundary->verts = MEM_malloc_arrayN( BOUNDARY_INDICES_BLOCK_SIZE, sizeof(PBVHVertRef), "boundary indices"); if (init_boundary_distances) { @@ -256,7 +256,7 @@ static void sculpt_boundary_indices_init(SculptSession *ss, boundary->edges = MEM_malloc_arrayN( BOUNDARY_INDICES_BLOCK_SIZE, sizeof(SculptBoundaryPreviewEdge), "boundary edges"); - GSet *included_vertices = BLI_gset_int_new_ex("included vertices", BOUNDARY_INDICES_BLOCK_SIZE); + GSet *included_verts = BLI_gset_int_new_ex("included verts", BOUNDARY_INDICES_BLOCK_SIZE); SculptFloodFill flood; SCULPT_floodfill_init(ss, &flood); @@ -268,12 +268,12 @@ static void sculpt_boundary_indices_init(SculptSession *ss, copy_v3_v3(boundary->initial_vertex_position, SCULPT_vertex_co_get(ss, boundary->initial_vertex)); sculpt_boundary_index_add( - boundary, initial_boundary_vertex, initial_boundary_index, 0.0f, included_vertices); + boundary, initial_boundary_vertex, initial_boundary_index, 0.0f, included_verts); SCULPT_floodfill_add_initial(&flood, boundary->initial_vertex); BoundaryFloodFillData fdata = { .boundary = boundary, - .included_vertices = included_vertices, + .included_verts = included_verts, .last_visited_vertex = {BOUNDARY_VERTEX_NONE}, }; @@ -286,7 +286,7 @@ static void sculpt_boundary_indices_init(SculptSession *ss, sculpt_boundary_is_vertex_in_editable_boundary(ss, fdata.last_visited_vertex)) { SculptVertexNeighborIter ni; SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, fdata.last_visited_vertex, ni) { - if (BLI_gset_haskey(included_vertices, POINTER_FROM_INT(ni.index)) && + if (BLI_gset_haskey(included_verts, POINTER_FROM_INT(ni.index)) && sculpt_boundary_is_vertex_in_editable_boundary(ss, ni.vertex)) { sculpt_boundary_preview_edge_add(boundary, fdata.last_visited_vertex, ni.vertex); boundary->forms_loop = true; @@ -295,7 +295,7 @@ static void sculpt_boundary_indices_init(SculptSession *ss, SCULPT_VERTEX_NEIGHBORS_ITER_END(ni); } - BLI_gset_free(included_vertices, NULL); + BLI_gset_free(included_verts, NULL); } /** @@ -318,7 +318,7 @@ static void sculpt_boundary_edit_data_init(SculptSession *ss, for (int i = 0; i < totvert; i++) { boundary->edit_info[i].original_vertex_i = BOUNDARY_VERTEX_NONE; - boundary->edit_info[i].num_propagation_steps = BOUNDARY_STEPS_NONE; + boundary->edit_info[i].propagation_steps_num = BOUNDARY_STEPS_NONE; } GSQueue *current_iteration = BLI_gsqueue_new(sizeof(PBVHVertRef)); @@ -326,38 +326,38 @@ static void sculpt_boundary_edit_data_init(SculptSession *ss, /* Initialized the first iteration with the vertices already in the boundary. This is propagation * step 0. */ - BLI_bitmap *visited_vertices = BLI_BITMAP_NEW(SCULPT_vertex_count_get(ss), "visited_vertices"); - for (int i = 0; i < boundary->num_vertices; i++) { - int index = BKE_pbvh_vertex_to_index(ss->pbvh, boundary->vertices[i]); + BLI_bitmap *visited_verts = BLI_BITMAP_NEW(SCULPT_vertex_count_get(ss), "visited_verts"); + for (int i = 0; i < boundary->verts_num; i++) { + int index = BKE_pbvh_vertex_to_index(ss->pbvh, boundary->verts[i]); boundary->edit_info[index].original_vertex_i = BKE_pbvh_vertex_to_index(ss->pbvh, - boundary->vertices[i]); - boundary->edit_info[index].num_propagation_steps = 0; + boundary->verts[i]); + boundary->edit_info[index].propagation_steps_num = 0; /* This ensures that all duplicate vertices in the boundary have the same original_vertex * index, so the deformation for them will be the same. */ if (has_duplicates) { SculptVertexNeighborIter ni_duplis; - SCULPT_VERTEX_DUPLICATES_AND_NEIGHBORS_ITER_BEGIN (ss, boundary->vertices[i], ni_duplis) { + SCULPT_VERTEX_DUPLICATES_AND_NEIGHBORS_ITER_BEGIN (ss, boundary->verts[i], ni_duplis) { if (ni_duplis.is_duplicate) { boundary->edit_info[ni_duplis.index].original_vertex_i = BKE_pbvh_vertex_to_index( - ss->pbvh, boundary->vertices[i]); + ss->pbvh, boundary->verts[i]); } } SCULPT_VERTEX_NEIGHBORS_ITER_END(ni_duplis); } - BLI_gsqueue_push(current_iteration, &boundary->vertices[i]); + BLI_gsqueue_push(current_iteration, &boundary->verts[i]); } - int num_propagation_steps = 0; + int propagation_steps_num = 0; float accum_distance = 0.0f; while (true) { /* Stop adding steps to edit info. This happens when a steps is further away from the boundary * than the brush radius or when the entire mesh was already processed. */ if (accum_distance > radius || BLI_gsqueue_is_empty(current_iteration)) { - boundary->max_propagation_steps = num_propagation_steps; + boundary->max_propagation_steps = propagation_steps_num; break; } @@ -371,22 +371,22 @@ static void sculpt_boundary_edit_data_init(SculptSession *ss, SCULPT_VERTEX_DUPLICATES_AND_NEIGHBORS_ITER_BEGIN (ss, from_v, ni) { const bool is_visible = SCULPT_vertex_visible_get(ss, ni.vertex); if (!is_visible || - boundary->edit_info[ni.index].num_propagation_steps != BOUNDARY_STEPS_NONE) { + boundary->edit_info[ni.index].propagation_steps_num != BOUNDARY_STEPS_NONE) { continue; } boundary->edit_info[ni.index].original_vertex_i = boundary->edit_info[from_v_i].original_vertex_i; - BLI_BITMAP_ENABLE(visited_vertices, ni.index); + BLI_BITMAP_ENABLE(visited_verts, ni.index); if (ni.is_duplicate) { /* Grids duplicates handling. */ - boundary->edit_info[ni.index].num_propagation_steps = - boundary->edit_info[from_v_i].num_propagation_steps; + boundary->edit_info[ni.index].propagation_steps_num = + boundary->edit_info[from_v_i].propagation_steps_num; } else { - boundary->edit_info[ni.index].num_propagation_steps = - boundary->edit_info[from_v_i].num_propagation_steps + 1; + boundary->edit_info[ni.index].propagation_steps_num = + boundary->edit_info[from_v_i].propagation_steps_num + 1; BLI_gsqueue_push(next_iteration, &ni.vertex); @@ -400,8 +400,8 @@ static void sculpt_boundary_edit_data_init(SculptSession *ss, if (ni_duplis.is_duplicate) { boundary->edit_info[ni_duplis.index].original_vertex_i = boundary->edit_info[from_v_i].original_vertex_i; - boundary->edit_info[ni_duplis.index].num_propagation_steps = - boundary->edit_info[from_v_i].num_propagation_steps + 1; + boundary->edit_info[ni_duplis.index].propagation_steps_num = + boundary->edit_info[from_v_i].propagation_steps_num + 1; } } SCULPT_VERTEX_NEIGHBORS_ITER_END(ni_duplis); @@ -428,10 +428,10 @@ static void sculpt_boundary_edit_data_init(SculptSession *ss, BLI_gsqueue_push(current_iteration, &next_v); } - num_propagation_steps++; + propagation_steps_num++; } - MEM_SAFE_FREE(visited_vertices); + MEM_SAFE_FREE(visited_verts); BLI_gsqueue_free(current_iteration); BLI_gsqueue_free(next_iteration); @@ -449,9 +449,9 @@ static void sculpt_boundary_falloff_factor_init(SculptSession *ss, BKE_curvemapping_init(brush->curve); for (int i = 0; i < totvert; i++) { - if (boundary->edit_info[i].num_propagation_steps != -1) { + if (boundary->edit_info[i].propagation_steps_num != -1) { boundary->edit_info[i].strength_factor = BKE_brush_curve_strength( - brush, boundary->edit_info[i].num_propagation_steps, boundary->max_propagation_steps); + brush, boundary->edit_info[i].propagation_steps_num, boundary->max_propagation_steps); } if (boundary->edit_info[i].original_vertex_i == @@ -542,7 +542,7 @@ SculptBoundary *SCULPT_boundary_data_init(Object *object, void SCULPT_boundary_data_free(SculptBoundary *boundary) { - MEM_SAFE_FREE(boundary->vertices); + MEM_SAFE_FREE(boundary->verts); MEM_SAFE_FREE(boundary->edges); MEM_SAFE_FREE(boundary->distance); MEM_SAFE_FREE(boundary->edit_info); @@ -564,7 +564,7 @@ static void sculpt_boundary_bend_data_init(SculptSession *ss, SculptBoundary *bo boundary->bend.pivot_positions = MEM_calloc_arrayN(totvert, sizeof(float[3]), "pivot positions"); for (int i = 0; i < totvert; i++) { - if (boundary->edit_info[i].num_propagation_steps != boundary->max_propagation_steps) { + if (boundary->edit_info[i].propagation_steps_num != boundary->max_propagation_steps) { continue; } @@ -586,7 +586,7 @@ static void sculpt_boundary_bend_data_init(SculptSession *ss, SculptBoundary *bo } for (int i = 0; i < totvert; i++) { - if (boundary->edit_info[i].num_propagation_steps == BOUNDARY_STEPS_NONE) { + if (boundary->edit_info[i].propagation_steps_num == BOUNDARY_STEPS_NONE) { continue; } copy_v3_v3(boundary->bend.pivot_positions[i], @@ -602,7 +602,7 @@ static void sculpt_boundary_slide_data_init(SculptSession *ss, SculptBoundary *b boundary->slide.directions = MEM_calloc_arrayN(totvert, sizeof(float[3]), "slide directions"); for (int i = 0; i < totvert; i++) { - if (boundary->edit_info[i].num_propagation_steps != boundary->max_propagation_steps) { + if (boundary->edit_info[i].propagation_steps_num != boundary->max_propagation_steps) { continue; } sub_v3_v3v3( @@ -614,7 +614,7 @@ static void sculpt_boundary_slide_data_init(SculptSession *ss, SculptBoundary *b } for (int i = 0; i < totvert; i++) { - if (boundary->edit_info[i].num_propagation_steps == BOUNDARY_STEPS_NONE) { + if (boundary->edit_info[i].propagation_steps_num == BOUNDARY_STEPS_NONE) { continue; } copy_v3_v3(boundary->slide.directions[i], @@ -625,15 +625,14 @@ static void sculpt_boundary_slide_data_init(SculptSession *ss, SculptBoundary *b static void sculpt_boundary_twist_data_init(SculptSession *ss, SculptBoundary *boundary) { zero_v3(boundary->twist.pivot_position); - float(*poly_verts)[3] = MEM_malloc_arrayN( - boundary->num_vertices, sizeof(float[3]), "poly verts"); - for (int i = 0; i < boundary->num_vertices; i++) { - add_v3_v3(boundary->twist.pivot_position, SCULPT_vertex_co_get(ss, boundary->vertices[i])); - copy_v3_v3(poly_verts[i], SCULPT_vertex_co_get(ss, boundary->vertices[i])); + float(*poly_verts)[3] = MEM_malloc_arrayN(boundary->verts_num, sizeof(float[3]), "poly verts"); + for (int i = 0; i < boundary->verts_num; i++) { + add_v3_v3(boundary->twist.pivot_position, SCULPT_vertex_co_get(ss, boundary->verts[i])); + copy_v3_v3(poly_verts[i], SCULPT_vertex_co_get(ss, boundary->verts[i])); } - mul_v3_fl(boundary->twist.pivot_position, 1.0f / boundary->num_vertices); + mul_v3_fl(boundary->twist.pivot_position, 1.0f / boundary->verts_num); if (boundary->forms_loop) { - normal_poly_v3(boundary->twist.rotation_axis, poly_verts, boundary->num_vertices); + normal_poly_v3(boundary->twist.rotation_axis, poly_verts, boundary->verts_num); } else { sub_v3_v3v3(boundary->twist.rotation_axis, @@ -684,7 +683,7 @@ static void do_boundary_brush_bend_task_cb_ex(void *__restrict userdata, const float angle = angle_factor * M_PI; BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) { - if (boundary->edit_info[vd.index].num_propagation_steps == -1) { + if (boundary->edit_info[vd.index].propagation_steps_num == -1) { continue; } @@ -732,7 +731,7 @@ static void do_boundary_brush_slide_task_cb_ex(void *__restrict userdata, const float disp = sculpt_boundary_displacement_from_grab_delta_get(ss, boundary); BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) { - if (boundary->edit_info[vd.index].num_propagation_steps == -1) { + if (boundary->edit_info[vd.index].propagation_steps_num == -1) { continue; } @@ -778,7 +777,7 @@ static void do_boundary_brush_inflate_task_cb_ex(void *__restrict userdata, const float disp = sculpt_boundary_displacement_from_grab_delta_get(ss, boundary); BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) { - if (boundary->edit_info[vd.index].num_propagation_steps == -1) { + if (boundary->edit_info[vd.index].propagation_steps_num == -1) { continue; } @@ -822,7 +821,7 @@ static void do_boundary_brush_grab_task_cb_ex(void *__restrict userdata, SCULPT_orig_vert_data_init(&orig_data, data->ob, data->nodes[n], SCULPT_UNDO_COORDS); BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) { - if (boundary->edit_info[vd.index].num_propagation_steps == -1) { + if (boundary->edit_info[vd.index].propagation_steps_num == -1) { continue; } @@ -873,7 +872,7 @@ static void do_boundary_brush_twist_task_cb_ex(void *__restrict userdata, const float angle = angle_factor * M_PI; BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) { - if (boundary->edit_info[vd.index].num_propagation_steps == -1) { + if (boundary->edit_info[vd.index].propagation_steps_num == -1) { continue; } @@ -919,7 +918,7 @@ static void do_boundary_brush_smooth_task_cb_ex(void *__restrict userdata, SCULPT_orig_vert_data_init(&orig_data, data->ob, data->nodes[n], SCULPT_UNDO_COORDS); BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) { - if (boundary->edit_info[vd.index].num_propagation_steps == -1) { + if (boundary->edit_info[vd.index].propagation_steps_num == -1) { continue; } @@ -931,10 +930,10 @@ static void do_boundary_brush_smooth_task_cb_ex(void *__restrict userdata, float coord_accum[3] = {0.0f, 0.0f, 0.0f}; int total_neighbors = 0; - const int current_propagation_steps = boundary->edit_info[vd.index].num_propagation_steps; + const int current_propagation_steps = boundary->edit_info[vd.index].propagation_steps_num; SculptVertexNeighborIter ni; SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, vd.vertex, ni) { - if (current_propagation_steps == boundary->edit_info[ni.index].num_propagation_steps) { + if (current_propagation_steps == boundary->edit_info[ni.index].propagation_steps_num) { add_v3_v3(coord_accum, SCULPT_vertex_co_get(ss, ni.vertex)); total_neighbors++; } @@ -1053,8 +1052,8 @@ void SCULPT_boundary_edges_preview_draw(const uint gpuattr, } immUniformColor3fvAlpha(outline_col, outline_alpha); GPU_line_width(2.0f); - immBegin(GPU_PRIM_LINES, ss->boundary_preview->num_edges * 2); - for (int i = 0; i < ss->boundary_preview->num_edges; i++) { + immBegin(GPU_PRIM_LINES, ss->boundary_preview->edges_num * 2); + for (int i = 0; i < ss->boundary_preview->edges_num; i++) { immVertex3fv(gpuattr, SCULPT_vertex_co_get(ss, ss->boundary_preview->edges[i].v1)); immVertex3fv(gpuattr, SCULPT_vertex_co_get(ss, ss->boundary_preview->edges[i].v2)); } diff --git a/source/blender/editors/sculpt_paint/sculpt_expand.c b/source/blender/editors/sculpt_paint/sculpt_expand.c index 7c4c47261b3..4aafeacfbff 100644 --- a/source/blender/editors/sculpt_paint/sculpt_expand.c +++ b/source/blender/editors/sculpt_paint/sculpt_expand.c @@ -351,13 +351,13 @@ static float sculpt_expand_gradient_value_get(SculptSession *ss, static BLI_bitmap *sculpt_expand_bitmap_from_enabled(SculptSession *ss, ExpandCache *expand_cache) { const int totvert = SCULPT_vertex_count_get(ss); - BLI_bitmap *enabled_vertices = BLI_BITMAP_NEW(totvert, "enabled vertices"); + BLI_bitmap *enabled_verts = BLI_BITMAP_NEW(totvert, "enabled verts"); for (int i = 0; i < totvert; i++) { const bool enabled = sculpt_expand_state_get( ss, expand_cache, BKE_pbvh_index_to_vertex(ss->pbvh, i)); - BLI_BITMAP_SET(enabled_vertices, i, enabled); + BLI_BITMAP_SET(enabled_verts, i, enabled); } - return enabled_vertices; + return enabled_verts; } /** @@ -366,13 +366,13 @@ static BLI_bitmap *sculpt_expand_bitmap_from_enabled(SculptSession *ss, ExpandCa * vertex that is not enabled. */ static BLI_bitmap *sculpt_expand_boundary_from_enabled(SculptSession *ss, - const BLI_bitmap *enabled_vertices, + const BLI_bitmap *enabled_verts, const bool use_mesh_boundary) { const int totvert = SCULPT_vertex_count_get(ss); - BLI_bitmap *boundary_vertices = BLI_BITMAP_NEW(totvert, "boundary vertices"); + BLI_bitmap *boundary_verts = BLI_BITMAP_NEW(totvert, "boundary verts"); for (int i = 0; i < totvert; i++) { - if (!BLI_BITMAP_TEST(enabled_vertices, i)) { + if (!BLI_BITMAP_TEST(enabled_verts, i)) { continue; } @@ -381,7 +381,7 @@ static BLI_bitmap *sculpt_expand_boundary_from_enabled(SculptSession *ss, bool is_expand_boundary = false; SculptVertexNeighborIter ni; SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, vertex, ni) { - if (!BLI_BITMAP_TEST(enabled_vertices, ni.index)) { + if (!BLI_BITMAP_TEST(enabled_verts, ni.index)) { is_expand_boundary = true; } } @@ -391,10 +391,10 @@ static BLI_bitmap *sculpt_expand_boundary_from_enabled(SculptSession *ss, is_expand_boundary = true; } - BLI_BITMAP_SET(boundary_vertices, i, is_expand_boundary); + BLI_BITMAP_SET(boundary_verts, i, is_expand_boundary); } - return boundary_vertices; + return boundary_verts; } /* Functions implementing different algorithms for initializing falloff values. */ @@ -596,7 +596,7 @@ static float *sculpt_expand_boundary_topology_falloff_create(Object *ob, const P SculptSession *ss = ob->sculpt; const int totvert = SCULPT_vertex_count_get(ss); float *dists = MEM_calloc_arrayN(totvert, sizeof(float), "spherical dist"); - BLI_bitmap *visited_vertices = BLI_BITMAP_NEW(totvert, "visited vertices"); + BLI_bitmap *visited_verts = BLI_BITMAP_NEW(totvert, "visited verts"); GSQueue *queue = BLI_gsqueue_new(sizeof(PBVHVertRef)); /* Search and initialize a boundary per symmetry pass, then mark those vertices as visited. */ @@ -614,9 +614,9 @@ static float *sculpt_expand_boundary_topology_falloff_create(Object *ob, const P continue; } - for (int i = 0; i < boundary->num_vertices; i++) { - BLI_gsqueue_push(queue, &boundary->vertices[i]); - BLI_BITMAP_ENABLE(visited_vertices, boundary->vertices_i[i]); + for (int i = 0; i < boundary->verts_num; i++) { + BLI_gsqueue_push(queue, &boundary->verts[i]); + BLI_BITMAP_ENABLE(visited_verts, boundary->verts_i[i]); } SCULPT_boundary_data_free(boundary); } @@ -635,18 +635,18 @@ static float *sculpt_expand_boundary_topology_falloff_create(Object *ob, const P SculptVertexNeighborIter ni; SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, v_next, ni) { - if (BLI_BITMAP_TEST(visited_vertices, ni.index)) { + if (BLI_BITMAP_TEST(visited_verts, ni.index)) { continue; } dists[ni.index] = dists[v_next_i] + 1.0f; - BLI_BITMAP_ENABLE(visited_vertices, ni.index); + BLI_BITMAP_ENABLE(visited_verts, ni.index); BLI_gsqueue_push(queue, &ni.vertex); } SCULPT_VERTEX_NEIGHBORS_ITER_END(ni); } BLI_gsqueue_free(queue); - MEM_freeN(visited_vertices); + MEM_freeN(visited_verts); return dists; } @@ -669,7 +669,7 @@ static float *sculpt_expand_diagonals_falloff_create(Object *ob, const PBVHVertR } /* Search and mask as visited the initial vertices using the enabled symmetry passes. */ - BLI_bitmap *visited_vertices = BLI_BITMAP_NEW(totvert, "visited vertices"); + BLI_bitmap *visited_verts = BLI_BITMAP_NEW(totvert, "visited verts"); GSQueue *queue = BLI_gsqueue_new(sizeof(PBVHVertRef)); const char symm = SCULPT_mesh_symmetry_xyz_get(ob); for (char symm_it = 0; symm_it <= symm; symm_it++) { @@ -682,7 +682,7 @@ static float *sculpt_expand_diagonals_falloff_create(Object *ob, const PBVHVertR int symm_vertex_i = BKE_pbvh_vertex_to_index(ss->pbvh, symm_vertex); BLI_gsqueue_push(queue, &symm_vertex); - BLI_BITMAP_ENABLE(visited_vertices, symm_vertex_i); + BLI_BITMAP_ENABLE(visited_verts, symm_vertex_i); } if (BLI_gsqueue_is_empty(queue)) { @@ -700,18 +700,18 @@ static float *sculpt_expand_diagonals_falloff_create(Object *ob, const PBVHVertR const MPoly *p = &ss->mpoly[ss->pmap[v_next_i].indices[j]]; for (int l = 0; l < p->totloop; l++) { const PBVHVertRef neighbor_v = BKE_pbvh_make_vref(ss->mloop[p->loopstart + l].v); - if (BLI_BITMAP_TEST(visited_vertices, neighbor_v.i)) { + if (BLI_BITMAP_TEST(visited_verts, neighbor_v.i)) { continue; } dists[neighbor_v.i] = dists[v_next_i] + 1.0f; - BLI_BITMAP_ENABLE(visited_vertices, neighbor_v.i); + BLI_BITMAP_ENABLE(visited_verts, neighbor_v.i); BLI_gsqueue_push(queue, &neighbor_v); } } } BLI_gsqueue_free(queue); - MEM_freeN(visited_vertices); + MEM_freeN(visited_verts); return dists; } @@ -842,27 +842,27 @@ static void sculpt_expand_mesh_face_falloff_from_vertex_falloff(SculptSession *s */ static void sculpt_expand_geodesics_from_state_boundary(Object *ob, ExpandCache *expand_cache, - BLI_bitmap *enabled_vertices) + BLI_bitmap *enabled_verts) { SculptSession *ss = ob->sculpt; BLI_assert(BKE_pbvh_type(ss->pbvh) == PBVH_FACES); - GSet *initial_vertices = BLI_gset_int_new("initial_vertices"); - BLI_bitmap *boundary_vertices = sculpt_expand_boundary_from_enabled(ss, enabled_vertices, false); + GSet *initial_verts = BLI_gset_int_new("initial_verts"); + BLI_bitmap *boundary_verts = sculpt_expand_boundary_from_enabled(ss, enabled_verts, false); const int totvert = SCULPT_vertex_count_get(ss); for (int i = 0; i < totvert; i++) { - if (!BLI_BITMAP_TEST(boundary_vertices, i)) { + if (!BLI_BITMAP_TEST(boundary_verts, i)) { continue; } - BLI_gset_add(initial_vertices, POINTER_FROM_INT(i)); + BLI_gset_add(initial_verts, POINTER_FROM_INT(i)); } - MEM_freeN(boundary_vertices); + MEM_freeN(boundary_verts); MEM_SAFE_FREE(expand_cache->vert_falloff); MEM_SAFE_FREE(expand_cache->face_falloff); - expand_cache->vert_falloff = SCULPT_geodesic_distances_create(ob, initial_vertices, FLT_MAX); - BLI_gset_free(initial_vertices, NULL); + expand_cache->vert_falloff = SCULPT_geodesic_distances_create(ob, initial_verts, FLT_MAX); + BLI_gset_free(initial_verts, NULL); } /** @@ -871,7 +871,7 @@ static void sculpt_expand_geodesics_from_state_boundary(Object *ob, */ static void sculpt_expand_topology_from_state_boundary(Object *ob, ExpandCache *expand_cache, - BLI_bitmap *enabled_vertices) + BLI_bitmap *enabled_verts) { MEM_SAFE_FREE(expand_cache->vert_falloff); MEM_SAFE_FREE(expand_cache->face_falloff); @@ -880,19 +880,19 @@ static void sculpt_expand_topology_from_state_boundary(Object *ob, const int totvert = SCULPT_vertex_count_get(ss); float *dists = MEM_calloc_arrayN(totvert, sizeof(float), "topology dist"); - BLI_bitmap *boundary_vertices = sculpt_expand_boundary_from_enabled(ss, enabled_vertices, false); + BLI_bitmap *boundary_verts = sculpt_expand_boundary_from_enabled(ss, enabled_verts, false); SculptFloodFill flood; SCULPT_floodfill_init(ss, &flood); for (int i = 0; i < totvert; i++) { - if (!BLI_BITMAP_TEST(boundary_vertices, i)) { + if (!BLI_BITMAP_TEST(boundary_verts, i)) { continue; } PBVHVertRef vertex = BKE_pbvh_index_to_vertex(ss->pbvh, i); SCULPT_floodfill_add_and_skip_initial(&flood, vertex); } - MEM_freeN(boundary_vertices); + MEM_freeN(boundary_verts); ExpandFloodFillData fdata; fdata.dists = dists; @@ -914,7 +914,7 @@ static void sculpt_expand_resursion_step_add(Object *ob, return; } - BLI_bitmap *enabled_vertices = sculpt_expand_bitmap_from_enabled(ss, expand_cache); + BLI_bitmap *enabled_verts = sculpt_expand_bitmap_from_enabled(ss, expand_cache); /* Each time a new recursion step is created, reset the distortion strength. This is the expected * result from the recursion, as otherwise the new falloff will render with undesired distortion @@ -923,10 +923,10 @@ static void sculpt_expand_resursion_step_add(Object *ob, switch (recursion_type) { case SCULPT_EXPAND_RECURSION_GEODESICS: - sculpt_expand_geodesics_from_state_boundary(ob, expand_cache, enabled_vertices); + sculpt_expand_geodesics_from_state_boundary(ob, expand_cache, enabled_verts); break; case SCULPT_EXPAND_RECURSION_TOPOLOGY: - sculpt_expand_topology_from_state_boundary(ob, expand_cache, enabled_vertices); + sculpt_expand_topology_from_state_boundary(ob, expand_cache, enabled_verts); break; } @@ -936,7 +936,7 @@ static void sculpt_expand_resursion_step_add(Object *ob, sculpt_expand_update_max_face_falloff_factor(ss, expand_cache); } - MEM_freeN(enabled_vertices); + MEM_freeN(enabled_verts); } /* Face Set Boundary falloff. */ @@ -953,7 +953,7 @@ static void sculpt_expand_initialize_from_face_set_boundary(Object *ob, SculptSession *ss = ob->sculpt; const int totvert = SCULPT_vertex_count_get(ss); - BLI_bitmap *enabled_vertices = BLI_BITMAP_NEW(totvert, "enabled vertices"); + BLI_bitmap *enabled_verts = BLI_BITMAP_NEW(totvert, "enabled verts"); for (int i = 0; i < totvert; i++) { PBVHVertRef vertex = BKE_pbvh_index_to_vertex(ss->pbvh, i); @@ -963,17 +963,17 @@ static void sculpt_expand_initialize_from_face_set_boundary(Object *ob, if (!SCULPT_vertex_has_face_set(ss, vertex, active_face_set)) { continue; } - BLI_BITMAP_ENABLE(enabled_vertices, i); + BLI_BITMAP_ENABLE(enabled_verts, i); } if (BKE_pbvh_type(ss->pbvh) == PBVH_FACES) { - sculpt_expand_geodesics_from_state_boundary(ob, expand_cache, enabled_vertices); + sculpt_expand_geodesics_from_state_boundary(ob, expand_cache, enabled_verts); } else { - sculpt_expand_topology_from_state_boundary(ob, expand_cache, enabled_vertices); + sculpt_expand_topology_from_state_boundary(ob, expand_cache, enabled_verts); } - MEM_freeN(enabled_vertices); + MEM_freeN(enabled_verts); if (internal_falloff) { for (int i = 0; i < totvert; i++) { @@ -1086,7 +1086,7 @@ static void sculpt_expand_snap_initialize_from_enabled(SculptSession *ss, expand_cache->snap = false; expand_cache->invert = false; - BLI_bitmap *enabled_vertices = sculpt_expand_bitmap_from_enabled(ss, expand_cache); + BLI_bitmap *enabled_verts = sculpt_expand_bitmap_from_enabled(ss, expand_cache); const int totface = ss->totfaces; for (int i = 0; i < totface; i++) { @@ -1099,7 +1099,7 @@ static void sculpt_expand_snap_initialize_from_enabled(SculptSession *ss, bool any_disabled = false; for (int l = 0; l < poly->totloop; l++) { const MLoop *loop = &ss->mloop[l + poly->loopstart]; - if (!BLI_BITMAP_TEST(enabled_vertices, loop->v)) { + if (!BLI_BITMAP_TEST(enabled_verts, loop->v)) { any_disabled = true; break; } @@ -1110,7 +1110,7 @@ static void sculpt_expand_snap_initialize_from_enabled(SculptSession *ss, } } - MEM_freeN(enabled_vertices); + MEM_freeN(enabled_verts); expand_cache->snap = prev_snap_state; expand_cache->invert = prev_invert_state; } @@ -1514,7 +1514,7 @@ static void sculpt_expand_reposition_pivot(bContext *C, Object *ob, ExpandCache const bool initial_invert_state = expand_cache->invert; expand_cache->invert = false; - BLI_bitmap *enabled_vertices = sculpt_expand_bitmap_from_enabled(ss, expand_cache); + BLI_bitmap *enabled_verts = sculpt_expand_bitmap_from_enabled(ss, expand_cache); /* For boundary topology, position the pivot using only the boundary of the enabled vertices, * without taking mesh boundary into account. This allows to create deformations like bending the @@ -1522,8 +1522,8 @@ static void sculpt_expand_reposition_pivot(bContext *C, Object *ob, ExpandCache const float use_mesh_boundary = expand_cache->falloff_type != SCULPT_EXPAND_FALLOFF_BOUNDARY_TOPOLOGY; - BLI_bitmap *boundary_vertices = sculpt_expand_boundary_from_enabled( - ss, enabled_vertices, use_mesh_boundary); + BLI_bitmap *boundary_verts = sculpt_expand_boundary_from_enabled( + ss, enabled_verts, use_mesh_boundary); /* Ignore invert state, as this is the expected behavior in most cases and mask are created in * inverted state by default. */ @@ -1537,7 +1537,7 @@ static void sculpt_expand_reposition_pivot(bContext *C, Object *ob, ExpandCache for (int i = 0; i < totvert; i++) { PBVHVertRef vertex = BKE_pbvh_index_to_vertex(ss->pbvh, i); - if (!BLI_BITMAP_TEST(boundary_vertices, i)) { + if (!BLI_BITMAP_TEST(boundary_verts, i)) { continue; } @@ -1555,8 +1555,8 @@ static void sculpt_expand_reposition_pivot(bContext *C, Object *ob, ExpandCache total++; } - MEM_freeN(enabled_vertices); - MEM_freeN(boundary_vertices); + MEM_freeN(enabled_verts); + MEM_freeN(boundary_verts); if (total > 0) { mul_v3_v3fl(ss->pivot_pos, avg, 1.0f / total); diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.c b/source/blender/editors/sculpt_paint/sculpt_face_set.c index b89944628da..64bc6188bbc 100644 --- a/source/blender/editors/sculpt_paint/sculpt_face_set.c +++ b/source/blender/editors/sculpt_paint/sculpt_face_set.c @@ -746,7 +746,7 @@ static int sculpt_face_set_init_exec(bContext *C, wmOperator *op) SCULPT_undo_push_end(ob); /* Sync face sets visibility and vertex visibility as now all Face Sets are visible. */ - SCULPT_visibility_sync_all_face_sets_to_vertices(ob); + SCULPT_visibility_sync_all_face_sets_to_verts(ob); for (int i = 0; i < totnode; i++) { BKE_pbvh_node_mark_update_visibility(nodes[i]); @@ -933,7 +933,7 @@ static int sculpt_face_sets_change_visibility_exec(bContext *C, wmOperator *op) } /* Sync face sets visibility and vertex visibility. */ - SCULPT_visibility_sync_all_face_sets_to_vertices(ob); + SCULPT_visibility_sync_all_face_sets_to_verts(ob); SCULPT_undo_push_end(ob); @@ -1233,21 +1233,21 @@ static void sculpt_face_set_edit_fair_face_set(Object *ob, const int totvert = SCULPT_vertex_count_get(ss); Mesh *mesh = ob->data; - bool *fair_vertices = MEM_malloc_arrayN(totvert, sizeof(bool), "fair vertices"); + bool *fair_verts = MEM_malloc_arrayN(totvert, sizeof(bool), "fair vertices"); SCULPT_boundary_info_ensure(ob); for (int i = 0; i < totvert; i++) { PBVHVertRef vertex = BKE_pbvh_index_to_vertex(ss->pbvh, i); - fair_vertices[i] = !SCULPT_vertex_is_boundary(ss, vertex) && - SCULPT_vertex_has_face_set(ss, vertex, active_face_set_id) && - SCULPT_vertex_has_unique_face_set(ss, vertex); + fair_verts[i] = !SCULPT_vertex_is_boundary(ss, vertex) && + SCULPT_vertex_has_face_set(ss, vertex, active_face_set_id) && + SCULPT_vertex_has_unique_face_set(ss, vertex); } MVert *mvert = SCULPT_mesh_deformed_mverts_get(ss); - BKE_mesh_prefair_and_fair_vertices(mesh, mvert, fair_vertices, fair_order); - MEM_freeN(fair_vertices); + BKE_mesh_prefair_and_fair_verts(mesh, mvert, fair_verts, fair_order); + MEM_freeN(fair_verts); } static void sculpt_face_set_apply_edit(Object *ob, @@ -1339,7 +1339,7 @@ static void face_set_edit_do_post_visibility_updates(Object *ob, PBVHNode **node PBVH *pbvh = ss->pbvh; /* Sync face sets visibility and vertex visibility as now all Face Sets are visible. */ - SCULPT_visibility_sync_all_face_sets_to_vertices(ob); + SCULPT_visibility_sync_all_face_sets_to_verts(ob); for (int i = 0; i < totnode; i++) { BKE_pbvh_node_mark_update_visibility(nodes[i]); diff --git a/source/blender/editors/sculpt_paint/sculpt_geodesic.c b/source/blender/editors/sculpt_paint/sculpt_geodesic.c index c07c6126405..a5885092ee3 100644 --- a/source/blender/editors/sculpt_paint/sculpt_geodesic.c +++ b/source/blender/editors/sculpt_paint/sculpt_geodesic.c @@ -61,9 +61,9 @@ /* Propagate distance from v1 and v2 to v0. */ static bool sculpt_geodesic_mesh_test_dist_add( - MVert *mvert, const int v0, const int v1, const int v2, float *dists, GSet *initial_vertices) + MVert *mvert, const int v0, const int v1, const int v2, float *dists, GSet *initial_verts) { - if (BLI_gset_haskey(initial_vertices, POINTER_FROM_INT(v0))) { + if (BLI_gset_haskey(initial_verts, POINTER_FROM_INT(v0))) { return false; } @@ -96,7 +96,7 @@ static bool sculpt_geodesic_mesh_test_dist_add( } static float *SCULPT_geodesic_mesh_create(Object *ob, - GSet *initial_vertices, + GSet *initial_verts, const float limit_radius) { SculptSession *ss = ob->sculpt; @@ -137,7 +137,7 @@ static float *SCULPT_geodesic_mesh_create(Object *ob, BLI_LINKSTACK_INIT(queue_next); for (int i = 0; i < totvert; i++) { - if (BLI_gset_haskey(initial_vertices, POINTER_FROM_INT(i))) { + if (BLI_gset_haskey(initial_verts, POINTER_FROM_INT(i))) { dists[i] = 0.0f; } else { @@ -159,7 +159,7 @@ static float *SCULPT_geodesic_mesh_create(Object *ob, /* This is an O(n^2) loop used to limit the geodesic distance calculation to a radius. When * this optimization is needed, it is expected for the tool to request the distance to a low * number of vertices (usually just 1 or 2). */ - GSET_ITER (gs_iter, initial_vertices) { + GSET_ITER (gs_iter, initial_verts) { const int v = POINTER_AS_INT(BLI_gsetIterator_getKey(&gs_iter)); float *v_co = verts[v].co; for (int i = 0; i < totvert; i++) { @@ -193,7 +193,7 @@ static float *SCULPT_geodesic_mesh_create(Object *ob, SWAP(int, v1, v2); } sculpt_geodesic_mesh_test_dist_add( - verts, v2, v1, SCULPT_GEODESIC_VERTEX_NONE, dists, initial_vertices); + verts, v2, v1, SCULPT_GEODESIC_VERTEX_NONE, dists, initial_verts); } if (ss->epmap[e].count != 0) { @@ -210,8 +210,7 @@ static float *SCULPT_geodesic_mesh_create(Object *ob, if (ELEM(v_other, v1, v2)) { continue; } - if (sculpt_geodesic_mesh_test_dist_add( - verts, v_other, v1, v2, dists, initial_vertices)) { + if (sculpt_geodesic_mesh_test_dist_add(verts, v_other, v1, v2, dists, initial_verts)) { for (int edge_map_index = 0; edge_map_index < ss->vemap[v_other].count; edge_map_index++) { const int e_other = ss->vemap[v_other].indices[edge_map_index]; @@ -258,7 +257,7 @@ static float *SCULPT_geodesic_mesh_create(Object *ob, /* For sculpt mesh data that does not support a geodesic distances algorithm, fallback to the * distance to each vertex. In this case, only one of the initial vertices will be used to * calculate the distance. */ -static float *SCULPT_geodesic_fallback_create(Object *ob, GSet *initial_vertices) +static float *SCULPT_geodesic_fallback_create(Object *ob, GSet *initial_verts) { SculptSession *ss = ob->sculpt; @@ -267,7 +266,7 @@ static float *SCULPT_geodesic_fallback_create(Object *ob, GSet *initial_vertices float *dists = MEM_malloc_arrayN(totvert, sizeof(float), "distances"); int first_affected = SCULPT_GEODESIC_VERTEX_NONE; GSetIterator gs_iter; - GSET_ITER (gs_iter, initial_vertices) { + GSET_ITER (gs_iter, initial_verts) { first_affected = POINTER_AS_INT(BLI_gsetIterator_getKey(&gs_iter)); break; } @@ -290,17 +289,15 @@ static float *SCULPT_geodesic_fallback_create(Object *ob, GSet *initial_vertices return dists; } -float *SCULPT_geodesic_distances_create(Object *ob, - GSet *initial_vertices, - const float limit_radius) +float *SCULPT_geodesic_distances_create(Object *ob, GSet *initial_verts, const float limit_radius) { SculptSession *ss = ob->sculpt; switch (BKE_pbvh_type(ss->pbvh)) { case PBVH_FACES: - return SCULPT_geodesic_mesh_create(ob, initial_vertices, limit_radius); + return SCULPT_geodesic_mesh_create(ob, initial_verts, limit_radius); case PBVH_BMESH: case PBVH_GRIDS: - return SCULPT_geodesic_fallback_create(ob, initial_vertices); + return SCULPT_geodesic_fallback_create(ob, initial_verts); } BLI_assert(false); return NULL; @@ -312,7 +309,7 @@ float *SCULPT_geodesic_from_vertex_and_symm(Sculpt *sd, const float limit_radius) { SculptSession *ss = ob->sculpt; - GSet *initial_vertices = BLI_gset_int_new("initial_vertices"); + GSet *initial_verts = BLI_gset_int_new("initial_verts"); const char symm = SCULPT_mesh_symmetry_xyz_get(ob); for (char i = 0; i <= symm; ++i) { @@ -328,22 +325,22 @@ float *SCULPT_geodesic_from_vertex_and_symm(Sculpt *sd, v = SCULPT_nearest_vertex_get(sd, ob, location, FLT_MAX, false); } if (v.i != PBVH_REF_NONE) { - BLI_gset_add(initial_vertices, POINTER_FROM_INT(BKE_pbvh_vertex_to_index(ss->pbvh, v))); + BLI_gset_add(initial_verts, POINTER_FROM_INT(BKE_pbvh_vertex_to_index(ss->pbvh, v))); } } } - float *dists = SCULPT_geodesic_distances_create(ob, initial_vertices, limit_radius); - BLI_gset_free(initial_vertices, NULL); + float *dists = SCULPT_geodesic_distances_create(ob, initial_verts, limit_radius); + BLI_gset_free(initial_verts, NULL); return dists; } float *SCULPT_geodesic_from_vertex(Object *ob, const PBVHVertRef vertex, const float limit_radius) { - GSet *initial_vertices = BLI_gset_int_new("initial_vertices"); - BLI_gset_add(initial_vertices, + GSet *initial_verts = BLI_gset_int_new("initial_verts"); + BLI_gset_add(initial_verts, POINTER_FROM_INT(BKE_pbvh_vertex_to_index(ob->sculpt->pbvh, vertex))); - float *dists = SCULPT_geodesic_distances_create(ob, initial_vertices, limit_radius); - BLI_gset_free(initial_vertices, NULL); + float *dists = SCULPT_geodesic_distances_create(ob, initial_verts, limit_radius); + BLI_gset_free(initial_verts, NULL); return dists; } diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index e4bba135518..4bc06d68a02 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -97,7 +97,7 @@ typedef struct { /* Flood Fill. */ typedef struct { GSQueue *queue; - BLI_bitmap *visited_vertices; + BLI_bitmap *visited_verts; } SculptFloodFill; typedef enum eBoundaryAutomaskMode { @@ -1005,7 +1005,7 @@ void SCULPT_connected_components_ensure(Object *ob); void SCULPT_vertex_visible_set(SculptSession *ss, PBVHVertRef vertex, bool visible); bool SCULPT_vertex_visible_get(SculptSession *ss, PBVHVertRef vertex); -void SCULPT_visibility_sync_all_face_sets_to_vertices(struct Object *ob); +void SCULPT_visibility_sync_all_face_sets_to_verts(struct Object *ob); void SCULPT_visibility_sync_all_vertex_to_face_sets(struct SculptSession *ss); /** \} */ diff --git a/source/blender/editors/sculpt_paint/sculpt_ops.c b/source/blender/editors/sculpt_paint/sculpt_ops.c index 97c1f331498..10a2ece73de 100644 --- a/source/blender/editors/sculpt_paint/sculpt_ops.c +++ b/source/blender/editors/sculpt_paint/sculpt_ops.c @@ -571,49 +571,48 @@ void SCULPT_geometry_preview_lines_update(bContext *C, SculptSession *ss, float float brush_co[3]; copy_v3_v3(brush_co, SCULPT_active_vertex_co_get(ss)); - BLI_bitmap *visited_vertices = BLI_BITMAP_NEW(SCULPT_vertex_count_get(ss), "visited_vertices"); + BLI_bitmap *visited_verts = BLI_BITMAP_NEW(SCULPT_vertex_count_get(ss), "visited_verts"); /* Assuming an average of 6 edges per vertex in a triangulated mesh. */ - const int max_preview_vertices = SCULPT_vertex_count_get(ss) * 3 * 2; + const int max_preview_verts = SCULPT_vertex_count_get(ss) * 3 * 2; if (ss->preview_vert_list == NULL) { - ss->preview_vert_list = MEM_callocN(max_preview_vertices * sizeof(PBVHVertRef), - "preview lines"); + ss->preview_vert_list = MEM_callocN(max_preview_verts * sizeof(PBVHVertRef), "preview lines"); } - GSQueue *not_visited_vertices = BLI_gsqueue_new(sizeof(PBVHVertRef)); + GSQueue *non_visited_verts = BLI_gsqueue_new(sizeof(PBVHVertRef)); PBVHVertRef active_v = SCULPT_active_vertex_get(ss); - BLI_gsqueue_push(not_visited_vertices, &active_v); + BLI_gsqueue_push(non_visited_verts, &active_v); - while (!BLI_gsqueue_is_empty(not_visited_vertices)) { + while (!BLI_gsqueue_is_empty(non_visited_verts)) { PBVHVertRef from_v; - BLI_gsqueue_pop(not_visited_vertices, &from_v); + BLI_gsqueue_pop(non_visited_verts, &from_v); SculptVertexNeighborIter ni; SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, from_v, ni) { - if (totpoints + (ni.size * 2) < max_preview_vertices) { + if (totpoints + (ni.size * 2) < max_preview_verts) { PBVHVertRef to_v = ni.vertex; int to_v_i = ni.index; ss->preview_vert_list[totpoints] = from_v; totpoints++; ss->preview_vert_list[totpoints] = to_v; totpoints++; - if (BLI_BITMAP_TEST(visited_vertices, to_v_i)) { + if (BLI_BITMAP_TEST(visited_verts, to_v_i)) { continue; } - BLI_BITMAP_ENABLE(visited_vertices, to_v_i); + BLI_BITMAP_ENABLE(visited_verts, to_v_i); const float *co = SCULPT_vertex_co_for_grab_active_get(ss, to_v); if (len_squared_v3v3(brush_co, co) < radius * radius) { - BLI_gsqueue_push(not_visited_vertices, &to_v); + BLI_gsqueue_push(non_visited_verts, &to_v); } } } SCULPT_VERTEX_NEIGHBORS_ITER_END(ni); } - BLI_gsqueue_free(not_visited_vertices); + BLI_gsqueue_free(non_visited_verts); - MEM_freeN(visited_vertices); + MEM_freeN(visited_verts); ss->preview_vert_count = totpoints; } diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index 2fc49a24cc4..a31be07d8af 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -168,9 +168,9 @@ struct PartialUpdateData { PBVH *pbvh; bool rebuild; char *modified_grids; - bool *modified_hidden_vertices; - bool *modified_mask_vertices; - bool *modified_color_vertices; + bool *modified_hidden_verts; + bool *modified_mask_verts; + bool *modified_color_verts; }; /** @@ -201,25 +201,25 @@ static void update_cb_partial(PBVHNode *node, void *userdata) const int *vert_indices; BKE_pbvh_node_num_verts(data->pbvh, node, NULL, &verts_num); BKE_pbvh_node_get_verts(data->pbvh, node, &vert_indices, NULL); - if (data->modified_mask_vertices != NULL) { + if (data->modified_mask_verts != NULL) { for (int i = 0; i < verts_num; i++) { - if (data->modified_mask_vertices[vert_indices[i]]) { + if (data->modified_mask_verts[vert_indices[i]]) { BKE_pbvh_node_mark_update_mask(node); break; } } } - if (data->modified_color_vertices != NULL) { + if (data->modified_color_verts != NULL) { for (int i = 0; i < verts_num; i++) { - if (data->modified_color_vertices[vert_indices[i]]) { + if (data->modified_color_verts[vert_indices[i]]) { BKE_pbvh_node_mark_update_color(node); break; } } } - if (data->modified_hidden_vertices != NULL) { + if (data->modified_hidden_verts != NULL) { for (int i = 0; i < verts_num; i++) { - if (data->modified_hidden_vertices[vert_indices[i]]) { + if (data->modified_hidden_verts[vert_indices[i]]) { if (data->rebuild) { BKE_pbvh_node_mark_update_visibility(node); } @@ -755,7 +755,7 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase BKE_sculpt_update_object_for_edit(depsgraph, ob, true, need_mask, false); - SCULPT_visibility_sync_all_face_sets_to_vertices(ob); + SCULPT_visibility_sync_all_face_sets_to_verts(ob); BKE_pbvh_update_vertex_data(ss->pbvh, PBVH_UpdateVisibility); @@ -790,9 +790,9 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase /* The PBVH already keeps track of which vertices need updated normals, but it doesn't keep track * of other updated. In order to tell the corresponding PBVH nodes to update, keep track of which * elements were updated for specific layers. */ - bool *modified_hidden_vertices = NULL; - bool *modified_mask_vertices = NULL; - bool *modified_color_vertices = NULL; + bool *modified_hidden_verts = NULL; + bool *modified_mask_verts = NULL; + bool *modified_color_verts = NULL; char *undo_modified_grids = NULL; bool use_multires_undo = false; @@ -825,19 +825,19 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase } break; case SCULPT_UNDO_HIDDEN: - if (modified_hidden_vertices == NULL) { - modified_hidden_vertices = MEM_calloc_arrayN(ss->totvert, sizeof(bool), __func__); + if (modified_hidden_verts == NULL) { + modified_hidden_verts = MEM_calloc_arrayN(ss->totvert, sizeof(bool), __func__); } - if (sculpt_undo_restore_hidden(C, unode, modified_hidden_vertices)) { + if (sculpt_undo_restore_hidden(C, unode, modified_hidden_verts)) { rebuild = true; update_visibility = true; } break; case SCULPT_UNDO_MASK: - if (modified_mask_vertices == NULL) { - modified_mask_vertices = MEM_calloc_arrayN(ss->totvert, sizeof(bool), __func__); + if (modified_mask_verts == NULL) { + modified_mask_verts = MEM_calloc_arrayN(ss->totvert, sizeof(bool), __func__); } - if (sculpt_undo_restore_mask(C, unode, modified_mask_vertices)) { + if (sculpt_undo_restore_mask(C, unode, modified_mask_verts)) { update = true; update_mask = true; } @@ -845,10 +845,10 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase case SCULPT_UNDO_FACE_SETS: break; case SCULPT_UNDO_COLOR: - if (modified_color_vertices == NULL) { - modified_color_vertices = MEM_calloc_arrayN(ss->totvert, sizeof(bool), __func__); + if (modified_color_verts == NULL) { + modified_color_verts = MEM_calloc_arrayN(ss->totvert, sizeof(bool), __func__); } - if (sculpt_undo_restore_color(C, unode, modified_color_vertices)) { + if (sculpt_undo_restore_color(C, unode, modified_color_verts)) { update = true; } @@ -899,9 +899,9 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase .rebuild = rebuild, .pbvh = ss->pbvh, .modified_grids = undo_modified_grids, - .modified_hidden_vertices = modified_hidden_vertices, - .modified_mask_vertices = modified_mask_vertices, - .modified_color_vertices = modified_color_vertices, + .modified_hidden_verts = modified_hidden_verts, + .modified_mask_verts = modified_mask_verts, + .modified_color_verts = modified_color_verts, }; BKE_pbvh_search_callback(ss->pbvh, NULL, NULL, update_cb_partial, &data); BKE_pbvh_update_bounds(ss->pbvh, PBVH_UpdateBB | PBVH_UpdateOriginalBB | PBVH_UpdateRedraw); @@ -947,9 +947,9 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase } } - MEM_SAFE_FREE(modified_hidden_vertices); - MEM_SAFE_FREE(modified_mask_vertices); - MEM_SAFE_FREE(modified_color_vertices); + MEM_SAFE_FREE(modified_hidden_verts); + MEM_SAFE_FREE(modified_mask_verts); + MEM_SAFE_FREE(modified_color_verts); MEM_SAFE_FREE(undo_modified_grids); } diff --git a/source/blender/editors/space_info/info_stats.cc b/source/blender/editors/space_info/info_stats.cc index 0f872d0a02e..a796ed5a817 100644 --- a/source/blender/editors/space_info/info_stats.cc +++ b/source/blender/editors/space_info/info_stats.cc @@ -345,7 +345,7 @@ static void stats_object_sculpt(const Object *ob, SceneStats *stats) stats->tottri = ob->sculpt->bm->totface; break; case PBVH_GRIDS: - stats->totvertsculpt = BKE_pbvh_get_grid_num_vertices(ss->pbvh); + stats->totvertsculpt = BKE_pbvh_get_grid_num_verts(ss->pbvh); stats->totfacesculpt = BKE_pbvh_get_grid_num_faces(ss->pbvh); break; } diff --git a/source/blender/editors/space_view3d/view3d_select.cc b/source/blender/editors/space_view3d/view3d_select.cc index 2424ea5b5d7..ad816f420fe 100644 --- a/source/blender/editors/space_view3d/view3d_select.cc +++ b/source/blender/editors/space_view3d/view3d_select.cc @@ -364,22 +364,22 @@ static bool edbm_backbuf_check_and_select_faces_obmode(Mesh *me, EditSelectBuf_Cache *esel, const eSelectOp sel_op) { - MPoly *polygons = BKE_mesh_polys_for_write(me); + MPoly *polys = BKE_mesh_polys_for_write(me); bool changed = false; const BLI_bitmap *select_bitmap = esel->select_bitmap; - if (polygons) { + if (polys) { const bool *hide_poly = (const bool *)CustomData_get_layer_named( &me->vdata, CD_PROP_BOOL, ".hide_poly"); for (int index = 0; index < me->totpoly; index++) { if (!(hide_poly && hide_poly[index])) { - const bool is_select = polygons[index].flag & ME_FACE_SEL; + const bool is_select = polys[index].flag & ME_FACE_SEL; const bool is_inside = BLI_BITMAP_TEST_BOOL(select_bitmap, index); const int sel_op_result = ED_select_op_action_deselected(sel_op, is_select, is_inside); if (sel_op_result != -1) { - SET_FLAG_FROM_TEST(polygons[index].flag, sel_op_result, ME_FACE_SEL); + SET_FLAG_FROM_TEST(polys[index].flag, sel_op_result, ME_FACE_SEL); changed = true; } } @@ -3434,7 +3434,8 @@ static bool do_mesh_box_select(ViewContext *vc, } if (ts->selectmode & SCE_SELECT_EDGE) { /* Does both use_zbuf and non-use_zbuf versions (need screen cos for both) */ - struct BoxSelectUserData_ForMeshEdge cb_data {}; + struct BoxSelectUserData_ForMeshEdge cb_data { + }; cb_data.data = &data; cb_data.esel = use_zbuf ? esel : nullptr; cb_data.backbuf_offset = use_zbuf ? DRW_select_buffer_context_offset_for_object_elem( -- cgit v1.2.3