Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/paint_mask.c
| Show First 20 Lines • Show All 163 Lines • ▼ Show 20 Lines | static int mask_flood_fill_exec(bContext *C, wmOperator *op) | ||||
| value = RNA_float_get(op->ptr, "value"); | value = RNA_float_get(op->ptr, "value"); | ||||
| BKE_sculpt_update_object_for_edit(depsgraph, ob, false, true, false); | BKE_sculpt_update_object_for_edit(depsgraph, ob, false, true, false); | ||||
| pbvh = ob->sculpt->pbvh; | pbvh = ob->sculpt->pbvh; | ||||
| multires = (BKE_pbvh_type(pbvh) == PBVH_GRIDS); | multires = (BKE_pbvh_type(pbvh) == PBVH_GRIDS); | ||||
| BKE_pbvh_search_gather(pbvh, NULL, NULL, &nodes, &totnode); | BKE_pbvh_search_gather(pbvh, NULL, NULL, &nodes, &totnode); | ||||
| SCULPT_undo_push_begin("Mask flood fill"); | SCULPT_undo_push_begin(C, "Mask flood fill"); | ||||
| MaskTaskData data = { | MaskTaskData data = { | ||||
| .ob = ob, | .ob = ob, | ||||
| .pbvh = pbvh, | .pbvh = pbvh, | ||||
| .nodes = nodes, | .nodes = nodes, | ||||
| .multires = multires, | .multires = multires, | ||||
| .mode = mode, | .mode = mode, | ||||
| .value = value, | .value = value, | ||||
| }; | }; | ||||
| TaskParallelSettings settings; | TaskParallelSettings settings; | ||||
| BKE_pbvh_parallel_range_settings(&settings, true, totnode); | BKE_pbvh_parallel_range_settings(&settings, true, totnode); | ||||
| BLI_task_parallel_range(0, totnode, &data, mask_flood_fill_task_cb, &settings); | BLI_task_parallel_range(0, totnode, &data, mask_flood_fill_task_cb, &settings); | ||||
| if (multires) { | if (multires) { | ||||
| multires_mark_as_modified(depsgraph, ob, MULTIRES_COORDS_MODIFIED); | multires_mark_as_modified(depsgraph, ob, MULTIRES_COORDS_MODIFIED); | ||||
| } | } | ||||
| BKE_pbvh_update_vertex_data(pbvh, PBVH_UpdateMask); | BKE_pbvh_update_vertex_data(pbvh, PBVH_UpdateMask); | ||||
| SCULPT_undo_push_end(); | SCULPT_undo_push_end(C); | ||||
| if (nodes) { | if (nodes) { | ||||
| MEM_freeN(nodes); | MEM_freeN(nodes); | ||||
| } | } | ||||
| SCULPT_tag_update_overlays(C); | SCULPT_tag_update_overlays(C); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| ▲ Show 20 Lines • Show All 500 Lines • ▼ Show 20 Lines | case SCULPT_GESTURE_SHAPE_LINE: | ||||
| return plane_point_side_v3(sgcontext->line.plane, vd->co) > 0.0f; | return plane_point_side_v3(sgcontext->line.plane, vd->co) > 0.0f; | ||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| static void sculpt_gesture_apply(bContext *C, SculptGestureContext *sgcontext) | static void sculpt_gesture_apply(bContext *C, SculptGestureContext *sgcontext) | ||||
| { | { | ||||
| SculptGestureOperation *operation = sgcontext->operation; | SculptGestureOperation *operation = sgcontext->operation; | ||||
| SCULPT_undo_push_begin("Sculpt Gesture Apply"); | SCULPT_undo_push_begin(C, "Sculpt Gesture Apply"); | ||||
| operation->sculpt_gesture_begin(C, sgcontext); | operation->sculpt_gesture_begin(C, sgcontext); | ||||
| for (ePaintSymmetryFlags symmpass = 0; symmpass <= sgcontext->symm; symmpass++) { | for (ePaintSymmetryFlags symmpass = 0; symmpass <= sgcontext->symm; symmpass++) { | ||||
| if (SCULPT_is_symmetry_iteration_valid(symmpass, sgcontext->symm)) { | if (SCULPT_is_symmetry_iteration_valid(symmpass, sgcontext->symm)) { | ||||
| sculpt_gesture_flip_for_symmetry_pass(sgcontext, symmpass); | sculpt_gesture_flip_for_symmetry_pass(sgcontext, symmpass); | ||||
| sculpt_gesture_update_effected_nodes(sgcontext); | sculpt_gesture_update_effected_nodes(sgcontext); | ||||
| operation->sculpt_gesture_apply_for_symmetry_pass(C, sgcontext); | operation->sculpt_gesture_apply_for_symmetry_pass(C, sgcontext); | ||||
| MEM_SAFE_FREE(sgcontext->nodes); | MEM_SAFE_FREE(sgcontext->nodes); | ||||
| } | } | ||||
| } | } | ||||
| operation->sculpt_gesture_end(C, sgcontext); | operation->sculpt_gesture_end(C, sgcontext); | ||||
| SCULPT_undo_push_end(); | SCULPT_undo_push_end(C); | ||||
| SCULPT_tag_update_overlays(C); | SCULPT_tag_update_overlays(C); | ||||
| } | } | ||||
| /* Face Set Gesture Operation. */ | /* Face Set Gesture Operation. */ | ||||
| typedef struct SculptGestureFaceSetOperation { | typedef struct SculptGestureFaceSetOperation { | ||||
| SculptGestureOperation op; | SculptGestureOperation op; | ||||
| ▲ Show 20 Lines • Show All 1,052 Lines • Show Last 20 Lines | |||||