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 5,510 Lines • ▼ Show 20 Lines | static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSettings *ups) | ||||
| /* This can be optimized by filtering the nodes after calculating the chain. */ | /* This can be optimized by filtering the nodes after calculating the chain. */ | ||||
| if (ELEM(brush->sculpt_tool, SCULPT_TOOL_ELASTIC_DEFORM, SCULPT_TOOL_POSE)) { | if (ELEM(brush->sculpt_tool, SCULPT_TOOL_ELASTIC_DEFORM, SCULPT_TOOL_POSE)) { | ||||
| BKE_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode); | BKE_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode); | ||||
| } | } | ||||
| else if (brush->sculpt_tool == SCULPT_TOOL_CLOTH) { | else if (brush->sculpt_tool == SCULPT_TOOL_CLOTH) { | ||||
| SculptSearchSphereData data = { | SculptSearchSphereData data = { | ||||
| .ss = ss, | .ss = ss, | ||||
| .sd = sd, | .sd = sd, | ||||
| .radius_squared = square_f(ss->cache->radius * (1.0 + brush->cloth_sim_limit)), | .radius_squared = square_f(ss->cache->initial_radius * (1.0 + brush->cloth_sim_limit)), | ||||
| .original = false, | .original = false, | ||||
| .ignore_fully_ineffective = false, | .ignore_fully_ineffective = false, | ||||
| .center = ss->cache->initial_location, | .center = ss->cache->initial_location, | ||||
| }; | }; | ||||
| BKE_pbvh_search_gather(ss->pbvh, SCULPT_search_sphere_cb, &data, &nodes, &totnode); | BKE_pbvh_search_gather(ss->pbvh, SCULPT_search_sphere_cb, &data, &nodes, &totnode); | ||||
| } | } | ||||
| else { | else { | ||||
| const bool use_original = sculpt_tool_needs_original(brush->sculpt_tool) ? true : | const bool use_original = sculpt_tool_needs_original(brush->sculpt_tool) ? true : | ||||
| ▲ Show 20 Lines • Show All 1,675 Lines • ▼ Show 20 Lines | static void sculpt_brush_stroke_init(bContext *C, wmOperator *op) | ||||
| BKE_sculpt_update_object_for_edit(depsgraph, ob, is_smooth, need_mask, needs_colors); | BKE_sculpt_update_object_for_edit(depsgraph, ob, is_smooth, need_mask, needs_colors); | ||||
| } | } | ||||
| static void sculpt_restore_mesh(Sculpt *sd, Object *ob) | static void sculpt_restore_mesh(Sculpt *sd, Object *ob) | ||||
| { | { | ||||
| SculptSession *ss = ob->sculpt; | SculptSession *ss = ob->sculpt; | ||||
| Brush *brush = BKE_paint_brush(&sd->paint); | Brush *brush = BKE_paint_brush(&sd->paint); | ||||
| /* For the cloth brush it makes more sense to not restore the mesh state to keep running the | |||||
| * simulation from the previous state. */ | |||||
| if (brush->sculpt_tool == SCULPT_TOOL_CLOTH) { | |||||
| return; | |||||
| } | |||||
| /* Restore the mesh before continuing with anchored stroke. */ | /* Restore the mesh before continuing with anchored stroke. */ | ||||
| if ((brush->flag & BRUSH_ANCHORED) || | if ((brush->flag & BRUSH_ANCHORED) || | ||||
| ((brush->sculpt_tool == SCULPT_TOOL_GRAB || | ((brush->sculpt_tool == SCULPT_TOOL_GRAB || | ||||
| brush->sculpt_tool == SCULPT_TOOL_ELASTIC_DEFORM || | brush->sculpt_tool == SCULPT_TOOL_ELASTIC_DEFORM) && | ||||
| brush->sculpt_tool == SCULPT_TOOL_CLOTH) && | |||||
| BKE_brush_use_size_pressure(brush)) || | BKE_brush_use_size_pressure(brush)) || | ||||
| (brush->flag & BRUSH_DRAG_DOT)) { | (brush->flag & BRUSH_DRAG_DOT)) { | ||||
| SculptUndoNode *unode = SCULPT_undo_get_first_node(); | SculptUndoNode *unode = SCULPT_undo_get_first_node(); | ||||
| if (unode && unode->type == SCULPT_UNDO_FACE_SETS) { | if (unode && unode->type == SCULPT_UNDO_FACE_SETS) { | ||||
| for (int i = 0; i < ss->totfaces; i++) { | for (int i = 0; i < ss->totfaces; i++) { | ||||
| ss->face_sets[i] = unode->face_sets[i]; | ss->face_sets[i] = unode->face_sets[i]; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,763 Lines • Show Last 20 Lines | |||||