31inline namespace topology_slide_cc {
52 for (
const int i : positions.index_range()) {
57 for (
const int i : positions.index_range()) {
66 const float3 &neighbor_position,
69 const float3 neighbor_disp = neighbor_position - position;
71 if (
math::dot(dir, neighbor_dir) > 0.0f) {
72 translation += neighbor_dir *
math::dot(dir, neighbor_disp);
81 for (
const int i : positions.index_range()) {
82 const float3 &position = positions[i];
83 const float3 &dir = translations[i];
85 float3 final_translation(0);
86 for (
const int neighbor : vert_neighbors[i]) {
90 translations[i] = final_translation;
101 const int node_start = i * key.
grid_area;
102 const int grid = grids[i];
107 const int vert = start + offset;
108 const int node_vert = node_start + offset;
110 const float3 &position = positions[vert];
111 const float3 &dir = translations[node_vert];
121 float3 final_translation(0);
124 position, dir, positions[neighbor.to_index(key)], final_translation);
127 translations[node_vert] = final_translation;
140 const float3 &position = positions[i];
141 const float3 &dir = translations[i];
143 float3 final_translation(0);
148 translations[i] = final_translation;
184 tls.vert_neighbors.resize(
verts.size());
186 faces, corner_verts, vert_to_face_map, attribute_data.
hide_poly,
verts, tls.vert_neighbors);
283 switch (pbvh.
type()) {
285 Mesh &mesh = *
static_cast<Mesh *
>(
object.data);
288 const Span<int> corner_verts = mesh.corner_verts();
310 SubdivCCG &subdiv_ccg = *
object.sculpt->subdiv_ccg;
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)
const blender::Set< BMVert *, 0 > & BKE_pbvh_bmesh_node_unique_verts(blender::bke::pbvh::BMeshNode *node)
CCGKey BKE_subdiv_ccg_key_top_level(const SubdivCCG &subdiv_ccg)
void BKE_subdiv_ccg_neighbor_coords_get(const SubdivCCG &subdiv_ccg, const SubdivCCGCoord &coord, bool include_duplicates, SubdivCCGNeighbors &r_neighbors)
@ BRUSH_SLIDE_DEFORM_DRAG
@ BRUSH_SLIDE_DEFORM_EXPAND
@ BRUSH_SLIDE_DEFORM_PINCH
Object is a sort of wrapper for general info.
constexpr void fill(const T &value) const
constexpr IndexRange index_range() const
void tag_positions_changed(const IndexMask &node_mask)
Span< NodeT > nodes() const
void foreach_index(Fn &&fn) const
const Depsgraph * depsgraph
pbvh::Tree * pbvh_get(Object &object)
void update_node_bounds_bmesh(BMeshNode &node)
void update_node_bounds_mesh(Span< float3 > positions, MeshNode &node)
void update_node_bounds_grids(int grid_area, Span< float3 > positions, GridsNode &node)
void flush_bounds_to_parents(Tree &pbvh)
static void calc_bmesh(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const Brush &brush, const float3 &direction, const float strength, bke::pbvh::BMeshNode &node, LocalData &tls)
static void calc_faces(const Depsgraph &depsgraph, const Sculpt &sd, const Brush &brush, const float4 &test_plane, const float strength, const MeshAttributeData &attribute_data, const Span< float3 > vert_normals, const bke::pbvh::MeshNode &node, Object &object, LocalData &tls, const PositionDeformData &position_data)
static void calc_grids(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const Brush &brush, const float4 &test_plane, const float strength, bke::pbvh::GridsNode &node, LocalData &tls)
static BLI_NOINLINE void calc_translation_directions(const Brush &brush, const StrokeCache &cache, const Span< float3 > positions, const MutableSpan< float3 > r_translations)
static void calc_faces(const Depsgraph &depsgraph, const Sculpt &sd, const Brush &brush, const OffsetIndices< int > faces, const Span< int > corner_verts, const GroupedSpan< int > vert_to_face_map, const MeshAttributeData &attribute_data, const bke::pbvh::MeshNode &node, Object &object, LocalData &tls, const PositionDeformData &position_data)
static void add_neighbor_influence(const float3 &position, const float3 &dir, const float3 &neighbor_position, float3 &translation)
static void calc_bmesh(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const Brush &brush, bke::pbvh::BMeshNode &node, LocalData &tls)
static void calc_grids(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const Brush &brush, const bke::pbvh::GridsNode &node, LocalData &tls)
static BLI_NOINLINE void calc_neighbor_influence(const Span< float3 > vert_positions, const Span< float3 > positions, const Span< Vector< int > > vert_neighbors, const MutableSpan< float3 > translations)
MutableSpan< float3 > gather_grids_positions(const SubdivCCG &subdiv_ccg, const Span< int > grids, Vector< float3 > &positions)
void calc_factors_common_from_orig_data_grids(const Depsgraph &depsgraph, const Brush &brush, const Object &object, Span< float3 > positions, Span< float3 > normals, const bke::pbvh::GridsNode &node, Vector< float > &r_factors, Vector< float > &r_distances)
void gather_bmesh_positions(const Set< BMVert *, 0 > &verts, MutableSpan< float3 > positions)
void orig_position_data_gather_bmesh(const BMLog &bm_log, const Set< BMVert *, 0 > &verts, MutableSpan< float3 > positions, MutableSpan< float3 > normals)
void scale_translations(MutableSpan< float3 > translations, Span< float > factors)
void scale_factors(MutableSpan< float > factors, float strength)
void calc_factors_common_from_orig_data_mesh(const Depsgraph &depsgraph, const Brush &brush, const Object &object, const MeshAttributeData &attribute_data, Span< float3 > positions, Span< float3 > normals, const bke::pbvh::MeshNode &node, Vector< float > &r_factors, Vector< float > &r_distances)
void clip_and_lock_translations(const Sculpt &sd, const SculptSession &ss, Span< float3 > positions, Span< int > verts, MutableSpan< float3 > translations)
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)
Span< BMVert * > vert_neighbors_get_bmesh(BMVert &vert, Vector< BMVert *, 64 > &r_neighbors)
void gather_data_mesh(Span< T > src, Span< int > indices, MutableSpan< T > dst)
void calc_vert_neighbors(OffsetIndices< int > faces, Span< int > corner_verts, GroupedSpan< int > vert_to_face, Span< bool > hide_poly, Span< int > verts, MutableSpan< Vector< int > > result)
OrigPositionData orig_position_data_get_grids(const Object &object, const bke::pbvh::GridsNode &node)
void do_topology_slide_brush(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const IndexMask &node_mask)
void calc_factors_common_from_orig_data_bmesh(const Depsgraph &depsgraph, const Brush &brush, const Object &object, Span< float3 > positions, Span< float3 > normals, bke::pbvh::BMeshNode &node, Vector< float > &r_factors, Vector< float > &r_distances)
T dot(const QuaternionBase< T > &a, const QuaternionBase< T > &b)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
bool SCULPT_stroke_is_first_brush_step_of_symmetry_pass(const blender::ed::sculpt_paint::StrokeCache &cache)
blender::ed::sculpt_paint::StrokeCache * cache
blender::Vector< SubdivCCGCoord, 256 > coords
blender::Array< blender::float3 > positions
Vector< float > distances
Vector< float3 > translations
Vector< float3 > positions
VArraySpan< bool > hide_poly
float3 last_location_symm
Vector< float3 > positions
Vector< Vector< int > > vert_neighbors
Vector< float > distances
Vector< float3 > translations