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 8,826 Lines • ▼ Show 20 Lines | |||||
| static void sculpt_init_session(Depsgraph *depsgraph, Scene *scene, Object *ob) | static void sculpt_init_session(Depsgraph *depsgraph, Scene *scene, Object *ob) | ||||
| { | { | ||||
| /* Create persistent sculpt mode data. */ | /* Create persistent sculpt mode data. */ | ||||
| BKE_sculpt_toolsettings_data_ensure(scene); | BKE_sculpt_toolsettings_data_ensure(scene); | ||||
| ob->sculpt = MEM_callocN(sizeof(SculptSession), "sculpt session"); | ob->sculpt = MEM_callocN(sizeof(SculptSession), "sculpt session"); | ||||
| ob->sculpt->mode_type = OB_MODE_SCULPT; | ob->sculpt->mode_type = OB_MODE_SCULPT; | ||||
| BKE_sculpt_update_object_for_edit(depsgraph, ob, false, false); | BKE_sculpt_update_object_for_edit(depsgraph, ob, false, false); | ||||
| /* Here we can detect geometry that was just added to Sculpt Mode as it has the | |||||
| * SCULPT_FACE_SET_NONE assigned, so we can create a new Face Set for it. */ | |||||
| /* In sculpt mode all geometry that is assigned to SCULPT_FACE_SET_NONE is considered as not | |||||
| * initialized, which is used is some operators that modify the mesh topology to preform certain | |||||
| * actions in the new polys. After these operations are finished, all polys should have a valid | |||||
| * face set ID assigned (different from SCULPT_FACE_SET_NONE) to manage their visibility | |||||
| * correctly. */ | |||||
| /* TODO(pablodp606): Based on this we can improve the UX in future tools for creating new | |||||
| * objects, like moving the transform pivot position to the new area or masking existing | |||||
jbakker: Wouldn't this also update all other facesets that were still 0? If not, please explain in the… | |||||
| * geometry. */ | |||||
| SculptSession *ss = ob->sculpt; | |||||
| const int new_face_set = SCULPT_face_set_next_available_get(ss); | |||||
| for (int i = 0; i < ss->totfaces; i++) { | |||||
| if (ss->face_sets[i] == SCULPT_FACE_SET_NONE) { | |||||
| ss->face_sets[i] = new_face_set; | |||||
| } | |||||
| } | |||||
| /* Update the Face Sets visibility with the vertex visibility changes that may have been done | |||||
| * outside Sculpt Mode */ | |||||
| SCULPT_visibility_sync_all_vertex_to_face_sets(ob->sculpt); | |||||
| } | } | ||||
| static int ed_object_sculptmode_flush_recalc_flag(Scene *scene, | static int ed_object_sculptmode_flush_recalc_flag(Scene *scene, | ||||
| Object *ob, | Object *ob, | ||||
| MultiresModifierData *mmd) | MultiresModifierData *mmd) | ||||
| { | { | ||||
| int flush_recalc = 0; | int flush_recalc = 0; | ||||
| /* Multires in sculpt mode could have different from object mode subdivision level. */ | /* Multires in sculpt mode could have different from object mode subdivision level. */ | ||||
| ▲ Show 20 Lines • Show All 3,145 Lines • Show Last 20 Lines | |||||
Wouldn't this also update all other facesets that were still 0? If not, please explain in the comment.