Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/sculpt_boundary.c
| Show First 20 Lines • Show All 675 Lines • ▼ Show 20 Lines | static void do_boundary_brush_bend_task_cb_ex(void *__restrict userdata, | ||||
| const float disp = strength * sculpt_boundary_displacement_from_grab_delta_get(ss, boundary); | const float disp = strength * sculpt_boundary_displacement_from_grab_delta_get(ss, boundary); | ||||
| float angle_factor = disp / ss->cache->radius; | float angle_factor = disp / ss->cache->radius; | ||||
| /* Angle Snapping when inverting the brush. */ | /* Angle Snapping when inverting the brush. */ | ||||
| if (ss->cache->invert) { | if (ss->cache->invert) { | ||||
| angle_factor = floorf(angle_factor * 10) / 10.0f; | angle_factor = floorf(angle_factor * 10) / 10.0f; | ||||
| } | } | ||||
| const float angle = angle_factor * M_PI; | const float angle = angle_factor * M_PI; | ||||
| 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) { | ||||
| if (boundary->edit_info[vd.index].propagation_steps_num == -1) { | if (boundary->edit_info[vd.index].propagation_steps_num == -1) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| SCULPT_automasking_node_update(ss, &automask_data, &vd); | |||||
| SCULPT_orig_vert_data_update(&orig_data, &vd); | SCULPT_orig_vert_data_update(&orig_data, &vd); | ||||
| if (!SCULPT_check_vertex_pivot_symmetry( | if (!SCULPT_check_vertex_pivot_symmetry( | ||||
| orig_data.co, boundary->initial_vertex_position, symm)) { | orig_data.co, boundary->initial_vertex_position, symm)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| 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); | |||||
| float t_orig_co[3]; | float t_orig_co[3]; | ||||
| float *target_co = SCULPT_brush_deform_target_vertex_co_get(ss, brush->deform_target, &vd); | float *target_co = SCULPT_brush_deform_target_vertex_co_get(ss, brush->deform_target, &vd); | ||||
| sub_v3_v3v3(t_orig_co, orig_data.co, boundary->bend.pivot_positions[vd.index]); | sub_v3_v3v3(t_orig_co, orig_data.co, boundary->bend.pivot_positions[vd.index]); | ||||
| rotate_v3_v3v3fl(target_co, | rotate_v3_v3v3fl(target_co, | ||||
| t_orig_co, | t_orig_co, | ||||
| boundary->bend.pivot_rotation_axis[vd.index], | boundary->bend.pivot_rotation_axis[vd.index], | ||||
| angle * boundary->edit_info[vd.index].strength_factor * mask * automask); | angle * boundary->edit_info[vd.index].strength_factor * mask * automask); | ||||
| add_v3_v3(target_co, boundary->bend.pivot_positions[vd.index]); | add_v3_v3(target_co, boundary->bend.pivot_positions[vd.index]); | ||||
| Show All 18 Lines | static void do_boundary_brush_slide_task_cb_ex(void *__restrict userdata, | ||||
| const float strength = ss->cache->bstrength; | const float strength = ss->cache->bstrength; | ||||
| PBVHVertexIter vd; | PBVHVertexIter vd; | ||||
| 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); | ||||
| const float disp = sculpt_boundary_displacement_from_grab_delta_get(ss, boundary); | const float disp = sculpt_boundary_displacement_from_grab_delta_get(ss, boundary); | ||||
| 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) { | ||||
| if (boundary->edit_info[vd.index].propagation_steps_num == -1) { | if (boundary->edit_info[vd.index].propagation_steps_num == -1) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| SCULPT_automasking_node_update(ss, &automask_data, &vd); | |||||
| SCULPT_orig_vert_data_update(&orig_data, &vd); | SCULPT_orig_vert_data_update(&orig_data, &vd); | ||||
| if (!SCULPT_check_vertex_pivot_symmetry( | if (!SCULPT_check_vertex_pivot_symmetry( | ||||
| orig_data.co, boundary->initial_vertex_position, symm)) { | orig_data.co, boundary->initial_vertex_position, symm)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| 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); | |||||
| float *target_co = SCULPT_brush_deform_target_vertex_co_get(ss, brush->deform_target, &vd); | float *target_co = SCULPT_brush_deform_target_vertex_co_get(ss, brush->deform_target, &vd); | ||||
| madd_v3_v3v3fl(target_co, | madd_v3_v3v3fl(target_co, | ||||
| orig_data.co, | orig_data.co, | ||||
| boundary->slide.directions[vd.index], | boundary->slide.directions[vd.index], | ||||
| boundary->edit_info[vd.index].strength_factor * disp * mask * automask * | boundary->edit_info[vd.index].strength_factor * disp * mask * automask * | ||||
| strength); | strength); | ||||
| if (vd.mvert) { | if (vd.mvert) { | ||||
| Show All 14 Lines | static void do_boundary_brush_inflate_task_cb_ex(void *__restrict userdata, | ||||
| const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(data->ob); | const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(data->ob); | ||||
| const Brush *brush = data->brush; | const Brush *brush = data->brush; | ||||
| const float strength = ss->cache->bstrength; | const float strength = ss->cache->bstrength; | ||||
| PBVHVertexIter vd; | PBVHVertexIter vd; | ||||
| 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]); | |||||
| const float disp = sculpt_boundary_displacement_from_grab_delta_get(ss, boundary); | const float disp = sculpt_boundary_displacement_from_grab_delta_get(ss, boundary); | ||||
| 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) { | ||||
| if (boundary->edit_info[vd.index].propagation_steps_num == -1) { | if (boundary->edit_info[vd.index].propagation_steps_num == -1) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| SCULPT_automasking_node_update(ss, &automask_data, &vd); | |||||
| SCULPT_orig_vert_data_update(&orig_data, &vd); | SCULPT_orig_vert_data_update(&orig_data, &vd); | ||||
| if (!SCULPT_check_vertex_pivot_symmetry( | if (!SCULPT_check_vertex_pivot_symmetry( | ||||
| orig_data.co, boundary->initial_vertex_position, symm)) { | orig_data.co, boundary->initial_vertex_position, symm)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| 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); | |||||
| float *target_co = SCULPT_brush_deform_target_vertex_co_get(ss, brush->deform_target, &vd); | float *target_co = SCULPT_brush_deform_target_vertex_co_get(ss, brush->deform_target, &vd); | ||||
| madd_v3_v3v3fl(target_co, | madd_v3_v3v3fl(target_co, | ||||
| orig_data.co, | orig_data.co, | ||||
| orig_data.no, | orig_data.no, | ||||
| boundary->edit_info[vd.index].strength_factor * disp * mask * automask * | boundary->edit_info[vd.index].strength_factor * disp * mask * automask * | ||||
| strength); | strength); | ||||
| if (vd.mvert) { | if (vd.mvert) { | ||||
| Show All 14 Lines | static void do_boundary_brush_grab_task_cb_ex(void *__restrict userdata, | ||||
| const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(data->ob); | const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(data->ob); | ||||
| const Brush *brush = data->brush; | const Brush *brush = data->brush; | ||||
| const float strength = ss->cache->bstrength; | const float strength = ss->cache->bstrength; | ||||
| PBVHVertexIter vd; | PBVHVertexIter vd; | ||||
| 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) { | ||||
| if (boundary->edit_info[vd.index].propagation_steps_num == -1) { | if (boundary->edit_info[vd.index].propagation_steps_num == -1) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| SCULPT_automasking_node_update(ss, &automask_data, &vd); | |||||
| SCULPT_orig_vert_data_update(&orig_data, &vd); | SCULPT_orig_vert_data_update(&orig_data, &vd); | ||||
| if (!SCULPT_check_vertex_pivot_symmetry( | if (!SCULPT_check_vertex_pivot_symmetry( | ||||
| orig_data.co, boundary->initial_vertex_position, symm)) { | orig_data.co, boundary->initial_vertex_position, symm)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| 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); | |||||
| float *target_co = SCULPT_brush_deform_target_vertex_co_get(ss, brush->deform_target, &vd); | float *target_co = SCULPT_brush_deform_target_vertex_co_get(ss, brush->deform_target, &vd); | ||||
| madd_v3_v3v3fl(target_co, | madd_v3_v3v3fl(target_co, | ||||
| orig_data.co, | orig_data.co, | ||||
| ss->cache->grab_delta_symmetry, | ss->cache->grab_delta_symmetry, | ||||
| boundary->edit_info[vd.index].strength_factor * mask * automask * strength); | boundary->edit_info[vd.index].strength_factor * mask * automask * strength); | ||||
| if (vd.mvert) { | if (vd.mvert) { | ||||
| BKE_pbvh_vert_tag_update_normal(ss->pbvh, vd.vertex); | BKE_pbvh_vert_tag_update_normal(ss->pbvh, vd.vertex); | ||||
| Show All 13 Lines | static void do_boundary_brush_twist_task_cb_ex(void *__restrict userdata, | ||||
| const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(data->ob); | const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(data->ob); | ||||
| const Brush *brush = data->brush; | const Brush *brush = data->brush; | ||||
| const float strength = ss->cache->bstrength; | const float strength = ss->cache->bstrength; | ||||
| PBVHVertexIter vd; | PBVHVertexIter vd; | ||||
| 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]); | |||||
| const float disp = strength * sculpt_boundary_displacement_from_grab_delta_get(ss, boundary); | const float disp = strength * sculpt_boundary_displacement_from_grab_delta_get(ss, boundary); | ||||
| float angle_factor = disp / ss->cache->radius; | float angle_factor = disp / ss->cache->radius; | ||||
| /* Angle Snapping when inverting the brush. */ | /* Angle Snapping when inverting the brush. */ | ||||
| if (ss->cache->invert) { | if (ss->cache->invert) { | ||||
| angle_factor = floorf(angle_factor * 10) / 10.0f; | angle_factor = floorf(angle_factor * 10) / 10.0f; | ||||
| } | } | ||||
| const float angle = angle_factor * M_PI; | const float angle = angle_factor * M_PI; | ||||
| 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) { | ||||
| if (boundary->edit_info[vd.index].propagation_steps_num == -1) { | if (boundary->edit_info[vd.index].propagation_steps_num == -1) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| SCULPT_automasking_node_update(ss, &automask_data, &vd); | |||||
| SCULPT_orig_vert_data_update(&orig_data, &vd); | SCULPT_orig_vert_data_update(&orig_data, &vd); | ||||
| if (!SCULPT_check_vertex_pivot_symmetry( | if (!SCULPT_check_vertex_pivot_symmetry( | ||||
| orig_data.co, boundary->initial_vertex_position, symm)) { | orig_data.co, boundary->initial_vertex_position, symm)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| 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); | |||||
| float t_orig_co[3]; | float t_orig_co[3]; | ||||
| float *target_co = SCULPT_brush_deform_target_vertex_co_get(ss, brush->deform_target, &vd); | float *target_co = SCULPT_brush_deform_target_vertex_co_get(ss, brush->deform_target, &vd); | ||||
| sub_v3_v3v3(t_orig_co, orig_data.co, boundary->twist.pivot_position); | sub_v3_v3v3(t_orig_co, orig_data.co, boundary->twist.pivot_position); | ||||
| rotate_v3_v3v3fl(target_co, | rotate_v3_v3v3fl(target_co, | ||||
| t_orig_co, | t_orig_co, | ||||
| boundary->twist.rotation_axis, | boundary->twist.rotation_axis, | ||||
| angle * mask * automask * boundary->edit_info[vd.index].strength_factor); | angle * mask * automask * boundary->edit_info[vd.index].strength_factor); | ||||
| add_v3_v3(target_co, boundary->twist.pivot_position); | add_v3_v3(target_co, boundary->twist.pivot_position); | ||||
| ▲ Show 20 Lines • Show All 180 Lines • Show Last 20 Lines | |||||