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,736 Lines • ▼ Show 20 Lines | static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSettings *ups) | ||||
| /* Build a list of all nodes that are potentially within the brush's area of influence */ | /* Build a list of all nodes that are potentially within the brush's area of influence */ | ||||
| if (SCULPT_tool_needs_all_pbvh_nodes(brush)) { | if (SCULPT_tool_needs_all_pbvh_nodes(brush)) { | ||||
| /* These brushes need to update all nodes as they are not constrained by the brush radius */ | /* These brushes need to update all nodes as they are not constrained by the brush radius */ | ||||
| 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) { | ||||
| if (brush->cloth_simulation_area_type == BRUSH_CLOTH_SIMULATION_AREA_LOCAL) { | nodes = SCULPT_cloth_brush_affected_nodes_gather(ss, brush, &totnode); | ||||
| SculptSearchSphereData data = { | |||||
| .ss = ss, | |||||
| .sd = sd, | |||||
| .radius_squared = square_f(ss->cache->initial_radius * (1.0 + brush->cloth_sim_limit)), | |||||
| .original = false, | |||||
| .ignore_fully_ineffective = false, | |||||
| .center = ss->cache->initial_location, | |||||
| }; | |||||
| BKE_pbvh_search_gather(ss->pbvh, SCULPT_search_sphere_cb, &data, &nodes, &totnode); | |||||
| } | |||||
| if (brush->cloth_simulation_area_type == BRUSH_CLOTH_SIMULATION_AREA_DYNAMIC) { | |||||
| SculptSearchSphereData data = { | |||||
| .ss = ss, | |||||
| .sd = sd, | |||||
| .radius_squared = square_f(ss->cache->radius * (1.0 + brush->cloth_sim_limit)), | |||||
| .original = false, | |||||
| .ignore_fully_ineffective = false, | |||||
| .center = ss->cache->location, | |||||
| }; | |||||
| BKE_pbvh_search_gather(ss->pbvh, SCULPT_search_sphere_cb, &data, &nodes, &totnode); | |||||
| } | |||||
| else { | |||||
| /* Gobal simulation, get all nodes. */ | |||||
| BKE_pbvh_search_gather(ss->pbvh, NULL, NULL, &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 : | ||||
| ss->cache->original; | ss->cache->original; | ||||
| float radius_scale = 1.0f; | float radius_scale = 1.0f; | ||||
| /* With these options enabled not all required nodes are inside the original brush radius, so | /* With these options enabled not all required nodes are inside the original brush radius, so | ||||
| * the brush can produce artifacts in some situations. */ | * the brush can produce artifacts in some situations. */ | ||||
| if (brush->sculpt_tool == SCULPT_TOOL_DRAW && brush->flag & BRUSH_ORIGINAL_NORMAL) { | if (brush->sculpt_tool == SCULPT_TOOL_DRAW && brush->flag & BRUSH_ORIGINAL_NORMAL) { | ||||
| ▲ Show 20 Lines • Show All 3,867 Lines • Show Last 20 Lines | |||||