28inline namespace mask_cc {
45 for (
const int i : masks.index_range()) {
46 masks[i] += factors[i] * current_masks[i] * strength;
52 for (
float &mask : masks) {
53 mask = std::clamp(mask, 0.0f, 1.0f);
92 tls.new_masks.resize(
verts.size());
96 tls.current_masks = tls.new_masks;
98 if (strength > 0.0f) {
110 const float strength,
140 tls.new_masks.resize(positions.size());
144 tls.current_masks = tls.new_masks;
146 if (strength > 0.0f) {
158 const float strength,
188 tls.new_masks.resize(
verts.size());
192 tls.current_masks = tls.new_masks;
194 if (strength > 0.0f) {
216 switch (pbvh.
type()) {
219 Mesh &mesh = *
static_cast<Mesh *
>(
object.data);
int CustomData_get_offset_named(const CustomData *data, eCustomDataType type, blender::StringRef name)
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)
Object is a sort of wrapper for general info.
ATTR_WARN_UNUSED_RESULT BMesh * bm
constexpr Span< T > as_span() const
constexpr int64_t size() const
void resize(const int64_t new_size)
Span< NodeT > nodes() const
void tag_masks_changed(const IndexMask &node_mask)
void foreach_index(Fn &&fn) const
const Depsgraph * depsgraph
pbvh::Tree * pbvh_get(Object &object)
void node_update_mask_bmesh(int mask_offset, BMeshNode &node)
void node_update_mask_mesh(Span< float > mask, MeshNode &node)
void node_update_mask_grids(const CCGKey &key, Span< float > masks, GridsNode &node)
Span< float3 > vert_normals_eval(const Depsgraph &depsgraph, const Object &object_orig)
Span< float3 > vert_positions_eval(const Depsgraph &depsgraph, const Object &object_orig)
void calc_grids_factors(const Depsgraph &depsgraph, const Object &object, const Cache &cache, const bke::pbvh::GridsNode &node, Span< int > grids, MutableSpan< float > factors)
void calc_vert_factors(const Depsgraph &depsgraph, const Object &object, const Cache &cache, const bke::pbvh::MeshNode &node, Span< int > verts, MutableSpan< float > factors)
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 void calc_grids(const Depsgraph &depsgraph, Object &object, const Brush &brush, const float strength, bke::pbvh::GridsNode &node, LocalData &tls)
static BLI_NOINLINE void clamp_mask(const MutableSpan< float > masks)
static void calc_bmesh(const Depsgraph &depsgraph, Object &object, const Brush &brush, const float strength, bke::pbvh::BMeshNode &node, LocalData &tls)
static BLI_NOINLINE void apply_factors(const float strength, const Span< float > current_masks, const Span< float > factors, const MutableSpan< float > masks)
static void calc_faces(const Depsgraph &depsgraph, const Brush &brush, const float strength, const Span< float3 > positions, const Span< float3 > vert_normals, const bke::pbvh::MeshNode &node, Object &object, const Span< bool > hide_vert, LocalData &tls, const MutableSpan< float > mask)
void scatter_mask_grids(const Span< float > mask, SubdivCCG &subdiv_ccg, const Span< int > grids)
void scatter_mask_bmesh(const Span< float > mask, const BMesh &bm, const Set< BMVert *, 0 > &verts)
void gather_mask_bmesh(const BMesh &bm, const Set< BMVert *, 0 > &verts, const MutableSpan< float > r_mask)
void invert_mask(const MutableSpan< float > masks)
void gather_mask_grids(const SubdivCCG &subdiv_ccg, const Span< int > grids, const MutableSpan< float > r_mask)
MutableSpan< float3 > gather_grids_positions(const SubdivCCG &subdiv_ccg, const Span< int > grids, Vector< float3 > &positions)
void gather_bmesh_positions(const Set< BMVert *, 0 > &verts, MutableSpan< float3 > positions)
void calc_brush_strength_factors(const StrokeCache &cache, const Brush &brush, Span< float > distances, MutableSpan< float > factors)
void apply_hardness_to_distances(float radius, float hardness, MutableSpan< float > distances)
void filter_distances_with_radius(float radius, Span< float > distances, MutableSpan< float > factors)
void filter_region_clip_factors(const SculptSession &ss, Span< float3 > vert_positions, Span< int > verts, MutableSpan< float > factors)
void calc_brush_distances(const SculptSession &ss, Span< float3 > vert_positions, Span< int > vert_indices, eBrushFalloffShape falloff_shape, MutableSpan< float > r_distances)
void scatter_data_mesh(Span< T > src, Span< int > indices, MutableSpan< T > dst)
void gather_data_mesh(Span< T > src, Span< int > indices, MutableSpan< T > dst)
void calc_front_face(const float3 &view_normal, Span< float3 > normals, MutableSpan< float > factors)
void calc_brush_texture_factors(const SculptSession &ss, const Brush &brush, Span< float3 > vert_positions, Span< int > vert_indices, MutableSpan< float > factors)
void fill_factor_from_hide(Span< bool > hide_vert, Span< int > verts, MutableSpan< float > r_factors)
void do_mask_brush(const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const IndexMask &node_mask)
blender::ed::sculpt_paint::StrokeCache * cache
blender::Array< float > masks
Vector< float > distances
Vector< float3 > positions
std::unique_ptr< auto_mask::Cache > automasking
Vector< float > new_masks
Vector< float > distances
Vector< float3 > positions
Vector< float > current_masks