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,667 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. */ | |||||
| /* 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 | |||||
| * geometry. */ | |||||
| SculptSession *ss = ob->sculpt; | |||||
| const int new_face_set = SCULPT_face_set_next_available_get(ss); | |||||
| for (int i = 0; i < ss->totpoly; i++) { | |||||
| if (ss->face_sets[i] == SCULPT_FACE_SET_NONE) { | |||||
jbakker: Wouldn't this also update all other facesets that were still 0? If not, please explain in the… | |||||
| 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 696 Lines • ▼ Show 20 Lines | static EnumPropertyItem prop_mesh_filter_deform_axis_items[] = { | ||||
| {MESH_FILTER_DEFORM_Y, "Y", 0, "Y", "Deform in the Y axis"}, | {MESH_FILTER_DEFORM_Y, "Y", 0, "Y", "Deform in the Y axis"}, | ||||
| {MESH_FILTER_DEFORM_Z, "Z", 0, "Z", "Deform in the Z axis"}, | {MESH_FILTER_DEFORM_Z, "Z", 0, "Z", "Deform in the Z axis"}, | ||||
| {0, NULL, 0, NULL, NULL}, | {0, NULL, 0, NULL, NULL}, | ||||
| }; | }; | ||||
| static bool sculpt_mesh_filter_needs_pmap(int filter_type, bool use_face_sets) | static bool sculpt_mesh_filter_needs_pmap(int filter_type, bool use_face_sets) | ||||
| { | { | ||||
| return use_face_sets || ELEM(filter_type, | return use_face_sets || ELEM(filter_type, | ||||
| MESH_FILTER_SMOOTH, | MESH_FILTER_SMOOTH, | ||||
| MESH_FILTER_RELAX, | MESH_FILTER_RELAX, | ||||
| MESH_FILTER_RELAX_FACE_SETS, | MESH_FILTER_RELAX_FACE_SETS, | ||||
| MESH_FILTER_SURFACE_SMOOTH); | MESH_FILTER_SURFACE_SMOOTH); | ||||
| } | } | ||||
| static void mesh_filter_task_cb(void *__restrict userdata, | static void mesh_filter_task_cb(void *__restrict userdata, | ||||
| const int i, | const int i, | ||||
| const TaskParallelTLS *__restrict UNUSED(tls)) | const TaskParallelTLS *__restrict UNUSED(tls)) | ||||
| { | { | ||||
| SculptThreadedTaskData *data = userdata; | SculptThreadedTaskData *data = userdata; | ||||
| SculptSession *ss = data->ob->sculpt; | SculptSession *ss = data->ob->sculpt; | ||||
| ▲ Show 20 Lines • Show All 2,435 Lines • Show Last 20 Lines | |||||
Wouldn't this also update all other facesets that were still 0? If not, please explain in the comment.