Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/sculpt_pose.c
| Show First 20 Lines • Show All 151 Lines • ▼ Show 20 Lines | static void do_pose_brush_task_cb_ex(void *__restrict userdata, | ||||
| const Brush *brush = data->brush; | const Brush *brush = data->brush; | ||||
| PBVHVertexIter vd; | PBVHVertexIter vd; | ||||
| float disp[3], new_co[3]; | float disp[3], new_co[3]; | ||||
| float final_pos[3]; | float final_pos[3]; | ||||
| SculptOrigVertData orig_data; | SculptOrigVertData orig_data; | ||||
| SCULPT_orig_vert_data_init(&orig_data, data->ob, data->nodes[n], SCULPT_UNDO_COORDS); | SCULPT_orig_vert_data_init(&orig_data, data->ob, data->nodes[n], SCULPT_UNDO_COORDS); | ||||
| AutomaskingNodeData automask_data; | |||||
| SCULPT_automasking_node_begin( | |||||
| data->ob, ss, ss->cache->automasking, &automask_data, data->nodes[n]); | |||||
| BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) { | BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) { | ||||
| SCULPT_orig_vert_data_update(&orig_data, &vd); | SCULPT_orig_vert_data_update(&orig_data, &vd); | ||||
| SCULPT_automasking_node_update(ss, &automask_data, &vd); | |||||
| float total_disp[3]; | float total_disp[3]; | ||||
| zero_v3(total_disp); | zero_v3(total_disp); | ||||
| ePaintSymmetryAreas symm_area = SCULPT_get_vertex_symm_area(orig_data.co); | ePaintSymmetryAreas symm_area = SCULPT_get_vertex_symm_area(orig_data.co); | ||||
| /* Calculate the displacement of each vertex for all the segments in the chain. */ | /* Calculate the displacement of each vertex for all the segments in the chain. */ | ||||
| for (int ik = 0; ik < ik_chain->tot_segments; ik++) { | for (int ik = 0; ik < ik_chain->tot_segments; ik++) { | ||||
| copy_v3_v3(new_co, orig_data.co); | copy_v3_v3(new_co, orig_data.co); | ||||
| /* Get the transform matrix for the vertex symmetry area to calculate a displacement in the | /* Get the transform matrix for the vertex symmetry area to calculate a displacement in the | ||||
| * vertex. */ | * vertex. */ | ||||
| mul_m4_v3(segments[ik].pivot_mat_inv[(int)symm_area], new_co); | mul_m4_v3(segments[ik].pivot_mat_inv[(int)symm_area], new_co); | ||||
| mul_m4_v3(segments[ik].trans_mat[(int)symm_area], new_co); | mul_m4_v3(segments[ik].trans_mat[(int)symm_area], new_co); | ||||
| mul_m4_v3(segments[ik].pivot_mat[(int)symm_area], new_co); | mul_m4_v3(segments[ik].pivot_mat[(int)symm_area], new_co); | ||||
| /* Apply the segment weight of the vertex to the displacement. */ | /* Apply the segment weight of the vertex to the displacement. */ | ||||
| sub_v3_v3v3(disp, new_co, orig_data.co); | sub_v3_v3v3(disp, new_co, orig_data.co); | ||||
| mul_v3_fl(disp, segments[ik].weights[vd.index]); | mul_v3_fl(disp, segments[ik].weights[vd.index]); | ||||
| /* Apply the vertex mask to the displacement. */ | /* Apply the vertex mask to the displacement. */ | ||||
| const float mask = vd.mask ? 1.0f - *vd.mask : 1.0f; | const float mask = vd.mask ? 1.0f - *vd.mask : 1.0f; | ||||
| const float automask = SCULPT_automasking_factor_get(ss->cache->automasking, ss, vd.vertex); | const float automask = SCULPT_automasking_factor_get( | ||||
| ss->cache->automasking, ss, vd.vertex, &automask_data); | |||||
| mul_v3_fl(disp, mask * automask); | mul_v3_fl(disp, mask * automask); | ||||
| /* Accumulate the displacement. */ | /* Accumulate the displacement. */ | ||||
| add_v3_v3(total_disp, disp); | add_v3_v3(total_disp, disp); | ||||
| } | } | ||||
| /* Apply the accumulated displacement to the vertex. */ | /* Apply the accumulated displacement to the vertex. */ | ||||
| add_v3_v3v3(final_pos, orig_data.co, total_disp); | add_v3_v3v3(final_pos, orig_data.co, total_disp); | ||||
| ▲ Show 20 Lines • Show All 1,049 Lines • Show Last 20 Lines | |||||