Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/paint.c
| Show First 20 Lines • Show All 1,879 Lines • ▼ Show 20 Lines | |||||
| static void sculpt_sync_face_sets_visibility_to_base_mesh(Mesh *mesh) | static void sculpt_sync_face_sets_visibility_to_base_mesh(Mesh *mesh) | ||||
| { | { | ||||
| int *face_sets = CustomData_get_layer(&mesh->pdata, CD_SCULPT_FACE_SETS); | int *face_sets = CustomData_get_layer(&mesh->pdata, CD_SCULPT_FACE_SETS); | ||||
| if (!face_sets) { | if (!face_sets) { | ||||
| return; | return; | ||||
| } | } | ||||
| for (int i = 0; i < mesh->totvert; i++) { | /* Enabled if the vertex should be visible according to the Face Sets. */ | ||||
| mesh->mvert[i].flag |= ME_HIDE; | BLI_bitmap *visibile_vertex = BLI_BITMAP_NEW(mesh->totvert, "visible vertices"); | ||||
| } | /* Enabled if the visibility of this vertex can be affected by the Face Sets to avoid modifying | ||||
| * disconnected geometry. */ | |||||
| BLI_bitmap *modified_vertex = BLI_BITMAP_NEW(mesh->totvert, "modified vertices"); | |||||
| for (int i = 0; i < mesh->totpoly; i++) { | for (int i = 0; i < mesh->totpoly; i++) { | ||||
| if (face_sets[i] >= 0) { | const bool is_face_set_visible = face_sets[i] >= 0; | ||||
| for (int l = 0; l < mesh->mpoly[i].totloop; l++) { | for (int l = 0; l < mesh->mpoly[i].totloop; l++) { | ||||
| MLoop *loop = &mesh->mloop[mesh->mpoly[i].loopstart + l]; | MLoop *loop = &mesh->mloop[mesh->mpoly[i].loopstart + l]; | ||||
| mesh->mvert[loop->v].flag &= ~ME_HIDE; | if (is_face_set_visible) { | ||||
| BLI_BITMAP_ENABLE(visibile_vertex, loop->v); | |||||
sergey: `visible_face_set` reads more like an Id of a visible face set. `is_face_set_visible` is more… | |||||
| } | } | ||||
| BLI_BITMAP_ENABLE(modified_vertex, loop->v); | |||||
| } | } | ||||
| } | } | ||||
| for (int i = 0; i < mesh->totvert; i++) { | |||||
| if (BLI_BITMAP_TEST(modified_vertex, i) && !BLI_BITMAP_TEST(visibile_vertex, i)) { | |||||
| mesh->mvert[i].flag |= ME_HIDE; | |||||
| } | |||||
| } | |||||
| MEM_SAFE_FREE(visibile_vertex); | |||||
| MEM_SAFE_FREE(modified_vertex); | |||||
| } | } | ||||
| static void sculpt_sync_face_sets_visibility_to_grids(Mesh *mesh, SubdivCCG *subdiv_ccg) | static void sculpt_sync_face_sets_visibility_to_grids(Mesh *mesh, SubdivCCG *subdiv_ccg) | ||||
| { | { | ||||
| int *face_sets = CustomData_get_layer(&mesh->pdata, CD_SCULPT_FACE_SETS); | int *face_sets = CustomData_get_layer(&mesh->pdata, CD_SCULPT_FACE_SETS); | ||||
| if (!face_sets) { | if (!face_sets) { | ||||
| return; | return; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 181 Lines • Show Last 20 Lines | |||||
visible_face_set reads more like an Id of a visible face set. is_face_set_visible is more explicit and clear.