Cleanup: PBVH: Remove redundant storage of face set metadata

These two values are already stored in the mesh, and they have no
relation to the PBVH's goal as an acceleration structure. Similar to
a6a2af5fdd, remove the values from the PBVH and
just access them from the mesh as necessary.

Pair-reviewed in person with Sergey
This commit is contained in:
Hans Goudey
2023-11-01 18:20:43 +01:00
parent f54ed1c639
commit 756dea7ca1
5 changed files with 2 additions and 26 deletions

View File

@@ -470,8 +470,6 @@ void BKE_pbvh_face_sets_set(PBVH *pbvh, int *face_sets);
*/
void BKE_pbvh_update_hide_attributes_from_mesh(PBVH *pbvh);
void BKE_pbvh_face_sets_color_set(PBVH *pbvh, int seed, int color_default);
/* Vertex Deformer. */
void BKE_pbvh_vert_coords_apply(PBVH *pbvh, const float (*vertCos)[3], int totvert);

View File

@@ -1756,8 +1756,6 @@ static void sculpt_update_object(
BKE_pbvh_face_sets_set(ss->pbvh, ss->face_sets);
BKE_pbvh_update_hide_attributes_from_mesh(ss->pbvh);
BKE_pbvh_face_sets_color_set(ss->pbvh, me->face_sets_color_seed, me->face_sets_color_default);
sculpt_attribute_update_refs(ob);
sculpt_update_persistent_base(ob);

View File

@@ -665,8 +665,8 @@ static void pbvh_draw_args_init(const Mesh &mesh, PBVH *pbvh, PBVH_GPU_Args *arg
args->node = node;
args->grid_hidden = pbvh->grid_hidden;
args->face_sets_color_default = pbvh->face_sets_color_default;
args->face_sets_color_seed = pbvh->face_sets_color_seed;
args->face_sets_color_default = mesh.face_sets_color_default;
args->face_sets_color_seed = mesh.face_sets_color_seed;
args->vert_positions = pbvh->vert_positions;
if (pbvh->mesh) {
args->corner_verts = pbvh->corner_verts;
@@ -851,9 +851,6 @@ void BKE_pbvh_build_mesh(PBVH *pbvh, Mesh *mesh)
pbvh->faces_num = mesh->faces_num;
pbvh->face_sets_color_seed = mesh->face_sets_color_seed;
pbvh->face_sets_color_default = mesh->face_sets_color_default;
/* For each face, store the AABB and the AABB centroid */
blender::Array<BBC> prim_bbc(looptri_num);
BB cb;
@@ -2852,12 +2849,6 @@ void BKE_pbvh_update_normals(PBVH *pbvh, SubdivCCG *subdiv_ccg)
}
}
void BKE_pbvh_face_sets_color_set(PBVH *pbvh, int seed, int color_default)
{
pbvh->face_sets_color_seed = seed;
pbvh->face_sets_color_default = color_default;
}
/**
* PBVH drawing, updating draw buffers as needed and culling any nodes outside
* the specified frustum.

View File

@@ -177,8 +177,6 @@ struct PBVH {
CustomData *loop_data;
CustomData *face_data;
int face_sets_color_seed;
int face_sets_color_default;
int *face_sets;
/* Grid Data */

View File

@@ -400,12 +400,6 @@ void SCULPT_do_draw_face_sets_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nod
SculptSession *ss = ob->sculpt;
Brush *brush = BKE_paint_brush(&sd->paint);
if (ss->pbvh) {
Mesh *mesh = BKE_mesh_from_object(ob);
BKE_pbvh_face_sets_color_set(
ss->pbvh, mesh->face_sets_color_seed, mesh->face_sets_color_default);
}
BKE_curvemapping_init(brush->curve);
TaskParallelSettings settings;
@@ -534,8 +528,6 @@ static int sculpt_face_set_create_exec(bContext *C, wmOperator *op)
if (all_visible) {
mesh->face_sets_color_default = next_face_set;
BKE_pbvh_face_sets_color_set(
ss->pbvh, mesh->face_sets_color_seed, mesh->face_sets_color_default);
}
for (int i = 0; i < tot_vert; i++) {
@@ -1110,7 +1102,6 @@ static int sculpt_face_sets_randomize_colors_exec(bContext *C, wmOperator * /*op
max_ii(0, ss->totfaces - 1));
mesh->face_sets_color_default = ss->face_sets[random_index];
}
BKE_pbvh_face_sets_color_set(pbvh, mesh->face_sets_color_seed, mesh->face_sets_color_default);
Vector<PBVHNode *> nodes = blender::bke::pbvh::search_gather(pbvh, {});
for (PBVHNode *node : nodes) {