Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/sculpt_expand.c
| Show First 20 Lines • Show All 1,886 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /** | /** | ||||
| * Deletes the `delete_id` Face Set ID from the mesh Face Sets | * Deletes the `delete_id` Face Set ID from the mesh Face Sets | ||||
| * and stores the result in `r_face_set`. | * and stores the result in `r_face_set`. | ||||
| * The faces that were using the `delete_id` Face Set are filled | * The faces that were using the `delete_id` Face Set are filled | ||||
| * using the content from their neighbors. | * using the content from their neighbors. | ||||
| */ | */ | ||||
| static void sculpt_expand_delete_face_set_id( | static void sculpt_expand_delete_face_set_id(int *r_face_sets, | ||||
| int *r_face_sets, Mesh *mesh, MeshElemMap *pmap, const int totface, const int delete_id) | SculptSession *ss, | ||||
| ExpandCache *expand_cache, | |||||
| Mesh *mesh, | |||||
| const int delete_id) | |||||
| { | { | ||||
| const int totface = ss->totvert; | |||||
| MeshElemMap *pmap = ss->pmap; | |||||
| /* Check that all the face sets IDs in the mesh are not equal to `delete_id` | /* Check that all the face sets IDs in the mesh are not equal to `delete_id` | ||||
| * before attempting to delete it. */ | * before attempting to delete it. */ | ||||
| bool all_same_id = true; | bool all_same_id = true; | ||||
| for (int i = 0; i < totface; i++) { | for (int i = 0; i < totface; i++) { | ||||
| if (!sculpt_expand_is_face_in_active_component(ss, expand_cache, i)) { | |||||
| continue; | |||||
| } | |||||
| if (r_face_sets[i] != delete_id) { | if (r_face_sets[i] != delete_id) { | ||||
| all_same_id = false; | all_same_id = false; | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| if (all_same_id) { | if (all_same_id) { | ||||
| return; | return; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 155 Lines • ▼ Show 20 Lines | static int sculpt_expand_invoke(bContext *C, wmOperator *op, const wmEvent *event) | ||||
| BKE_pbvh_search_gather( | BKE_pbvh_search_gather( | ||||
| ss->pbvh, NULL, NULL, &ss->expand_cache->nodes, &ss->expand_cache->totnode); | ss->pbvh, NULL, NULL, &ss->expand_cache->nodes, &ss->expand_cache->totnode); | ||||
| /* Store initial state. */ | /* Store initial state. */ | ||||
| sculpt_expand_original_state_store(ob, ss->expand_cache); | sculpt_expand_original_state_store(ob, ss->expand_cache); | ||||
| if (ss->expand_cache->modify_active_face_set) { | if (ss->expand_cache->modify_active_face_set) { | ||||
| sculpt_expand_delete_face_set_id(ss->expand_cache->initial_face_sets, | sculpt_expand_delete_face_set_id(ss->expand_cache->initial_face_sets, | ||||
| ss, | |||||
| ss->expand_cache, | |||||
JacquesLucke: I do wonder, why is the expand cache passed separately if it is part of `SculptSession` already? | |||||
Done Inline ActionsThe entire expand operator is coded assuming that the ExpandCache can be in a different place than the geometry source. Right now it is allocated in the Sculpt Session, but this should make easier in the future to refactor it replacing the SculptSession for something more generic. pablodp606: The entire expand operator is coded assuming that the ExpandCache can be in a different place… | |||||
| ob->data, | ob->data, | ||||
| ss->pmap, | |||||
| ss->totfaces, | |||||
| ss->expand_cache->next_face_set); | ss->expand_cache->next_face_set); | ||||
| } | } | ||||
| /* Initialize the falloff. */ | /* Initialize the falloff. */ | ||||
| eSculptExpandFalloffType falloff_type = RNA_enum_get(op->ptr, "falloff_type"); | eSculptExpandFalloffType falloff_type = RNA_enum_get(op->ptr, "falloff_type"); | ||||
| /* When starting from a boundary vertex, set the initial falloff to boundary. */ | /* When starting from a boundary vertex, set the initial falloff to boundary. */ | ||||
| if (SCULPT_vertex_is_boundary(ss, ss->expand_cache->initial_active_vertex)) { | if (SCULPT_vertex_is_boundary(ss, ss->expand_cache->initial_active_vertex)) { | ||||
| ▲ Show 20 Lines • Show All 171 Lines • Show Last 20 Lines | |||||
I do wonder, why is the expand cache passed separately if it is part of SculptSession already?