Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/sculpt.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show First 20 Lines • Show All 538 Lines • ▼ Show 20 Lines | case PBVH_GRIDS: { | ||||
| const int grid_index = index / key->grid_area; | const int grid_index = index / key->grid_area; | ||||
| const int face_index = BKE_subdiv_ccg_grid_to_face_index(ss->subdiv_ccg, grid_index); | const int face_index = BKE_subdiv_ccg_grid_to_face_index(ss->subdiv_ccg, grid_index); | ||||
| return ss->face_sets[face_index] == face_set; | return ss->face_sets[face_index] == face_set; | ||||
| } | } | ||||
| } | } | ||||
| return true; | return true; | ||||
| } | } | ||||
| static void sculpt_visibility_sync_face_sets_to_vertex(SculptSession *ss, int index) | void SCULPT_visibility_sync_all_face_sets_to_vertices(Object *ob) | ||||
| { | |||||
| SCULPT_vertex_visible_set(ss, index, SCULPT_vertex_any_face_set_visible_get(ss, index)); | |||||
| } | |||||
| void SCULPT_visibility_sync_all_face_sets_to_vertices(SculptSession *ss) | |||||
| { | { | ||||
| SculptSession *ss = ob->sculpt; | |||||
| Mesh *mesh = BKE_object_get_original_mesh(ob); | |||||
| switch (BKE_pbvh_type(ss->pbvh)) { | switch (BKE_pbvh_type(ss->pbvh)) { | ||||
| case PBVH_FACES: { | case PBVH_FACES: { | ||||
| for (int i = 0; i < ss->totvert; i++) { | BKE_sculpt_sync_face_sets_visibility_to_base_mesh(mesh); | ||||
| sculpt_visibility_sync_face_sets_to_vertex(ss, i); | |||||
| } | |||||
| break; | break; | ||||
| } | } | ||||
| case PBVH_GRIDS: { | case PBVH_GRIDS: { | ||||
| BKE_pbvh_sync_face_sets_to_grids(ss->pbvh); | BKE_sculpt_sync_face_sets_visibility_to_base_mesh(mesh); | ||||
| BKE_sculpt_sync_face_sets_visibility_to_grids(mesh, ss->subdiv_ccg); | |||||
| break; | |||||
| } | } | ||||
| case PBVH_BMESH: | case PBVH_BMESH: | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| static void UNUSED_FUNCTION(sculpt_visibility_sync_vertex_to_face_sets)(SculptSession *ss, | static void UNUSED_FUNCTION(sculpt_visibility_sync_vertex_to_face_sets)(SculptSession *ss, | ||||
| int index) | int index) | ||||
| ▲ Show 20 Lines • Show All 7,568 Lines • ▼ Show 20 Lines | void ED_object_sculptmode_enter_ex(Main *bmain, | ||||
| if (ob->sculpt) { | if (ob->sculpt) { | ||||
| BKE_sculptsession_free(ob); | BKE_sculptsession_free(ob); | ||||
| } | } | ||||
| /* Make sure derived final from original object does not reference possibly | /* Make sure derived final from original object does not reference possibly | ||||
| * freed memory. */ | * freed memory. */ | ||||
| BKE_object_free_derived_caches(ob); | BKE_object_free_derived_caches(ob); | ||||
| /* Copy the current mesh visibility to the Face Sets. */ | |||||
| BKE_sculpt_face_sets_ensure_from_base_mesh_visibility(me); | |||||
| sculpt_init_session(depsgraph, scene, ob); | sculpt_init_session(depsgraph, scene, ob); | ||||
| /* Mask layer is required. */ | /* Mask layer is required. */ | ||||
| if (mmd) { | if (mmd) { | ||||
| /* XXX, we could attempt to support adding mask data mid-sculpt mode (with multi-res) | /* XXX, we could attempt to support adding mask data mid-sculpt mode (with multi-res) | ||||
| * but this ends up being quite tricky (and slow). */ | * but this ends up being quite tricky (and slow). */ | ||||
| BKE_sculpt_mask_layers_ensure(ob, mmd); | BKE_sculpt_mask_layers_ensure(ob, mmd); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,053 Lines • Show Last 20 Lines | |||||