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,917 Lines • ▼ Show 20 Lines | if (ss->cache->invert) { | ||||
| ss->cache->paint_face_set = SCULPT_active_face_set_get(ss); | ss->cache->paint_face_set = SCULPT_active_face_set_get(ss); | ||||
| } | } | ||||
| else { | else { | ||||
| /* By default create a new Face Sets. */ | /* By default create a new Face Sets. */ | ||||
| ss->cache->paint_face_set = SCULPT_face_set_next_available_get(ss); | ss->cache->paint_face_set = SCULPT_face_set_next_available_get(ss); | ||||
| } | } | ||||
| } | } | ||||
| /* Initialize automasking cache. For anchored brushes with spherical falloff, we start off with | |||||
| * zero radius, thus we have no pbvh nodes on the first brush step. */ | |||||
| if (totnode || | |||||
| ((brush->falloff_shape == PAINT_FALLOFF_SHAPE_SPHERE) && (brush->flag & BRUSH_ANCHORED))) { | |||||
| if (SCULPT_stroke_is_first_brush_step(ss->cache)) { | |||||
| if (SCULPT_is_automasking_enabled(sd, ss, brush)) { | |||||
| ss->cache->automasking = SCULPT_automasking_cache_init(sd, brush, ob); | |||||
| } | |||||
| } | |||||
| } | |||||
| /* Only act if some verts are inside the brush area. */ | /* Only act if some verts are inside the brush area. */ | ||||
| if (totnode) { | if (totnode) { | ||||
| float location[3]; | float location[3]; | ||||
| SculptThreadedTaskData task_data = { | SculptThreadedTaskData task_data = { | ||||
| .sd = sd, | .sd = sd, | ||||
| .ob = ob, | .ob = ob, | ||||
| .brush = brush, | .brush = brush, | ||||
| .nodes = nodes, | .nodes = nodes, | ||||
| }; | }; | ||||
| 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, &task_data, do_brush_action_task_cb, &settings); | BLI_task_parallel_range(0, totnode, &task_data, do_brush_action_task_cb, &settings); | ||||
| if (sculpt_brush_needs_normal(ss, brush)) { | if (sculpt_brush_needs_normal(ss, brush)) { | ||||
| update_sculpt_normal(sd, ob, nodes, totnode); | update_sculpt_normal(sd, ob, nodes, totnode); | ||||
| } | } | ||||
| if (brush->mtex.brush_map_mode == MTEX_MAP_MODE_AREA) { | if (brush->mtex.brush_map_mode == MTEX_MAP_MODE_AREA) { | ||||
| update_brush_local_mat(sd, ob); | update_brush_local_mat(sd, ob); | ||||
| } | } | ||||
| if (SCULPT_stroke_is_first_brush_step(ss->cache)) { | |||||
| if (SCULPT_is_automasking_enabled(sd, ss, brush)) { | |||||
| ss->cache->automasking = SCULPT_automasking_cache_init(sd, brush, ob); | |||||
| } | |||||
| } | |||||
| if (brush->sculpt_tool == SCULPT_TOOL_POSE && SCULPT_stroke_is_first_brush_step(ss->cache)) { | if (brush->sculpt_tool == SCULPT_TOOL_POSE && SCULPT_stroke_is_first_brush_step(ss->cache)) { | ||||
| SCULPT_pose_brush_init(sd, ob, ss, brush); | SCULPT_pose_brush_init(sd, ob, ss, brush); | ||||
| } | } | ||||
| if (brush->deform_target == BRUSH_DEFORM_TARGET_CLOTH_SIM) { | if (brush->deform_target == BRUSH_DEFORM_TARGET_CLOTH_SIM) { | ||||
| if (!ss->cache->cloth_sim) { | if (!ss->cache->cloth_sim) { | ||||
| ss->cache->cloth_sim = SCULPT_cloth_brush_simulation_create( | ss->cache->cloth_sim = SCULPT_cloth_brush_simulation_create( | ||||
| ss, 1.0f, 0.0f, 0.0f, false, true); | ss, 1.0f, 0.0f, 0.0f, false, true); | ||||
| ▲ Show 20 Lines • Show All 3,809 Lines • Show Last 20 Lines | |||||