44static bool check_counts(
const int neighbor_count,
const int boundary_vertex_count)
48 if (neighbor_count <= 2) {
54 if (boundary_vertex_count > 2) {
71 const int initial_vert)
73 if (!hide_vert.
is_empty() && hide_vert[initial_vert]) {
77 int neighbor_count = 0;
78 int boundary_vertex_count = 0;
82 faces, corner_verts, vert_to_face, hide_poly, initial_vert, neighbors))
84 if (hide_vert.
is_empty() || !hide_vert[neighbor]) {
87 boundary_vertex_count++;
92 return check_counts(neighbor_count, boundary_vertex_count);
112 int neighbor_count = 0;
113 int boundary_vertex_count = 0;
118 faces, corner_verts, boundary_verts, boundary_edges, subdiv_ccg, neighbor))
120 boundary_vertex_count++;
125 return check_counts(neighbor_count, boundary_vertex_count);
134 int neighbor_count = 0;
135 int boundary_vertex_count = 0;
142 boundary_vertex_count++;
147 return check_counts(neighbor_count, boundary_vertex_count);
163 const int initial_vert,
173 const float3 initial_vert_position = vert_positions[initial_vert];
174 const float radius_sq = radius * radius;
176 std::optional<int> boundary_initial_vert;
177 int boundary_initial_vert_steps = std::numeric_limits<int>::max();
180 flood_fill.execute(
object, vert_to_face, [&](
int from_v,
int to_v) {
181 if (!hide_vert.
is_empty() && hide_vert[from_v]) {
185 floodfill_steps[to_v] = floodfill_steps[from_v] + 1;
188 if (floodfill_steps[to_v] < boundary_initial_vert_steps) {
189 boundary_initial_vert_steps = floodfill_steps[to_v];
190 boundary_initial_vert = to_v;
195 return len_sq < radius_sq;
198 return boundary_initial_vert;
212 faces, corner_verts, boundary_verts, boundary_edges, subdiv_ccg, initial_vert))
223 const float3 initial_vert_position = positions[initial_vert.
to_index(key)];
224 const float radius_sq = radius * radius;
226 int boundary_initial_vert_steps = std::numeric_limits<int>::max();
228 std::optional<SubdivCCGCoord> boundary_initial_vert;
232 const int to_v_index = to_v.
to_index(key);
233 const int from_v_index = from_v.
to_index(key);
240 floodfill_steps[to_v_index] = floodfill_steps[from_v_index];
243 floodfill_steps[to_v_index] = floodfill_steps[from_v_index] + 1;
247 faces, corner_verts, boundary_verts, boundary_edges, subdiv_ccg, to_v))
249 if (floodfill_steps[to_v_index] < boundary_initial_vert_steps) {
250 boundary_initial_vert_steps = floodfill_steps[to_v_index];
251 boundary_initial_vert = to_v;
257 return len_sq < radius_sq;
260 return boundary_initial_vert;
269 return &initial_vert;
276 const float3 initial_vert_position = initial_vert.
co;
277 const float radius_sq = radius * radius;
279 int boundary_initial_vert_steps = std::numeric_limits<int>::max();
281 std::optional<BMVert *> boundary_initial_vert;
291 floodfill_steps[to_v_i] = floodfill_steps[from_v_i] + 1;
294 if (floodfill_steps[to_v_i] < boundary_initial_vert_steps) {
295 boundary_initial_vert_steps = floodfill_steps[to_v_i];
296 boundary_initial_vert = to_v;
301 return len_sq < radius_sq;
304 return boundary_initial_vert;
326 included_verts.
add(new_index);
340 const int initial_boundary_vert,
347 flood_fill.add_initial(initial_boundary_vert);
349 flood_fill.execute(
object, vert_to_face, [&](
const int from_v,
const int to_v) {
350 const float3 from_v_co = vert_positions[from_v];
351 const float3 to_v_co = vert_positions[to_v];
356 const float edge_len =
len_v3v3(from_v_co, to_v_co);
357 const float distance_boundary_to_dst =
boundary.distance.lookup_default(from_v, 0.0f) +
360 boundary.edges.append({from_v_co, to_v_co});
362 faces, corner_verts, vert_to_face, hide_vert, hide_poly, boundary_verts, to_v);
379 const int initial_boundary_index = initial_vert.
to_index(key);
388 const int from_v_i = from_v.
to_index(key);
389 const int to_v_i = to_v.
to_index(key);
391 const float3 &from_v_co = positions[from_v_i];
392 const float3 &to_v_co = positions[to_v_i];
395 faces, corner_verts, boundary_verts, boundary_edges, subdiv_ccg, to_v))
399 const float edge_len =
len_v3v3(from_v_co, to_v_co);
400 const float distance_boundary_to_dst =
boundary.distance.lookup_default(from_v_i, 0.0f) +
404 boundary.edges.append({from_v_co, to_v_co});
407 faces, corner_verts, subdiv_ccg, boundary_verts, boundary_edges, to_v);
413 BMVert &initial_boundary_vert,
422 flood_fill.add_initial(&initial_boundary_vert);
428 const float3 from_v_co = from_v->
co;
434 const float edge_len =
len_v3v3(from_v_co, to_v_co);
435 const float distance_boundary_to_dst =
boundary.distance.lookup_default(from_v_i, 0.0f) +
438 boundary.edges.append({from_v_co, to_v_co});
449#define BOUNDARY_VERTEX_NONE -1
450#define BOUNDARY_STEPS_NONE -1
464 const int initial_vert_i,
473 std::queue<int> current_iteration;
475 for (
const int i :
boundary.verts.index_range()) {
482 current_iteration.push(vert);
485 int propagation_steps_num = 0;
486 float accum_distance = 0.0f;
488 std::queue<int> next_iteration;
493 if (accum_distance > radius || current_iteration.empty()) {
494 boundary.max_propagation_steps = propagation_steps_num;
498 while (!current_iteration.empty()) {
499 const int from_v = current_iteration.front();
500 current_iteration.pop();
504 faces, corner_verts, vert_to_face, hide_poly, from_v, neighbors))
506 if ((!hide_vert.
is_empty() && hide_vert[from_v]) ||
512 boundary.edit_info.original_vertex_i[neighbor] =
513 boundary.edit_info.original_vertex_i[from_v];
515 boundary.edit_info.propagation_steps_num[neighbor] =
516 boundary.edit_info.propagation_steps_num[from_v] + 1;
518 next_iteration.push(neighbor);
522 if (
boundary.edit_info.original_vertex_i[from_v] == initial_vert_i) {
523 boundary.pivot_position = vert_positions[neighbor];
530 while (!next_iteration.empty()) {
531 const int next_v = next_iteration.front();
532 next_iteration.pop();
533 current_iteration.push(next_v);
536 propagation_steps_num++;
541 const int initial_vert_i,
552 std::queue<SubdivCCGCoord> current_iteration;
554 for (
const int i :
boundary.verts.index_range()) {
565 boundary.edit_info.original_vertex_i[neighbor.to_index(key)] =
index;
568 current_iteration.push(vert);
571 int propagation_steps_num = 0;
572 float accum_distance = 0.0f;
574 std::queue<SubdivCCGCoord> next_iteration;
579 if (accum_distance > radius || current_iteration.empty()) {
580 boundary.max_propagation_steps = propagation_steps_num;
584 while (!current_iteration.empty()) {
586 current_iteration.pop();
588 const int from_v_i = from_v.
to_index(key);
594 const int neighbor_idx = neighbor.to_index(key);
598 subdiv_ccg.
grid_hidden[neighbor.grid_index][index_in_grid];
604 boundary.edit_info.original_vertex_i[neighbor_idx] =
605 boundary.edit_info.original_vertex_i[from_v_i];
607 boundary.edit_info.propagation_steps_num[neighbor_idx] =
608 boundary.edit_info.propagation_steps_num[from_v_i];
612 const int neighbor_idx = neighbor.to_index(key);
616 subdiv_ccg.
grid_hidden[neighbor.grid_index][index_in_grid];
622 boundary.edit_info.original_vertex_i[neighbor_idx] =
623 boundary.edit_info.original_vertex_i[from_v_i];
625 boundary.edit_info.propagation_steps_num[neighbor_idx] =
626 boundary.edit_info.propagation_steps_num[from_v_i] + 1;
628 next_iteration.push(neighbor);
639 const int neighbor_duplicate_index = coord.to_index(key);
640 boundary.edit_info.original_vertex_i[neighbor_duplicate_index] =
641 boundary.edit_info.original_vertex_i[from_v_i];
642 boundary.edit_info.propagation_steps_num[neighbor_duplicate_index] =
643 boundary.edit_info.propagation_steps_num[from_v_i] + 1;
648 if (
boundary.edit_info.original_vertex_i[from_v_i] == initial_vert_i) {
649 boundary.pivot_position = positions[neighbor_idx];
656 while (!next_iteration.empty()) {
658 next_iteration.pop();
659 current_iteration.push(next_v);
662 propagation_steps_num++;
667 const int initial_vert_i,
677 std::queue<BMVert *> current_iteration;
679 for (
const int i :
boundary.verts.index_range()) {
688 current_iteration.push(vert);
691 int propagation_steps_num = 0;
692 float accum_distance = 0.0f;
694 std::queue<BMVert *> next_iteration;
699 if (accum_distance > radius || current_iteration.empty()) {
700 boundary.max_propagation_steps = propagation_steps_num;
704 while (!current_iteration.empty()) {
705 BMVert *from_v = current_iteration.front();
706 current_iteration.pop();
718 boundary.edit_info.original_vertex_i[neighbor_idx] =
719 boundary.edit_info.original_vertex_i[from_v_i];
721 boundary.edit_info.propagation_steps_num[neighbor_idx] =
722 boundary.edit_info.propagation_steps_num[from_v_i] + 1;
724 next_iteration.push(neighbor);
728 if (
boundary.edit_info.original_vertex_i[from_v_i] == initial_vert_i) {
729 boundary.pivot_position = neighbor->co;
736 while (!next_iteration.empty()) {
737 BMVert *next_v = next_iteration.front();
738 next_iteration.pop();
739 current_iteration.push(next_v);
742 propagation_steps_num++;
763 boundary.edit_info.propagation_steps_num.size());
765 boundary.edit_info.strength_factor.size());
767 const int num_elements =
boundary.edit_info.strength_factor.size();
772 for (
const int i :
IndexRange(num_elements)) {
773 if (
boundary.edit_info.propagation_steps_num[i] !=
boundary.max_propagation_steps) {
777 const int orig_vert_i =
boundary.edit_info.original_vertex_i[i];
779 const float3 normal = vert_normals[i];
780 const float3 dir = vert_positions[orig_vert_i] - vert_positions[i];
782 boundary.bend.pivot_positions[orig_vert_i] = vert_positions[i];
785 for (
const int i :
IndexRange(num_elements)) {
789 const int orig_vert_i =
boundary.edit_info.original_vertex_i[i];
791 boundary.bend.pivot_positions[i] =
boundary.bend.pivot_positions[orig_vert_i];
792 boundary.bend.pivot_rotation_axis[i] =
boundary.bend.pivot_rotation_axis[orig_vert_i];
799 boundary.edit_info.propagation_steps_num.size());
801 boundary.edit_info.strength_factor.size());
803 const int num_elements =
boundary.edit_info.strength_factor.size();
811 for (
const int i :
IndexRange(num_elements)) {
812 if (
boundary.edit_info.propagation_steps_num[i] !=
boundary.max_propagation_steps) {
816 const int orig_vert_i =
boundary.edit_info.original_vertex_i[i];
818 const float3 normal = normals[i];
819 const float3 dir = positions[orig_vert_i] - positions[i];
821 boundary.bend.pivot_positions[orig_vert_i] = positions[i];
824 for (
const int i :
IndexRange(num_elements)) {
828 const int orig_vert_i =
boundary.edit_info.original_vertex_i[i];
830 boundary.bend.pivot_positions[i] =
boundary.bend.pivot_positions[orig_vert_i];
831 boundary.bend.pivot_rotation_axis[i] =
boundary.bend.pivot_rotation_axis[orig_vert_i];
838 boundary.edit_info.propagation_steps_num.size());
840 boundary.edit_info.strength_factor.size());
842 const int num_elements =
boundary.edit_info.strength_factor.size();
847 for (
const int i :
IndexRange(num_elements)) {
848 if (
boundary.edit_info.propagation_steps_num[i] !=
boundary.max_propagation_steps) {
853 const int orig_vert_i =
boundary.edit_info.original_vertex_i[i];
856 const float3 normal = vert->no;
859 boundary.bend.pivot_positions[
boundary.edit_info.original_vertex_i[i]] = vert->co;
862 for (
const int i :
IndexRange(num_elements)) {
866 const int orig_vert_i =
boundary.edit_info.original_vertex_i[i];
867 boundary.bend.pivot_positions[i] =
boundary.bend.pivot_positions[orig_vert_i];
868 boundary.bend.pivot_rotation_axis[i] =
boundary.bend.pivot_rotation_axis[orig_vert_i];
875 boundary.edit_info.propagation_steps_num.size());
877 boundary.edit_info.strength_factor.size());
879 const int num_elements =
boundary.edit_info.strength_factor.size();
882 for (
const int i :
IndexRange(num_elements)) {
883 if (
boundary.edit_info.propagation_steps_num[i] !=
boundary.max_propagation_steps) {
886 const int orig_vert_i =
boundary.edit_info.original_vertex_i[i];
891 for (
const int i :
IndexRange(num_elements)) {
903 boundary.edit_info.propagation_steps_num.size());
905 boundary.edit_info.strength_factor.size());
907 const int num_elements =
boundary.edit_info.strength_factor.size();
912 for (
const int i :
IndexRange(num_elements)) {
913 if (
boundary.edit_info.propagation_steps_num[i] !=
boundary.max_propagation_steps) {
916 const int orig_vert_i =
boundary.edit_info.original_vertex_i[i];
922 for (
const int i :
IndexRange(num_elements)) {
934 boundary.edit_info.propagation_steps_num.size());
936 boundary.edit_info.strength_factor.size());
938 const int num_elements =
boundary.edit_info.strength_factor.size();
941 for (
const int i :
IndexRange(num_elements)) {
942 if (
boundary.edit_info.propagation_steps_num[i] !=
boundary.max_propagation_steps) {
946 const int orig_vert_i =
boundary.edit_info.original_vertex_i[i];
952 for (
const int i :
IndexRange(num_elements)) {
992 positions[i] = vert->co;
1084 float3 from_pivot_to_pos = positions[i] - pivot_positions[i];
1087 new_positions[i] = rotated + pivot_positions[i];
1099 const float3 symmetry_pivot,
1100 const float strength,
1139 position_data.deform(translations, verts);
1144 new_positions.
as_span(), verts, cache.
cloth_sim->deformation_pos.as_mutable_span());
1159 const float3 symmetry_pivot,
1160 const float strength,
1174 subdiv_ccg, vert_factors, grids, tls.
factors);
1189 subdiv_ccg, vert_pivot_axes, grids, tls.
pivot_axes);
1211 cache.
cloth_sim->deformation_pos.as_mutable_span());
1225 const float3 symmetry_pivot,
1226 const float strength,
1258 calc_bend_position(orig_positions, pivot_positions, pivot_axes, factors, new_positions);
1274 new_positions.
as_span(), verts, cache.
cloth_sim->deformation_pos.as_mutable_span());
1284 const float strength,
1288 switch (
pbvh.type()) {
1298 boundary.edit_info.propagation_steps_num,
1299 boundary.edit_info.strength_factor,
1313 SubdivCCG &subdiv_ccg = *
object.runtime->sculpt_session->subdiv_ccg;
1324 boundary.edit_info.propagation_steps_num,
1325 boundary.edit_info.strength_factor,
1347 boundary.edit_info.propagation_steps_num,
1348 boundary.edit_info.strength_factor,
1362 pbvh.tag_positions_changed(node_mask);
1363 pbvh.flush_bounds_to_parents();
1382 new_positions[i] = positions[i] + (directions[i] * factors[i]);
1393 const float3 symmetry_pivot,
1394 const float strength,
1431 position_data.deform(translations, verts);
1436 new_positions.
as_span(), verts, cache.
cloth_sim->deformation_pos.as_mutable_span());
1450 const float3 symmetry_pivot,
1451 const float strength,
1465 subdiv_ccg, vert_factors, grids, tls.
factors);
1501 cache.
cloth_sim->deformation_pos.as_mutable_span());
1514 const float3 symmetry_pivot,
1515 const float strength,
1562 new_positions.
as_span(), verts, cache.
cloth_sim->deformation_pos.as_mutable_span());
1572 const float strength,
1576 switch (
pbvh.type()) {
1586 boundary.edit_info.propagation_steps_num,
1587 boundary.edit_info.strength_factor,
1600 SubdivCCG &subdiv_ccg = *
object.runtime->sculpt_session->subdiv_ccg;
1611 boundary.edit_info.propagation_steps_num,
1612 boundary.edit_info.strength_factor,
1633 boundary.edit_info.propagation_steps_num,
1634 boundary.edit_info.strength_factor,
1647 pbvh.tag_positions_changed(node_mask);
1648 pbvh.flush_bounds_to_parents();
1667 new_positions[i] = positions[i] + (normals[i] * factors[i]);
1677 const float3 symmetry_pivot,
1678 const float strength,
1712 position_data.deform(translations, verts);
1717 new_positions.
as_span(), verts, cache.
cloth_sim->deformation_pos.as_mutable_span());
1730 const float3 symmetry_pivot,
1731 const float strength,
1745 subdiv_ccg, vert_factors, grids, tls.
factors);
1777 cache.
cloth_sim->deformation_pos.as_mutable_span());
1789 const float3 symmetry_pivot,
1790 const float strength,
1834 new_positions.
as_span(), verts, cache.
cloth_sim->deformation_pos.as_mutable_span());
1844 const float strength,
1848 switch (
pbvh.type()) {
1858 boundary.edit_info.propagation_steps_num,
1859 boundary.edit_info.strength_factor,
1871 SubdivCCG &subdiv_ccg = *
object.runtime->sculpt_session->subdiv_ccg;
1882 boundary.edit_info.propagation_steps_num,
1883 boundary.edit_info.strength_factor,
1903 boundary.edit_info.propagation_steps_num,
1904 boundary.edit_info.strength_factor,
1916 pbvh.tag_positions_changed(node_mask);
1917 pbvh.flush_bounds_to_parents();
1935 new_positions[i] = positions[i] + (grab_delta * factors[i]);
1945 const float3 grab_delta_symmetry,
1946 const float3 symmetry_pivot,
1947 const float strength,
1981 position_data.deform(translations, verts);
1986 new_positions.
as_span(), verts, cache.
cloth_sim->deformation_pos.as_mutable_span());
1999 const float3 grab_delta_symmetry,
2000 const float3 symmetry_pivot,
2001 const float strength,
2015 subdiv_ccg, vert_factors, grids, tls.
factors);
2047 cache.
cloth_sim->deformation_pos.as_mutable_span());
2059 const float3 grab_delta_symmetry,
2060 const float3 symmetry_pivot,
2061 const float strength,
2105 new_positions.
as_span(), verts, cache.
cloth_sim->deformation_pos.as_mutable_span());
2115 const float strength,
2120 switch (
pbvh.type()) {
2130 boundary.edit_info.propagation_steps_num,
2131 boundary.edit_info.strength_factor,
2144 SubdivCCG &subdiv_ccg = *
object.runtime->sculpt_session->subdiv_ccg;
2155 boundary.edit_info.propagation_steps_num,
2156 boundary.edit_info.strength_factor,
2177 boundary.edit_info.propagation_steps_num,
2178 boundary.edit_info.strength_factor,
2191 pbvh.tag_positions_changed(node_mask);
2192 pbvh.flush_bounds_to_parents();
2202 const float3 pivot_point,
2221 const float3 twist_pivot_position,
2223 const float3 symmetry_pivot,
2224 const float strength,
2251 orig_data.
positions, twist_pivot_position, twist_axis, factors, new_positions);
2259 position_data.deform(translations, verts);
2264 new_positions.
as_span(), verts, cache.
cloth_sim->deformation_pos.as_mutable_span());
2275 const float3 twist_pivot_position,
2279 const float3 symmetry_pivot,
2280 const float strength,
2294 subdiv_ccg, vert_factors, grids, tls.
factors);
2309 orig_data.
positions, twist_pivot_position, twist_axis, factors, new_positions);
2327 cache.
cloth_sim->deformation_pos.as_mutable_span());
2337 const float3 twist_pivot_position,
2341 const float3 symmetry_pivot,
2342 const float strength,
2370 calc_twist_position(orig_positions, twist_pivot_position, twist_axis, factors, new_positions);
2386 new_positions.
as_span(), verts, cache.
cloth_sim->deformation_pos.as_mutable_span());
2396 const float strength,
2400 switch (
pbvh.type()) {
2410 boundary.edit_info.propagation_steps_num,
2411 boundary.edit_info.strength_factor,
2425 SubdivCCG &subdiv_ccg = *
object.runtime->sculpt_session->subdiv_ccg;
2436 boundary.edit_info.propagation_steps_num,
2437 boundary.edit_info.strength_factor,
2459 boundary.edit_info.propagation_steps_num,
2460 boundary.edit_info.strength_factor,
2474 pbvh.tag_positions_changed(node_mask);
2475 pbvh.flush_bounds_to_parents();
2494 const float3 to_smooth = average_position[i] - positions[i];
2495 new_positions[i] = positions[i] + (to_smooth * factors[i]);
2512 average_positions[i] =
float3(0.0f);
2513 int valid_neighbors = 0;
2514 for (
const int neighbor : neighbors[i]) {
2515 if (propagation_steps[i] == vert_propagation_steps[neighbor]) {
2516 average_positions[i] += vert_positions[neighbor];
2521 if (valid_neighbors == 0) {
2538 average_positions[i] =
float3(0.0f);
2539 int valid_neighbors = 0;
2540 for (
BMVert *neighbor : neighbors[i]) {
2542 if (propagation_steps[i] == vert_propagation_steps[neighbor_idx]) {
2543 average_positions[i] += neighbor->co;
2548 if (valid_neighbors == 0) {
2564 const float3 symmetry_pivot,
2565 const float strength,
2601 vert_propagation_steps,
2615 position_data.deform(translations, verts);
2620 new_positions.
as_span(), verts, cache.
cloth_sim->deformation_pos.as_mutable_span());
2632 const float3 symmetry_pivot,
2633 const float strength,
2647 subdiv_ccg, vert_factors, grids, tls.
factors);
2663 vert_propagation_steps,
2689 cache.
cloth_sim->deformation_pos.as_mutable_span());
2700 const float3 symmetry_pivot,
2701 const float strength,
2731 vert_propagation_steps, neighbors, propagation_steps, factors, average_positions);
2750 new_positions.
as_span(), verts, cache.
cloth_sim->deformation_pos.as_mutable_span());
2760 const float strength,
2764 switch (
pbvh.type()) {
2785 boundary.edit_info.propagation_steps_num,
2786 boundary.edit_info.strength_factor,
2799 SubdivCCG &subdiv_ccg = *
object.runtime->sculpt_session->subdiv_ccg;
2809 boundary.edit_info.propagation_steps_num,
2810 boundary.edit_info.strength_factor,
2829 boundary.edit_info.propagation_steps_num,
2830 boundary.edit_info.strength_factor,
2842 pbvh.tag_positions_changed(node_mask);
2843 pbvh.flush_bounds_to_parents();
2868 const float boundary_distance =
boundary.distance.lookup_default(
index, 0.0f);
2869 float falloff_distance = 0.0f;
2870 float direction = 1.0f;
2872 switch (
brush.boundary_falloff_type) {
2874 falloff_distance = boundary_distance;
2877 const int div = boundary_distance / radius;
2878 const float mod =
fmodf(boundary_distance, radius);
2879 falloff_distance = div % 2 == 0 ?
mod : radius -
mod;
2883 const int div = boundary_distance / radius;
2884 const float mod =
fmodf(boundary_distance, radius);
2885 falloff_distance = div % 2 == 0 ?
mod : radius -
mod;
2887 if (((div - 1) & 2) == 0) {
2898 return {falloff_distance, direction};
2911 boundary.edit_info.propagation_steps_num.size());
2913 boundary.edit_info.strength_factor.size());
2915 const int num_elements =
boundary.edit_info.strength_factor.size();
2918 for (
const int i :
IndexRange(num_elements)) {
2920 const float mask_factor =
mask.is_empty() ? 1.0f : 1.0f -
mask[i];
2921 boundary.edit_info.strength_factor[i] = mask_factor *
2924 boundary.edit_info.propagation_steps_num[i],
2934 const bool use_boundary_distances =
brush.boundary_falloff_type !=
2937 if (!use_boundary_distances) {
2946 &
brush, falloff_distance, radius);
2956 boundary.edit_info.propagation_steps_num.size());
2958 boundary.edit_info.strength_factor.size());
2967 const float mask_factor = subdiv_ccg.
masks.
is_empty() ? 1.0f :
2981 const bool use_boundary_distances =
brush.boundary_falloff_type !=
2984 if (!use_boundary_distances) {
2994 &
brush, falloff_distance, radius);
3005 boundary.edit_info.propagation_steps_num.size());
3007 boundary.edit_info.strength_factor.size());
3009 const int num_elements =
boundary.edit_info.strength_factor.size();
3013 for (
const int i :
IndexRange(num_elements)) {
3018 const float mask_factor = mask_offset == -1 ? 1.0f :
3021 boundary.edit_info.strength_factor[i] = mask_factor *
3024 boundary.edit_info.propagation_steps_num[i],
3034 const bool use_boundary_distances =
brush.boundary_falloff_type !=
3037 if (!use_boundary_distances) {
3046 &
brush, falloff_distance, radius);
3058 const Mesh &
mesh = *id_cast<const Mesh *>(
object.
data);
3067 if (std::holds_alternative<std::monostate>(initial_vert_ref)) {
3071 std::optional<int> initial_vert;
3073 initial_vert = std::get<int>(initial_vert_ref);
3076 float3 location =
symmetry_flip(positions_eval[std::get<int>(initial_vert_ref)], symm_area);
3081 if (!initial_vert) {
3089 switch (
brush.boundary_deform_type) {
3122 if (std::holds_alternative<std::monostate>(initial_vert_ref)) {
3126 std::optional<SubdivCCGCoord> initial_vert;
3131 const int active_vert = std::get<int>(initial_vert_ref);
3137 if (!initial_vert) {
3145 switch (
brush.boundary_deform_type) {
3177 if (std::holds_alternative<std::monostate>(initial_vert_ref)) {
3181 std::optional<BMVert *> initial_vert;
3183 initial_vert = std::get<BMVert *>(initial_vert_ref);
3186 BMVert *active_vert = std::get<BMVert *>(initial_vert_ref);
3191 if (!initial_vert) {
3199 switch (
brush.boundary_deform_type) {
3227 switch (
brush.boundary_deform_type) {
3233 angle_factor =
floorf(angle_factor * 10) / 10.0f;
3235 return angle_factor *
M_PI;
3250 angle_factor =
floorf(angle_factor * 10) / 10.0f;
3252 return angle_factor *
M_PI;
3274 switch (
pbvh.type()) {
3294 switch (
brush.boundary_deform_type) {
3358std::unique_ptr<SculptBoundary>
data_init(
const Depsgraph &depsgraph,
3361 const int initial_vert,
3369 switch (
pbvh.type()) {
3391 const int initial_vert,
3419 if (!boundary_initial_vert) {
3439 std::unique_ptr<SculptBoundary>
boundary = std::make_unique<SculptBoundary>();
3442 const int boundary_initial_vert_index = *boundary_initial_vert;
3443 boundary->initial_vert_i = boundary_initial_vert_index;
3444 boundary->initial_vert_position = positions_eval[boundary_initial_vert_index];
3454 *boundary_initial_vert,
3457 const float boundary_radius =
brush ? radius * (1.0f +
brush->boundary_offset) : radius;
3464 boundary_initial_vert_index,
3498 if (!boundary_initial_vert) {
3514 std::unique_ptr<SculptBoundary>
boundary = std::make_unique<SculptBoundary>();
3518 const int boundary_initial_vert_index = boundary_vert.
to_index(key);
3519 boundary->initial_vert_i = boundary_initial_vert_index;
3520 boundary->initial_vert_position = positions[boundary_initial_vert_index];
3531 const float boundary_radius =
brush ? radius * (1.0f +
brush->boundary_offset) : radius;
3549 object, ss.
bm, *initial_vert, radius);
3551 if (!boundary_initial_vert) {
3561 std::unique_ptr<SculptBoundary>
boundary = std::make_unique<SculptBoundary>();
3564 const int boundary_initial_vert_index =
BM_elem_index_get(*boundary_initial_vert);
3565 boundary->initial_vert_i = boundary_initial_vert_index;
3566 boundary->initial_vert_position = (*boundary_initial_vert)->co;
3570 const float boundary_radius =
brush ? radius * (1.0f +
brush->boundary_offset) : radius;
3592 if (std::holds_alternative<std::monostate>(initial_vert)) {
3598 std::unique_ptr<SculptBoundary>
boundary =
nullptr;
3599 switch (
pbvh.type()) {
3618 std::unique_ptr<SculptBoundaryPreview> preview = std::make_unique<SculptBoundaryPreview>();
3620 preview->pivot_position =
boundary->pivot_position;
3621 preview->initial_vert_position =
boundary->initial_vert_position;
3628 const float outline_col[3],
3629 const float outline_alpha)
A BVH for high poly meshes.
Object is a sort of wrapper for general info.
#define PRF_scope(category)
#define BLI_assert_unreachable()
#define BM_ELEM_CD_GET_FLOAT(ele, offset)
#define BM_elem_index_get(ele)
#define BM_elem_flag_test(ele, hflag)
Span< T > as_span() const
MutableSpan< T > as_mutable_span()
IndexRange index_range() const
constexpr IndexRange()=default
constexpr int64_t size() const
constexpr Span< T > as_span() const
constexpr IndexRange index_range() const
constexpr int64_t size() const
constexpr IndexRange index_range() const
constexpr bool is_empty() const
GAttributeReader lookup(const StringRef name) const
void foreach_index(Fn &&fn, Mode mode=exec_mode::serial) const
VecBase< float, D > constexpr mod(VecOp< float, D >, VecOp< float, D >) RET
float distance(float, float) RET
void gather(const GVArray &src, const IndexMask &indices, GMutableSpan dst, exec_mode::Mode mode=exec_mode::parallel)
IndexRange grid_range(const int grid_area, const int grid)
pbvh::Tree * pbvh_get(Object &object)
void update_node_bounds_bmesh(BMeshNode &node)
void update_node_bounds_mesh(Span< float3 > positions, MeshNode &node)
Span< float3 > vert_normals_eval(const Depsgraph &depsgraph, const Object &object_orig)
void update_node_bounds_grids(int grid_area, Span< float3 > positions, GridsNode &node)
Span< float3 > vert_positions_eval(const Depsgraph &depsgraph, const Object &object_orig)
void calc_vert_factors(const Depsgraph &depsgraph, const Object &object, const Cache &automasking, const bke::pbvh::MeshNode &node, Span< int > verts, MutableSpan< float > factors)
void calc_grids_factors(const Depsgraph &depsgraph, const Object &object, const Cache &automasking, const bke::pbvh::GridsNode &node, Span< int > grids, MutableSpan< float > factors)
static void slide_data_init_bmesh(BMesh *bm, SculptBoundary &boundary)
static BLI_NOINLINE void calc_inflate_position(const Span< float3 > positions, const Span< float3 > normals, const Span< float > factors, const MutableSpan< float3 > new_positions)
static void slide_data_init_grids(const SubdivCCG &subdiv_ccg, SculptBoundary &boundary)
static void twist_data_init_grids(const SubdivCCG &subdiv_ccg, SculptBoundary &boundary)
static void calc_slide_bmesh(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const Span< int > vert_propagation_steps, const Span< float > vert_factors, const Span< float3 > vert_slide_directions, bke::pbvh::BMeshNode &node, LocalDataBMesh &tls, const float3 symmetry_pivot, const float strength, const eBrushDeformTarget deform_target)
static BLI_NOINLINE void calc_slide_position(const Span< float3 > positions, const Span< float3 > directions, const Span< float > factors, const MutableSpan< float3 > new_positions)
static void calc_twist_mesh(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const Span< int > vert_propagation_steps, const Span< float > vert_factors, const bke::pbvh::MeshNode &node, const float3 twist_pivot_position, const float3 twist_axis, const float3 symmetry_pivot, const float strength, const eBrushDeformTarget deform_target, const PositionDeformData &position_data)
static void calc_twist_bmesh(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const Span< int > vert_propagation_steps, const Span< float > vert_factors, const float3 twist_pivot_position, const float3 twist_axis, bke::pbvh::BMeshNode &node, LocalDataBMesh &tls, const float3 symmetry_pivot, const float strength, const eBrushDeformTarget deform_target)
void pivot_line_preview_draw(const uint gpuattr, SculptSession &ss)
static void indices_init_bmesh(Object &object, BMesh *bm, BMVert &initial_boundary_vert, SculptBoundary &boundary)
static void init_boundary_grids(Object &object, const Brush &brush, const ePaintSymmetryFlags symm_area)
static void edit_data_init_grids(const SubdivCCG &subdiv_ccg, const int initial_vert_i, const float radius, SculptBoundary &boundary)
static BLI_NOINLINE void calc_average_position(const Span< float3 > vert_positions, const Span< int > vert_propagation_steps, const GroupedSpan< int > neighbors, const Span< int > propagation_steps, const MutableSpan< float > factors, const MutableSpan< float3 > average_positions)
std::unique_ptr< SculptBoundary > data_init_bmesh(Object &object, const Brush *brush, BMVert *initial_vert, const float radius)
static void init_falloff_bmesh(BMesh *bm, const Brush &brush, const float radius, SculptBoundary &boundary)
static bool check_counts(const int neighbor_count, const int boundary_vertex_count)
static void calc_inflate_mesh(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const Span< int > vert_propagation_steps, const Span< float > vert_factors, const bke::pbvh::MeshNode &node, const float3 symmetry_pivot, const float strength, const eBrushDeformTarget deform_target, const PositionDeformData &position_data)
std::unique_ptr< SculptBoundaryPreview > preview_data_init(const Depsgraph &depsgraph, Object &object, const Brush *brush, const float radius)
static void indices_init_mesh(Object &object, const OffsetIndices< int > faces, const Span< int > corner_verts, const GroupedSpan< int > vert_to_face, const Span< bool > hide_vert, const Span< bool > hide_poly, const BitSpan boundary_verts, const Span< float3 > vert_positions, const int initial_boundary_vert, SculptBoundary &boundary)
static void calc_smooth_bmesh(const Sculpt &sd, Object &object, const Span< int > vert_propagation_steps, const Span< float > vert_factors, bke::pbvh::BMeshNode &node, LocalDataBMesh &tls, const float3 symmetry_pivot, const float strength, const eBrushDeformTarget deform_target)
static void twist_data_init_bmesh(BMesh *bm, SculptBoundary &boundary)
static BLI_NOINLINE void calc_smooth_position(const Span< float3 > positions, const Span< float3 > average_position, const Span< float > factors, const MutableSpan< float3 > new_positions)
static float get_mesh_strength(const SculptSession &ss, const Brush &brush)
static void calc_smooth_grids(const Sculpt &sd, Object &object, SubdivCCG &subdiv_ccg, const Span< int > vert_propagation_steps, const Span< float > vert_factors, const bke::pbvh::GridsNode &node, LocalDataGrids &tls, const float3 symmetry_pivot, const float strength, const eBrushDeformTarget deform_target)
static void do_slide_brush(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const IndexMask &node_mask, const SculptBoundary &boundary, const float strength, const eBrushDeformTarget deform_target)
static void init_boundary_mesh(const Depsgraph &depsgraph, Object &object, const Brush &brush, const ePaintSymmetryFlags symm_area)
static BLI_NOINLINE void calc_twist_position(const Span< float3 > positions, const float3 pivot_point, const float3 pivot_axis, const Span< float > factors, const MutableSpan< float3 > new_positions)
static void bend_data_init_grids(const SubdivCCG &subdiv_ccg, SculptBoundary &boundary)
static void calc_slide_mesh(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const Span< int > vert_propagation_steps, const Span< float > vert_factors, const Span< float3 > vert_slide_directions, const bke::pbvh::MeshNode &node, const float3 symmetry_pivot, const float strength, const eBrushDeformTarget deform_target, const PositionDeformData &position_data)
static void indices_init_grids(Object &object, const OffsetIndices< int > faces, const Span< int > corner_verts, const SubdivCCG &subdiv_ccg, const BitSpan boundary_verts, const Set< OrderedEdge > &boundary_edges, const SubdivCCGCoord initial_vert, SculptBoundary &boundary)
static void calc_bend_mesh(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const Span< int > vert_propagation_steps, const Span< float > vert_factors, const Span< float3 > vert_pivot_positions, const Span< float3 > vert_pivot_axes, const bke::pbvh::MeshNode &node, const float3 symmetry_pivot, const float strength, const eBrushDeformTarget deform_target, const PositionDeformData &position_data)
static void calc_bend_grids(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, SubdivCCG &subdiv_ccg, const Span< int > vert_propagation_steps, const Span< float > vert_factors, const Span< float3 > vert_pivot_positions, const Span< float3 > vert_pivot_axes, const bke::pbvh::GridsNode &node, LocalDataGrids &tls, const float3 symmetry_pivot, const float strength, const eBrushDeformTarget deform_target)
static bool is_vert_in_editable_boundary_bmesh(BMVert &initial_vert)
static void init_boundary_bmesh(Object &object, const Brush &brush, const ePaintSymmetryFlags symm_area)
static bool is_vert_in_editable_boundary_mesh(const OffsetIndices< int > faces, const Span< int > corner_verts, const GroupedSpan< int > vert_to_face, const Span< bool > hide_vert, const Span< bool > hide_poly, const BitSpan boundary_verts, const int initial_vert)
static BLI_NOINLINE void calc_bend_position(const Span< float3 > positions, const Span< float3 > pivot_positions, const Span< float3 > pivot_axes, const Span< float > factors, const MutableSpan< float3 > new_positions)
static BLI_NOINLINE void filter_uninitialized_verts(const Span< int > propagation_steps, const MutableSpan< float > factors)
static void bend_data_init_mesh(const Span< float3 > vert_positions, const Span< float3 > vert_normals, SculptBoundary &boundary)
static void edit_data_init_bmesh(BMesh *bm, const int initial_vert_i, const float radius, SculptBoundary &boundary)
static void calc_inflate_grids(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, SubdivCCG &subdiv_ccg, const Span< int > vert_propagation_steps, const Span< float > vert_factors, const bke::pbvh::GridsNode &node, LocalDataGrids &tls, const float3 symmetry_pivot, const float strength, const eBrushDeformTarget deform_target)
static void populate_twist_data(const Span< float3 > positions, SculptBoundary &boundary)
static std::pair< float, float > calc_boundary_falloff(const SculptBoundary &boundary, const Brush &brush, const float radius, const int index)
static void twist_data_init_mesh(const Span< float3 > vert_positions, SculptBoundary &boundary)
static void calc_grab_bmesh(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const Span< int > vert_propagation_steps, const Span< float > vert_factors, bke::pbvh::BMeshNode &node, LocalDataBMesh &tls, const float3 grab_delta_symmetry, const float3 symmetry_pivot, const float strength, const eBrushDeformTarget deform_target)
std::unique_ptr< SculptBoundary > data_init(const Depsgraph &depsgraph, Object &object, const Brush *brush, const int initial_vert, const float radius)
static void do_grab_brush(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const IndexMask &node_mask, const SculptBoundary &boundary, const float strength, const eBrushDeformTarget deform_target)
static void do_bend_brush(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const IndexMask &node_mask, const SculptBoundary &boundary, const float strength, const eBrushDeformTarget deform_target)
void edges_preview_draw(const uint gpuattr, SculptSession &ss, const float outline_col[3], const float outline_alpha)
static float displacement_from_grab_delta_get(const SculptSession &ss, const SculptBoundary &boundary)
static void calc_twist_grids(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, SubdivCCG &subdiv_ccg, const Span< int > vert_propagation_steps, const Span< float > vert_factors, const float3 twist_pivot_position, const float3 twist_axis, const bke::pbvh::GridsNode &node, LocalDataGrids &tls, const float3 symmetry_pivot, const float strength, const eBrushDeformTarget deform_target)
static bool is_vert_in_editable_boundary_grids(const OffsetIndices< int > faces, const Span< int > corner_verts, const SubdivCCG &subdiv_ccg, const BitSpan boundary_verts, const Set< OrderedEdge > &boundary_edges, const SubdivCCGCoord initial_vert)
static std::optional< BMVert * > get_closest_boundary_vert_bmesh(Object &object, BMesh *bm, BMVert &initial_vert, const float radius)
std::unique_ptr< SculptBoundary > data_init_mesh(const Depsgraph &depsgraph, Object &object, const Brush *brush, const int initial_vert, const float radius)
static void calc_grab_mesh(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const Span< int > vert_propagation_steps, const Span< float > vert_factors, const bke::pbvh::MeshNode &node, const float3 grab_delta_symmetry, const float3 symmetry_pivot, const float strength, const eBrushDeformTarget deform_target, const PositionDeformData &position_data)
static void bend_data_init_bmesh(BMesh *bm, SculptBoundary &boundary)
static void calc_inflate_bmesh(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const Span< int > vert_propagation_steps, const Span< float > vert_factors, bke::pbvh::BMeshNode &node, LocalDataBMesh &tls, const float3 symmetry_pivot, const float strength, const eBrushDeformTarget deform_target)
static void calc_bend_bmesh(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const Span< int > vert_propagation_steps, const Span< float > vert_factors, const Span< float3 > vert_pivot_positions, const Span< float3 > vert_pivot_axes, bke::pbvh::BMeshNode &node, LocalDataBMesh &tls, const float3 symmetry_pivot, const float strength, const eBrushDeformTarget deform_target)
static void calc_grab_grids(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, SubdivCCG &subdiv_ccg, const Span< int > vert_propagation_steps, const Span< float > vert_factors, const bke::pbvh::GridsNode &node, LocalDataGrids &tls, const float3 grab_delta_symmetry, const float3 symmetry_pivot, const float strength, const eBrushDeformTarget deform_target)
void do_boundary_brush(const Depsgraph &depsgraph, const Sculpt &sd, Object &ob, const IndexMask &node_mask)
static std::optional< SubdivCCGCoord > get_closest_boundary_vert_grids(Object &object, const OffsetIndices< int > faces, const Span< int > corner_verts, const SubdivCCG &subdiv_ccg, const BitSpan boundary_verts, const Set< OrderedEdge > &boundary_edges, const SubdivCCGCoord initial_vert, const float radius)
static void calc_smooth_mesh(const Sculpt &sd, Object &object, const OffsetIndices< int > faces, const Span< int > corner_verts, const GroupedSpan< int > vert_to_face, const Span< bool > hide_poly, const Span< int > vert_propagation_steps, const Span< float > vert_factors, const bke::pbvh::MeshNode &node, LocalDataMesh &tls, const float3 symmetry_pivot, const float strength, const eBrushDeformTarget deform_target, const PositionDeformData &position_data)
static void edit_data_init_mesh(OffsetIndices< int > faces, Span< int > corner_verts, GroupedSpan< int > vert_to_face, Span< float3 > vert_positions, Span< bool > hide_vert, Span< bool > hide_poly, const int initial_vert_i, const float radius, SculptBoundary &boundary)
constexpr int BOUNDARY_INDICES_BLOCK_SIZE
static void do_inflate_brush(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const IndexMask &node_mask, const SculptBoundary &boundary, const float strength, const eBrushDeformTarget deform_target)
static void calc_slide_grids(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, SubdivCCG &subdiv_ccg, const Span< int > vert_propagation_steps, const Span< float > vert_factors, const Span< float3 > vert_slide_directions, const bke::pbvh::GridsNode &node, LocalDataGrids &tls, const float3 symmetry_pivot, const float strength, const eBrushDeformTarget deform_target)
static void do_twist_brush(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const IndexMask &node_mask, const SculptBoundary &boundary, const float strength, const eBrushDeformTarget deform_target)
void ensure_boundary_info(Object &object)
static void init_falloff_mesh(const Span< float > mask, const Brush &brush, const float radius, SculptBoundary &boundary)
static void init_falloff_grids(const SubdivCCG &subdiv_ccg, const Brush &brush, const float radius, SculptBoundary &boundary)
static void do_smooth_brush(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const IndexMask &node_mask, const SculptBoundary &boundary, const float strength, const eBrushDeformTarget deform_target)
static void add_index(SculptBoundary &boundary, const int new_index, const float distance, Set< int, BOUNDARY_INDICES_BLOCK_SIZE > &included_verts)
static std::optional< int > get_closest_boundary_vert_mesh(Object &object, const GroupedSpan< int > vert_to_face, const Span< float3 > vert_positions, const Span< bool > hide_vert, const Span< bool > hide_poly, const BitSpan boundary_verts, const int initial_vert, const float radius)
static BLI_NOINLINE void calc_grab_position(const Span< float3 > positions, const float3 grab_delta, const Span< float > factors, const MutableSpan< float3 > new_positions)
std::unique_ptr< SculptBoundary > data_init_grids(Object &object, const Brush *brush, const SubdivCCGCoord initial_vert, const float radius)
bool vert_is_boundary(const GroupedSpan< int > vert_to_face_map, const Span< bool > hide_poly, const BitSpan boundary_verts, const int vert)
static void slide_data_init_mesh(const Span< float3 > vert_positions, SculptBoundary &boundary)
MutableSpan< float3 > gather_grids_positions(const SubdivCCG &subdiv_ccg, const Span< int > grids, Vector< float3 > &positions)
void scatter_data_bmesh(Span< T > node_data, const Set< BMVert *, 0 > &verts, MutableSpan< T > dst)
void gather_bmesh_positions(const Set< BMVert *, 0 > &verts, MutableSpan< float3 > positions)
void gather_data_grids(const SubdivCCG &subdiv_ccg, Span< T > src, Span< int > grids, MutableSpan< T > node_data)
void vert_random_access_ensure(Object &object)
std::optional< int > nearest_vert_calc_mesh(const bke::pbvh::Tree &pbvh, const Span< float3 > vert_positions, const Span< bool > hide_vert, const float3 &location, const float max_distance, const bool use_original)
GroupedSpan< int > calc_vert_neighbors(OffsetIndices< int > faces, Span< int > corner_verts, GroupedSpan< int > vert_to_face, Span< bool > hide_poly, Span< int > verts, Vector< int > &r_offset_data, Vector< int > &r_data)
void filter_translations(MutableSpan< float3 > translations, Span< float > factors)
Vector< BMVert *, 64 > BMeshNeighborVerts
void gather_data_bmesh(Span< T > src, const Set< BMVert *, 0 > &verts, MutableSpan< T > node_data)
bool stroke_is_first_brush_step_of_symmetry_pass(const StrokeCache &cache)
float3 symmetry_flip(const float3 &src, const ePaintSymmetryFlags symm)
void orig_position_data_gather_bmesh(const BMLog &bm_log, const Set< BMVert *, 0 > &verts, MutableSpan< float3 > positions, MutableSpan< float3 > normals)
ePaintSymmetryFlags mesh_symmetry_xyz_get(const Object &object)
void filter_verts_outside_symmetry_area(Span< float3 > positions, const float3 &pivot, ePaintSymmetryFlags symm, MutableSpan< float > factors)
void scale_factors(MutableSpan< float > factors, float strength)
void translations_from_new_positions(Span< float3 > new_positions, Span< int > verts, Span< float3 > old_positions, MutableSpan< float3 > translations)
void clip_and_lock_translations(const Sculpt &sd, const SculptSession &ss, Span< float3 > positions, Span< int > verts, MutableSpan< float3 > translations)
void scatter_data_mesh(Span< T > src, Span< int > indices, MutableSpan< T > dst)
Span< BMVert * > vert_neighbors_get_bmesh(BMVert &vert, BMeshNeighborVerts &r_neighbors)
void apply_translations(Span< float3 > translations, Span< int > verts, MutableSpan< float3 > positions)
OrigPositionData orig_position_data_get_mesh(const Object &object, const bke::pbvh::MeshNode &node)
void gather_data_mesh(Span< T > src, Span< int > indices, MutableSpan< T > dst)
OrigPositionData orig_position_data_get_grids(const Object &object, const bke::pbvh::GridsNode &node)
std::optional< BMVert * > nearest_vert_calc_bmesh(const bke::pbvh::Tree &pbvh, const float3 &location, const float max_distance, const bool use_original)
std::optional< SubdivCCGCoord > nearest_vert_calc_grids(const bke::pbvh::Tree &pbvh, const SubdivCCG &subdiv_ccg, const float3 &location, const float max_distance, const bool use_original)
Span< int > vert_neighbors_get_mesh(const OffsetIndices< int > faces, const Span< int > corner_verts, const GroupedSpan< int > vert_to_face, const Span< bool > hide_poly, const int vert, Vector< int > &r_neighbors)
void scatter_data_grids(const SubdivCCG &subdiv_ccg, Span< T > node_data, Span< int > grids, MutableSpan< T > dst)
constexpr ParallelGrainSize grain_size(int grain_size)
T distance(const T &a, const T &b)
AxisSigned cross(const AxisSigned a, const AxisSigned b)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
T distance_squared(const VecBase< T, Size > &a, const VecBase< T, Size > &b)
float3 rotate_around_axis(const float3 &vector, const float3 ¢er, const float3 &axis, float angle)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
@ BRUSH_BOUNDARY_DEFORM_GRAB
@ BRUSH_BOUNDARY_DEFORM_SMOOTH
@ BRUSH_BOUNDARY_DEFORM_TWIST
@ BRUSH_BOUNDARY_DEFORM_EXPAND
@ BRUSH_BOUNDARY_DEFORM_BEND
@ BRUSH_BOUNDARY_DEFORM_INFLATE
std::variant< std::monostate, int, BMVert * > ActiveVert
float dist_signed_to_plane_v3(const float p[3], const float plane[4])
void immBegin(GPUPrimType, uint vertex_len)
@ BRUSH_BOUNDARY_FALLOFF_LOOP
@ BRUSH_BOUNDARY_FALLOFF_CONSTANT
@ BRUSH_BOUNDARY_FALLOFF_RADIUS
@ BRUSH_BOUNDARY_FALLOFF_LOOP_INVERT
void plane_from_point_normal_v3(float r_plane[4], const float plane_co[3], const float plane_no[3])
void GPU_line_width(float width)
CCGKey BKE_subdiv_ccg_key_top_level(const SubdivCCG &subdiv_ccg)
VecBase< float, 4 > float4
void BKE_subdiv_ccg_neighbor_coords_get(const SubdivCCG &subdiv_ccg, const SubdivCCGCoord &coord, bool include_duplicates, SubdivCCGNeighbors &r_neighbors)
void BKE_curvemapping_init(CurveMapping *cumap)
BMesh const char void * data
int CustomData_get_offset_named(const CustomData *data, eCustomDataType type, StringRef name)
int BM_mesh_elem_count(BMesh *bm, const char htype)
void immUniformColor4f(float r, float g, float b, float a)
float BKE_brush_curve_strength(eBrushCurvePreset preset, const CurveMapping *cumap, float distance, float brush_radius)
BLI_INLINE BMVert * BM_vert_at_index(BMesh *bm, const int index)
int CCG_grid_xy_to_index(const int grid_size, const int x, const int y)
const Brush * BKE_paint_brush_for_read(const Paint *paint)
void immVertex3fv(uint attr_id, const float data[3])
@ BRUSH_DEFORM_TARGET_CLOTH_SIM
@ BRUSH_DEFORM_TARGET_GEOMETRY
VecBase< float, 3 > float3
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
void immUniformColor3fvAlpha(const float rgb[3], float a)
const Set< BMVert *, 0 > & BKE_pbvh_bmesh_node_unique_verts(bke::pbvh::BMeshNode *node)
void rotate_v3_v3v3fl(float r[3], const float p[3], const float axis[3], float angle)
#define BOUNDARY_STEPS_NONE
#define BOUNDARY_VERTEX_NONE
bke::ObjectRuntime * runtime
std::unique_ptr< SculptBoundaryInfoCache > boundary_info_cache
ed::sculpt_paint::StrokeCache * cache
std::unique_ptr< SculptBoundaryPreview > boundary_preview
ActiveVert active_vert() const
static SubdivCCGCoord from_index(const CCGKey &key, int index)
int to_index(const CCGKey &key) const
Span< SubdivCCGCoord > duplicates() const
SubdivCCGNeighborCoords coords
Span< SubdivCCGCoord > unique() const
Array< float3 > positions
BitGroupVector grid_hidden
SculptSession * sculpt_session
StrokeToggleSettings toggle_settings
std::unique_ptr< auto_mask::Cache > automasking
float3 initial_location_symm
ePaintSymmetryFlags mirror_symmetry_pass
std::unique_ptr< cloth::SimulationData > cloth_sim
std::array< std::unique_ptr< boundary::SculptBoundary >, PAINT_SYMM_AREAS > boundaries
Vector< float3 > translations
Vector< float3 > average_positions
Vector< float3 > pivot_positions
Vector< float3 > new_positions
Vector< float3 > pivot_axes
Vector< float3 > positions
Vector< BMVert * > neighbor_data
Vector< float3 > slide_directions
Vector< int > neighbor_offsets
Vector< int > propagation_steps
Vector< int > neighbor_data
Vector< float3 > average_positions
Vector< float3 > slide_directions
Vector< float3 > positions
Vector< int > propagation_steps
Vector< float3 > pivot_axes
Vector< float3 > translations
Vector< float3 > new_positions
Vector< int > neighbor_offsets
Vector< float3 > pivot_positions
Vector< int > neighbor_data
Vector< int > neighbor_offsets
IndexRange index_range() const