Blender V4.3
blender::ed::sculpt_paint::cloth Namespace Reference

Classes

struct  ClothBrushCollision
 
struct  FalloffPlane
 
struct  FilterLocalData
 
struct  LengthConstraint
 
struct  LocalData
 
struct  SimulationData
 

Enumerations

enum class  ClothFilterType {
  Gravity , Inflate , Expand , Pinch ,
  Scale
}
 
enum  eClothFilterForceAxis { CLOTH_FILTER_FORCE_X = 1 << 0 , CLOTH_FILTER_FORCE_Y = 1 << 1 , CLOTH_FILTER_FORCE_Z = 1 << 2 }
 
enum  NodeSimState { SCULPT_CLOTH_NODE_UNINITIALIZED , SCULPT_CLOTH_NODE_INACTIVE , SCULPT_CLOTH_NODE_ACTIVE }
 
enum  ConstraintType { SCULPT_CLOTH_CONSTRAINT_STRUCTURAL = 0 , SCULPT_CLOTH_CONSTRAINT_DEFORMATION = 1 , SCULPT_CLOTH_CONSTRAINT_SOFTBODY = 2 , SCULPT_CLOTH_CONSTRAINT_PIN = 3 }
 

Functions

void do_cloth_brush (const Depsgraph &depsgraph, const Sculpt &sd, Object &object, const IndexMask &node_mask)
 
static MutableSpan< intcalc_vert_indices_grids (const CCGKey &key, const Span< int > grids, Vector< int > &indices)
 
static MutableSpan< intcalc_vert_indices_bmesh (const Set< BMVert *, 0 > &verts, Vector< int > &indices)
 
static MutableSpan< intcalc_visible_vert_indices_grids (const CCGKey &key, const BitGroupVector<> &grid_hidden, const Span< int > grids, Vector< int > &indices)
 
static MutableSpan< intcalc_visible_vert_indices_bmesh (const Set< BMVert *, 0 > &verts, Vector< int > &indices)
 
static void calc_vert_neighbor_indices_grids (const SubdivCCG &subdiv_ccg, const Span< int > verts, const MutableSpan< Vector< int > > neighbor_indices)
 
static void calc_vert_neighbor_indices_bmesh (const BMesh &bm, const Span< int > verts, const MutableSpan< Vector< int > > neighbor_indices)
 
static float3 cloth_brush_simulation_location_get (const SculptSession &ss, const Brush *brush)
 
IndexMask brush_affected_nodes_gather (const Object &object, const Brush &brush, IndexMaskMemory &memory)
 
bool is_cloth_deform_brush (const Brush &brush)
 
static float cloth_brush_simulation_falloff_get (const Brush &brush, const float radius, const float3 &location, const float3 &co)
 
static BLI_NOINLINE void calc_brush_simulation_falloff (const Brush &brush, const float radius, const float3 &location, const Span< float3 > positions, const MutableSpan< float > factors)
 
static void cloth_brush_add_length_constraint (SimulationData &cloth_sim, const int node_index, const int v1, const int v2, const Span< float3 > init_positions)
 
static void cloth_brush_add_softbody_constraint (SimulationData &cloth_sim, const int node_index, const int v, const float strength)
 
static void cloth_brush_add_pin_constraint (SimulationData &cloth_sim, const int node_index, const int v, const float strength)
 
static void cloth_brush_add_deformation_constraint (SimulationData &cloth_sim, const int node_index, const int v, const float strength)
 
static void add_constraints_for_verts (const Object &object, const Brush *brush, const float3 &cloth_sim_initial_location, const float cloth_sim_radius, const Span< float3 > init_positions, const int node_index, const Span< int > verts, const Span< Vector< int > > vert_neighbors, SimulationData &cloth_sim, Set< OrderedEdge > &created_length_constraints)
 
void ensure_nodes_constraints (const Sculpt &sd, Object &object, const IndexMask &node_mask, SimulationData &cloth_sim, const float3 &initial_location, const float radius)
 
static BLI_NOINLINE void apply_forces (SimulationData &cloth_sim, const Span< float3 > forces, const Span< int > verts)
 
static BLI_NOINLINE void expand_length_constraints (SimulationData &cloth_sim, const Span< int > verts, const Span< float > factors)
 
static BLI_NOINLINE void calc_distances_to_plane (const Span< float3 > positions, const float4 &plane, const MutableSpan< float > distances)
 
static BLI_NOINLINE void clamp_factors (const MutableSpan< float > factors, const float min, const float max)
 
static BLI_NOINLINE void apply_grab_brush (SimulationData &cloth_sim, const Span< int > verts, const MutableSpan< float > factors, const bool use_falloff_plane, const float3 &grab_delta_symmetry)
 
static BLI_NOINLINE void apply_snake_hook_brush (SimulationData &cloth_sim, const Span< int > verts, const MutableSpan< float > factors, const float3 &grab_delta_symmetry)
 
static BLI_NOINLINE void calc_pinch_forces (const Span< float3 > positions, const float3 &location, const MutableSpan< float3 > forces)
 
static BLI_NOINLINE void calc_plane_pinch_forces (const Span< float3 > positions, const float4 &plane, const float3 &plane_normal, const MutableSpan< float3 > forces)
 
static BLI_NOINLINE void calc_perpendicular_pinch_forces (const Span< float3 > positions, const float4x4 &imat, const float3 &location, const MutableSpan< float3 > forces)
 
static void calc_forces_mesh (const Depsgraph &depsgraph, Object &ob, const Brush &brush, const float3 &offset, const float4x4 &imat, const float3 &sim_location, const float3 &gravity, const std::optional< FalloffPlane > &falloff_plane, const MeshAttributeData &attribute_data, const Span< float3 > positions_eval, const Span< float3 > vert_normals, const bke::pbvh::MeshNode &node, LocalData &tls)
 
static void calc_forces_grids (const Depsgraph &depsgraph, Object &ob, const Brush &brush, const float3 &offset, const float4x4 &imat, const float3 &sim_location, const float3 &gravity, const std::optional< FalloffPlane > &falloff_plane, const bke::pbvh::GridsNode &node, LocalData &tls)
 
static void calc_forces_bmesh (const Depsgraph &depsgraph, Object &ob, const Brush &brush, const float3 &offset, const float4x4 &imat, const float3 &sim_location, const float3 &gravity, const std::optional< FalloffPlane > &falloff_plane, bke::pbvh::BMeshNode &node, LocalData &tls)
 
static Vector< ColliderCachecloth_brush_collider_cache_create (Object &object, const Depsgraph &depsgraph)
 
static void cloth_brush_collision_cb (void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit)
 
static void cloth_brush_solve_collision (const Object &object, SimulationData &cloth_sim, const int i)
 
static BLI_NOINLINE void solve_verts_simulation (const Object &object, const Brush *brush, const float3 &sim_location, const Span< int > verts, const MutableSpan< float > factors, LocalData &tls, SimulationData &cloth_sim)
 
static void calc_constraint_factors (const Depsgraph &depsgraph, const Object &object, const Brush *brush, const float3 &sim_location, const Span< float3 > init_positions, const MutableSpan< float > cloth_factors)
 
static void cloth_brush_satisfy_constraints (const Depsgraph &depsgraph, const Object &object, const Brush *brush, SimulationData &cloth_sim)
 
void do_simulation_step (const Depsgraph &depsgraph, const Sculpt &sd, Object &object, SimulationData &cloth_sim, const IndexMask &node_mask)
 
static void cloth_brush_apply_brush_foces (const Depsgraph &depsgraph, const Sculpt &sd, Object &ob, const IndexMask &node_mask)
 
static void cloth_sim_initialize_default_node_state (Object &object, SimulationData &cloth_sim)
 
static void copy_positions_to_array (const Depsgraph &depsgraph, const Object &object, MutableSpan< float3 > positions)
 
static void copy_normals_to_array (const Depsgraph &depsgraph, const Object &object, MutableSpan< float3 > normals)
 
std::unique_ptr< SimulationDatabrush_simulation_create (const Depsgraph &depsgraph, Object &ob, const float cloth_mass, const float cloth_damping, const float cloth_softbody_strength, const bool use_collisions, const bool needs_deform_coords)
 
void brush_store_simulation_state (const Depsgraph &depsgraph, const Object &object, SimulationData &cloth_sim)
 
void sim_activate_nodes (Object &object, SimulationData &cloth_sim, const IndexMask &node_mask)
 
static void sculpt_cloth_ensure_constraints_in_simulation_area (const Sculpt &sd, Object &ob, const IndexMask &node_mask)
 
void simulation_limits_draw (const uint gpuattr, const Brush &brush, const float location[3], const float normal[3], const float rds, const float line_width, const float outline_col[3], const float alpha)
 
void plane_falloff_preview_draw (const uint gpuattr, SculptSession &ss, const float outline_col[3], float outline_alpha)
 
static bool cloth_filter_is_deformation_filter (ClothFilterType filter_type)
 
static BLI_NOINLINE void calc_gravity_forces (const Span< float > factors, const filter::Cache &filter_cache, const MutableSpan< float3 > forces)
 
static BLI_NOINLINE void apply_scale_filter (filter::Cache &filter_cache, const Span< int > verts, const Span< float > factors, FilterLocalData &tls)
 
static void apply_filter_forces_mesh (const Depsgraph &depsgraph, const ClothFilterType filter_type, const float filter_strength, const float3 &gravity, const Span< float3 > positions_eval, const Span< float3 > vert_normals, const GroupedSpan< int > vert_to_face_map, const MeshAttributeData &attribute_data, const bke::pbvh::MeshNode &node, Object &object, FilterLocalData &tls)
 
static void apply_filter_forces_grids (const Depsgraph &depsgraph, const Span< int > face_sets, const ClothFilterType filter_type, const float filter_strength, const float3 &gravity, const bke::pbvh::GridsNode &node, Object &object, FilterLocalData &tls)
 
static void apply_filter_forces_bmesh (const Depsgraph &depsgraph, const ClothFilterType filter_type, const float filter_strength, const float3 &gravity, bke::pbvh::BMeshNode &node, Object &object, FilterLocalData &tls)
 
static int sculpt_cloth_filter_modal (bContext *C, wmOperator *op, const wmEvent *event)
 
static int sculpt_cloth_filter_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
void SCULPT_OT_cloth_filter (wmOperatorType *ot)
 

Variables

static EnumPropertyItem prop_cloth_filter_type []
 
static EnumPropertyItem prop_cloth_filter_orientation_items []
 
static EnumPropertyItem prop_cloth_filter_force_axis_items []
 

Enumeration Type Documentation

◆ ClothFilterType

Enumerator
Gravity 
Inflate 
Expand 
Pinch 
Scale 

Definition at line 1932 of file sculpt_cloth.cc.

◆ ConstraintType

Enumerator
SCULPT_CLOTH_CONSTRAINT_STRUCTURAL 
SCULPT_CLOTH_CONSTRAINT_DEFORMATION 
SCULPT_CLOTH_CONSTRAINT_SOFTBODY 
SCULPT_CLOTH_CONSTRAINT_PIN 

Definition at line 40 of file sculpt_cloth.hh.

◆ eClothFilterForceAxis

Enumerator
CLOTH_FILTER_FORCE_X 
CLOTH_FILTER_FORCE_Y 
CLOTH_FILTER_FORCE_Z 

Definition at line 1976 of file sculpt_cloth.cc.

◆ NodeSimState

Enumerator
SCULPT_CLOTH_NODE_UNINITIALIZED 
SCULPT_CLOTH_NODE_INACTIVE 
SCULPT_CLOTH_NODE_ACTIVE 

Definition at line 29 of file sculpt_cloth.hh.

Function Documentation

◆ add_constraints_for_verts()

static void blender::ed::sculpt_paint::cloth::add_constraints_for_verts ( const Object & object,
const Brush * brush,
const float3 & cloth_sim_initial_location,
const float cloth_sim_radius,
const Span< float3 > init_positions,
const int node_index,
const Span< int > verts,
const Span< Vector< int > > vert_neighbors,
SimulationData & cloth_sim,
Set< OrderedEdge > & created_length_constraints )
static

◆ apply_filter_forces_bmesh()

static void blender::ed::sculpt_paint::cloth::apply_filter_forces_bmesh ( const Depsgraph & depsgraph,
const ClothFilterType filter_type,
const float filter_strength,
const float3 & gravity,
bke::pbvh::BMeshNode & node,
Object & object,
FilterLocalData & tls )
static

◆ apply_filter_forces_grids()

static void blender::ed::sculpt_paint::cloth::apply_filter_forces_grids ( const Depsgraph & depsgraph,
const Span< int > face_sets,
const ClothFilterType filter_type,
const float filter_strength,
const float3 & gravity,
const bke::pbvh::GridsNode & node,
Object & object,
FilterLocalData & tls )
static

◆ apply_filter_forces_mesh()

static void blender::ed::sculpt_paint::cloth::apply_filter_forces_mesh ( const Depsgraph & depsgraph,
const ClothFilterType filter_type,
const float filter_strength,
const float3 & gravity,
const Span< float3 > positions_eval,
const Span< float3 > vert_normals,
const GroupedSpan< int > vert_to_face_map,
const MeshAttributeData & attribute_data,
const bke::pbvh::MeshNode & node,
Object & object,
FilterLocalData & tls )
static

◆ apply_forces()

◆ apply_grab_brush()

◆ apply_scale_filter()

◆ apply_snake_hook_brush()

◆ brush_affected_nodes_gather()

◆ brush_simulation_create()

std::unique_ptr< SimulationData > blender::ed::sculpt_paint::cloth::brush_simulation_create ( const Depsgraph & depsgraph,
Object & ob,
const float cloth_mass,
const float cloth_damping,
const float cloth_softbody_strength,
const bool use_collisions,
const bool needs_deform_coords )

◆ brush_store_simulation_state()

void blender::ed::sculpt_paint::cloth::brush_store_simulation_state ( const Depsgraph & depsgraph,
const Object & object,
SimulationData & cloth_sim )

◆ calc_brush_simulation_falloff()

static BLI_NOINLINE void blender::ed::sculpt_paint::cloth::calc_brush_simulation_falloff ( const Brush & brush,
const float radius,
const float3 & location,
const Span< float3 > positions,
const MutableSpan< float > factors )
static

◆ calc_constraint_factors()

static void blender::ed::sculpt_paint::cloth::calc_constraint_factors ( const Depsgraph & depsgraph,
const Object & object,
const Brush * brush,
const float3 & sim_location,
const Span< float3 > init_positions,
const MutableSpan< float > cloth_factors )
static

Definition at line 1222 of file sculpt_cloth.cc.

References blender::ed::sculpt_paint::auto_mask::active_cache_get(), blender::bke::pbvh::all_leaf_nodes(), blender::MutableSpan< T >::as_span(), BKE_pbvh_bmesh_node_unique_verts(), BKE_subdiv_ccg_key_top_level(), bm, SculptSession::bm, blender::bke::pbvh::BMesh, SculptSession::cache, calc_brush_simulation_falloff(), blender::ed::sculpt_paint::auto_mask::calc_grids_factors(), blender::ed::sculpt_paint::auto_mask::calc_vert_factors(), depsgraph, blender::ed::sculpt_paint::cloth::LocalData::factors, blender::index_mask::IndexMask::foreach_index(), blender::ed::sculpt_paint::gather_data_bmesh(), blender::ed::sculpt_paint::gather_data_grids(), blender::ed::sculpt_paint::gather_data_mesh(), CCGKey::grid_area, blender::bke::pbvh::Grids, blender::ed::sculpt_paint::MeshAttributeData::hide_vert, blender::threading::EnumerableThreadSpecific< T >::local(), blender::ed::sculpt_paint::MeshAttributeData::mask, blender::bke::pbvh::Mesh, blender::bke::pbvh::Tree::nodes(), blender::bke::object::pbvh_get(), blender::ed::sculpt_paint::cloth::LocalData::positions, blender::ed::sculpt_paint::StrokeCache::radius, blender::Vector< T, InlineBufferCapacity, Allocator >::resize(), blender::ed::sculpt_paint::scatter_data_bmesh(), blender::ed::sculpt_paint::scatter_data_grids(), blender::ed::sculpt_paint::scatter_data_mesh(), blender::Span< T >::size(), SculptSession::subdiv_ccg, blender::bke::pbvh::Tree::type(), and verts.

Referenced by cloth_brush_satisfy_constraints().

◆ calc_distances_to_plane()

static BLI_NOINLINE void blender::ed::sculpt_paint::cloth::calc_distances_to_plane ( const Span< float3 > positions,
const float4 & plane,
const MutableSpan< float > distances )
static

Definition at line 626 of file sculpt_cloth.cc.

References dist_to_plane_v3().

Referenced by calc_forces_bmesh(), calc_forces_grids(), and calc_forces_mesh().

◆ calc_forces_bmesh()

static void blender::ed::sculpt_paint::cloth::calc_forces_bmesh ( const Depsgraph & depsgraph,
Object & ob,
const Brush & brush,
const float3 & offset,
const float4x4 & imat,
const float3 & sim_location,
const float3 & gravity,
const std::optional< FalloffPlane > & falloff_plane,
bke::pbvh::BMeshNode & node,
LocalData & tls )
static

Definition at line 945 of file sculpt_cloth.cc.

References blender::ed::sculpt_paint::auto_mask::active_cache_get(), apply_forces(), apply_grab_brush(), blender::ed::sculpt_paint::apply_hardness_to_distances(), apply_snake_hook_brush(), blender::Array< T, InlineBufferCapacity, Allocator >::as_span(), BKE_pbvh_bmesh_node_unique_verts(), SculptSession::bm, BRUSH_CLOTH_DEFORM_DRAG, BRUSH_CLOTH_DEFORM_EXPAND, BRUSH_CLOTH_DEFORM_GRAB, BRUSH_CLOTH_DEFORM_INFLATE, BRUSH_CLOTH_DEFORM_PINCH_PERPENDICULAR, BRUSH_CLOTH_DEFORM_PINCH_POINT, BRUSH_CLOTH_DEFORM_PUSH, BRUSH_CLOTH_DEFORM_SNAKE_HOOK, BRUSH_FRONTFACE, blender::ed::sculpt_paint::StrokeCache::bstrength, SculptSession::cache, blender::ed::sculpt_paint::calc_brush_distances(), calc_brush_simulation_falloff(), blender::ed::sculpt_paint::calc_brush_strength_factors(), blender::ed::sculpt_paint::calc_brush_texture_factors(), calc_distances_to_plane(), blender::ed::sculpt_paint::calc_front_face(), calc_perpendicular_pinch_forces(), calc_pinch_forces(), calc_plane_pinch_forces(), blender::ed::sculpt_paint::auto_mask::calc_vert_factors(), calc_vert_indices_bmesh(), Brush::cloth_deform_type, blender::ed::sculpt_paint::StrokeCache::cloth_sim, depsgraph, blender::ed::sculpt_paint::cloth::LocalData::distances, expand_length_constraints(), blender::ed::sculpt_paint::cloth::LocalData::factors, Brush::falloff_shape, blender::ed::sculpt_paint::filter_region_clip_factors(), Brush::flag, blender::ed::sculpt_paint::gather_bmesh_normals(), blender::ed::sculpt_paint::gather_bmesh_positions(), blender::ed::sculpt_paint::gather_data_mesh(), blender::ed::sculpt_paint::StrokeCache::grab_delta_symm, blender::ed::sculpt_paint::cloth::SimulationData::init_pos, blender::ed::sculpt_paint::cloth::LocalData::init_positions, blender::math::is_zero(), blender::ed::sculpt_paint::StrokeCache::last_location_symm, blender::ed::sculpt_paint::StrokeCache::location_symm, blender::math::normalize(), blender::ed::sculpt_paint::cloth::LocalData::positions, blender::ed::sculpt_paint::StrokeCache::radius, blender::Vector< T, InlineBufferCapacity, Allocator >::resize(), blender::ed::sculpt_paint::scale_factors(), blender::ed::sculpt_paint::scale_translations(), Object::sculpt, blender::ed::sculpt_paint::cloth::LocalData::translations, blender::ed::sculpt_paint::translations_from_offset_and_factors(), blender::ed::sculpt_paint::cloth::LocalData::vert_indices, verts, and blender::ed::sculpt_paint::StrokeCache::view_normal_symm.

Referenced by cloth_brush_apply_brush_foces().

◆ calc_forces_grids()

static void blender::ed::sculpt_paint::cloth::calc_forces_grids ( const Depsgraph & depsgraph,
Object & ob,
const Brush & brush,
const float3 & offset,
const float4x4 & imat,
const float3 & sim_location,
const float3 & gravity,
const std::optional< FalloffPlane > & falloff_plane,
const bke::pbvh::GridsNode & node,
LocalData & tls )
static

Definition at line 835 of file sculpt_cloth.cc.

References blender::ed::sculpt_paint::auto_mask::active_cache_get(), apply_forces(), apply_grab_brush(), blender::ed::sculpt_paint::apply_hardness_to_distances(), apply_snake_hook_brush(), blender::Array< T, InlineBufferCapacity, Allocator >::as_span(), BKE_subdiv_ccg_key_top_level(), BRUSH_CLOTH_DEFORM_DRAG, BRUSH_CLOTH_DEFORM_EXPAND, BRUSH_CLOTH_DEFORM_GRAB, BRUSH_CLOTH_DEFORM_INFLATE, BRUSH_CLOTH_DEFORM_PINCH_PERPENDICULAR, BRUSH_CLOTH_DEFORM_PINCH_POINT, BRUSH_CLOTH_DEFORM_PUSH, BRUSH_CLOTH_DEFORM_SNAKE_HOOK, BRUSH_FRONTFACE, blender::ed::sculpt_paint::StrokeCache::bstrength, SculptSession::cache, blender::ed::sculpt_paint::calc_brush_distances(), calc_brush_simulation_falloff(), blender::ed::sculpt_paint::calc_brush_strength_factors(), blender::ed::sculpt_paint::calc_brush_texture_factors(), calc_distances_to_plane(), blender::ed::sculpt_paint::calc_front_face(), blender::ed::sculpt_paint::auto_mask::calc_grids_factors(), calc_perpendicular_pinch_forces(), calc_pinch_forces(), calc_plane_pinch_forces(), calc_vert_indices_grids(), Brush::cloth_deform_type, blender::ed::sculpt_paint::StrokeCache::cloth_sim, depsgraph, blender::ed::sculpt_paint::cloth::LocalData::distances, expand_length_constraints(), blender::ed::sculpt_paint::cloth::LocalData::factors, Brush::falloff_shape, blender::ed::sculpt_paint::filter_region_clip_factors(), Brush::flag, blender::ed::sculpt_paint::gather_data_grids(), blender::ed::sculpt_paint::gather_grids_normals(), blender::ed::sculpt_paint::gather_grids_positions(), blender::ed::sculpt_paint::StrokeCache::grab_delta_symm, blender::ed::sculpt_paint::cloth::SimulationData::init_pos, blender::ed::sculpt_paint::cloth::LocalData::init_positions, blender::math::is_zero(), blender::ed::sculpt_paint::StrokeCache::last_location_symm, blender::ed::sculpt_paint::StrokeCache::location_symm, blender::math::normalize(), blender::ed::sculpt_paint::cloth::LocalData::positions, blender::ed::sculpt_paint::StrokeCache::radius, blender::Vector< T, InlineBufferCapacity, Allocator >::resize(), blender::ed::sculpt_paint::scale_factors(), blender::ed::sculpt_paint::scale_translations(), Object::sculpt, SculptSession::subdiv_ccg, blender::ed::sculpt_paint::cloth::LocalData::translations, blender::ed::sculpt_paint::translations_from_offset_and_factors(), blender::ed::sculpt_paint::cloth::LocalData::vert_indices, verts, and blender::ed::sculpt_paint::StrokeCache::view_normal_symm.

Referenced by cloth_brush_apply_brush_foces().

◆ calc_forces_mesh()

static void blender::ed::sculpt_paint::cloth::calc_forces_mesh ( const Depsgraph & depsgraph,
Object & ob,
const Brush & brush,
const float3 & offset,
const float4x4 & imat,
const float3 & sim_location,
const float3 & gravity,
const std::optional< FalloffPlane > & falloff_plane,
const MeshAttributeData & attribute_data,
const Span< float3 > positions_eval,
const Span< float3 > vert_normals,
const bke::pbvh::MeshNode & node,
LocalData & tls )
static

Definition at line 726 of file sculpt_cloth.cc.

References blender::ed::sculpt_paint::auto_mask::active_cache_get(), apply_forces(), apply_grab_brush(), blender::ed::sculpt_paint::apply_hardness_to_distances(), apply_snake_hook_brush(), blender::Array< T, InlineBufferCapacity, Allocator >::as_span(), BRUSH_CLOTH_DEFORM_DRAG, BRUSH_CLOTH_DEFORM_EXPAND, BRUSH_CLOTH_DEFORM_GRAB, BRUSH_CLOTH_DEFORM_INFLATE, BRUSH_CLOTH_DEFORM_PINCH_PERPENDICULAR, BRUSH_CLOTH_DEFORM_PINCH_POINT, BRUSH_CLOTH_DEFORM_PUSH, BRUSH_CLOTH_DEFORM_SNAKE_HOOK, BRUSH_FRONTFACE, blender::ed::sculpt_paint::StrokeCache::bstrength, SculptSession::cache, blender::ed::sculpt_paint::calc_brush_distances(), calc_brush_simulation_falloff(), blender::ed::sculpt_paint::calc_brush_strength_factors(), blender::ed::sculpt_paint::calc_brush_texture_factors(), calc_distances_to_plane(), blender::ed::sculpt_paint::calc_front_face(), calc_perpendicular_pinch_forces(), calc_pinch_forces(), calc_plane_pinch_forces(), blender::ed::sculpt_paint::auto_mask::calc_vert_factors(), Brush::cloth_deform_type, blender::ed::sculpt_paint::StrokeCache::cloth_sim, depsgraph, blender::ed::sculpt_paint::cloth::LocalData::distances, expand_length_constraints(), blender::ed::sculpt_paint::cloth::LocalData::factors, Brush::falloff_shape, blender::ed::sculpt_paint::filter_region_clip_factors(), Brush::flag, blender::ed::sculpt_paint::gather_data_mesh(), blender::ed::sculpt_paint::StrokeCache::grab_delta_symm, blender::ed::sculpt_paint::MeshAttributeData::hide_vert, blender::ed::sculpt_paint::cloth::SimulationData::init_pos, blender::ed::sculpt_paint::cloth::LocalData::init_positions, blender::math::is_zero(), blender::ed::sculpt_paint::StrokeCache::last_location_symm, blender::ed::sculpt_paint::StrokeCache::location_symm, blender::ed::sculpt_paint::MeshAttributeData::mask, blender::math::normalize(), blender::ed::sculpt_paint::cloth::LocalData::positions, blender::ed::sculpt_paint::StrokeCache::radius, blender::Vector< T, InlineBufferCapacity, Allocator >::resize(), blender::ed::sculpt_paint::scale_factors(), blender::ed::sculpt_paint::scale_translations(), Object::sculpt, blender::ed::sculpt_paint::cloth::LocalData::translations, blender::ed::sculpt_paint::translations_from_offset_and_factors(), verts, and blender::ed::sculpt_paint::StrokeCache::view_normal_symm.

Referenced by cloth_brush_apply_brush_foces().

◆ calc_gravity_forces()

◆ calc_perpendicular_pinch_forces()

static BLI_NOINLINE void blender::ed::sculpt_paint::cloth::calc_perpendicular_pinch_forces ( const Span< float3 > positions,
const float4x4 & imat,
const float3 & location,
const MutableSpan< float3 > forces )
static

◆ calc_pinch_forces()

static BLI_NOINLINE void blender::ed::sculpt_paint::cloth::calc_pinch_forces ( const Span< float3 > positions,
const float3 & location,
const MutableSpan< float3 > forces )
static

◆ calc_plane_pinch_forces()

static BLI_NOINLINE void blender::ed::sculpt_paint::cloth::calc_plane_pinch_forces ( const Span< float3 > positions,
const float4 & plane,
const float3 & plane_normal,
const MutableSpan< float3 > forces )
static

◆ calc_vert_indices_bmesh()

static MutableSpan< int > blender::ed::sculpt_paint::cloth::calc_vert_indices_bmesh ( const Set< BMVert *, 0 > & verts,
Vector< int > & indices )
static

Definition at line 88 of file sculpt_cloth.cc.

References BM_elem_index_get, indices, and verts.

Referenced by apply_filter_forces_bmesh(), calc_forces_bmesh(), and do_simulation_step().

◆ calc_vert_indices_grids()

static MutableSpan< int > blender::ed::sculpt_paint::cloth::calc_vert_indices_grids ( const CCGKey & key,
const Span< int > grids,
Vector< int > & indices )
static

◆ calc_vert_neighbor_indices_bmesh()

static void blender::ed::sculpt_paint::cloth::calc_vert_neighbor_indices_bmesh ( const BMesh & bm,
const Span< int > verts,
const MutableSpan< Vector< int > > neighbor_indices )
static

◆ calc_vert_neighbor_indices_grids()

static void blender::ed::sculpt_paint::cloth::calc_vert_neighbor_indices_grids ( const SubdivCCG & subdiv_ccg,
const Span< int > verts,
const MutableSpan< Vector< int > > neighbor_indices )
static

◆ calc_visible_vert_indices_bmesh()

static MutableSpan< int > blender::ed::sculpt_paint::cloth::calc_visible_vert_indices_bmesh ( const Set< BMVert *, 0 > & verts,
Vector< int > & indices )
static

Definition at line 118 of file sculpt_cloth.cc.

References BM_elem_flag_test, BM_ELEM_HIDDEN, BM_elem_index_get, indices, and verts.

Referenced by ensure_nodes_constraints().

◆ calc_visible_vert_indices_grids()

static MutableSpan< int > blender::ed::sculpt_paint::cloth::calc_visible_vert_indices_grids ( const CCGKey & key,
const BitGroupVector<> & grid_hidden,
const Span< int > grids,
Vector< int > & indices )
static

◆ clamp_factors()

static BLI_NOINLINE void blender::ed::sculpt_paint::cloth::clamp_factors ( const MutableSpan< float > factors,
const float min,
const float max )
static

Definition at line 635 of file sculpt_cloth.cc.

References min.

Referenced by apply_grab_brush().

◆ cloth_brush_add_deformation_constraint()

◆ cloth_brush_add_length_constraint()

static void blender::ed::sculpt_paint::cloth::cloth_brush_add_length_constraint ( SimulationData & cloth_sim,
const int node_index,
const int v1,
const int v2,
const Span< float3 > init_positions )
static

◆ cloth_brush_add_pin_constraint()

◆ cloth_brush_add_softbody_constraint()

◆ cloth_brush_apply_brush_foces()

static void blender::ed::sculpt_paint::cloth::cloth_brush_apply_brush_foces ( const Depsgraph & depsgraph,
const Sculpt & sd,
Object & ob,
const IndexMask & node_mask )
static

Definition at line 1507 of file sculpt_cloth.cc.

References BKE_paint_brush_for_read(), blender::bke::pbvh::BMesh, BRUSH_CLOTH_DEFORM_GRAB, BRUSH_CLOTH_DEFORM_PINCH_PERPENDICULAR, BRUSH_CLOTH_DEFORM_PUSH, BRUSH_CLOTH_DEFORM_SNAKE_HOOK, BRUSH_CLOTH_FORCE_FALLOFF_PLANE, SculptSession::cache, blender::ed::sculpt_paint::calc_brush_plane(), calc_forces_bmesh(), calc_forces_grids(), calc_forces_mesh(), cloth_brush_simulation_location_get(), Brush::cloth_deform_type, Brush::cloth_force_falloff_type, blender::ed::sculpt_paint::StrokeCache::cloth_sim, blender::math::cross(), Object::data, depsgraph, ELEM, blender::index_mask::IndexMask::foreach_index(), blender::ed::sculpt_paint::StrokeCache::grab_delta_symm, blender::ed::sculpt_paint::StrokeCache::gravity_direction_symm, Sculpt::gravity_factor, blender::bke::pbvh::Grids, blender::MatBase< float, 4, 4 >::identity(), blender::math::is_zero(), blender::threading::EnumerableThreadSpecific< T >::local(), blender::MatBase< T, NumCol, NumRow, Alignment >::location(), blender::ed::sculpt_paint::StrokeCache::location_symm, blender::bke::pbvh::Mesh, blender::ed::sculpt_paint::StrokeCache::mirror_symmetry_pass, blender::bke::pbvh::Tree::nodes(), blender::math::normalize(), normalize_m4(), Sculpt::paint, blender::bke::object::pbvh_get(), plane_from_point_normal_v3(), blender::MatBase< T, NumCol, NumRow, Alignment >::ptr(), blender::ed::sculpt_paint::StrokeCache::radius, blender::ed::sculpt_paint::StrokeCache::scale, Object::sculpt, blender::ed::sculpt_paint::StrokeCache::sculpt_normal_symm, blender::ed::sculpt_paint::StrokeCache::stroke_local_mat, blender::ed::sculpt_paint::StrokeCache::supports_gravity, blender::bke::pbvh::Tree::type(), blender::bke::pbvh::vert_normals_eval(), blender::bke::pbvh::vert_positions_eval(), blender::MatBase< T, NumCol, NumRow, Alignment >::x_axis(), blender::MatBase< T, NumCol, NumRow, Alignment >::y_axis(), and blender::MatBase< T, NumCol, NumRow, Alignment >::z_axis().

Referenced by do_cloth_brush().

◆ cloth_brush_collider_cache_create()

◆ cloth_brush_collision_cb()

static void blender::ed::sculpt_paint::cloth::cloth_brush_collision_cb ( void * userdata,
int index,
const BVHTreeRay * ray,
BVHTreeRayHit * hit )
static

◆ cloth_brush_satisfy_constraints()

◆ cloth_brush_simulation_falloff_get()

static float blender::ed::sculpt_paint::cloth::cloth_brush_simulation_falloff_get ( const Brush & brush,
const float radius,
const float3 & location,
const float3 & co )
static

◆ cloth_brush_simulation_location_get()

◆ cloth_brush_solve_collision()

◆ cloth_filter_is_deformation_filter()

static bool blender::ed::sculpt_paint::cloth::cloth_filter_is_deformation_filter ( ClothFilterType filter_type)
static

Definition at line 1989 of file sculpt_cloth.cc.

References ELEM, and Scale.

Referenced by sculpt_cloth_filter_invoke().

◆ cloth_sim_initialize_default_node_state()

◆ copy_normals_to_array()

◆ copy_positions_to_array()

◆ do_cloth_brush()

◆ do_simulation_step()

void blender::ed::sculpt_paint::cloth::do_simulation_step ( const Depsgraph & depsgraph,
const Sculpt & sd,
Object & object,
SimulationData & cloth_sim,
const IndexMask & node_mask )

Definition at line 1379 of file sculpt_cloth.cc.

References blender::ed::sculpt_paint::auto_mask::active_cache_get(), BKE_paint_brush_for_read(), BKE_pbvh_bmesh_node_unique_verts(), BKE_subdiv_ccg_key_top_level(), bm, SculptSession::bm, BM_elem_index_get, blender::bke::pbvh::BMesh, blender::ed::sculpt_paint::auto_mask::calc_grids_factors(), blender::ed::sculpt_paint::auto_mask::calc_vert_factors(), calc_vert_indices_bmesh(), calc_vert_indices_grids(), blender::ed::sculpt_paint::clip_and_lock_translations(), cloth_brush_satisfy_constraints(), cloth_brush_simulation_location_get(), copy_v3_v3(), blender::ed::sculpt_paint::PositionDeformData::deform(), depsgraph, blender::ed::sculpt_paint::PositionDeformData::eval, blender::ed::sculpt_paint::cloth::LocalData::factors, blender::bke::pbvh::flush_bounds_to_parents(), blender::index_mask::IndexMask::from_predicate(), CCGKey::grid_area, blender::bke::ccg::grid_range(), blender::bke::pbvh::Grids, blender::ed::sculpt_paint::MeshAttributeData::hide_vert, blender::threading::EnumerableThreadSpecific< T >::local(), blender::ed::sculpt_paint::MeshAttributeData::mask, blender::bke::pbvh::Mesh, blender::ed::sculpt_paint::cloth::SimulationData::node_state, blender::ed::sculpt_paint::cloth::SimulationData::node_state_index, blender::bke::pbvh::Tree::nodes(), Sculpt::paint, blender::bke::object::pbvh_get(), blender::ed::sculpt_paint::cloth::SimulationData::pos, blender::Vector< T, InlineBufferCapacity, Allocator >::resize(), SCULPT_CLOTH_NODE_ACTIVE, SCULPT_CLOTH_NODE_INACTIVE, blender::Span< T >::size(), blender::Span< T >::slice(), solve_verts_simulation(), SculptSession::subdiv_ccg, blender::bke::pbvh::Tree::tag_positions_changed(), blender::ed::sculpt_paint::cloth::LocalData::translations, blender::bke::pbvh::Tree::type(), blender::bke::pbvh::update_node_bounds_bmesh(), blender::bke::pbvh::update_node_bounds_grids(), blender::bke::pbvh::update_node_bounds_mesh(), blender::ed::sculpt_paint::cloth::LocalData::vert_indices, and verts.

Referenced by blender::ed::sculpt_paint::do_brush_action(), do_cloth_brush(), and sculpt_cloth_filter_modal().

◆ ensure_nodes_constraints()

void blender::ed::sculpt_paint::cloth::ensure_nodes_constraints ( const Sculpt & sd,
Object & object,
const IndexMask & node_mask,
SimulationData & cloth_sim,
const float3 & initial_location,
const float radius )

◆ expand_length_constraints()

static BLI_NOINLINE void blender::ed::sculpt_paint::cloth::expand_length_constraints ( SimulationData & cloth_sim,
const Span< int > verts,
const Span< float > factors )
static

◆ is_cloth_deform_brush()

◆ plane_falloff_preview_draw()

◆ sculpt_cloth_ensure_constraints_in_simulation_area()

static void blender::ed::sculpt_paint::cloth::sculpt_cloth_ensure_constraints_in_simulation_area ( const Sculpt & sd,
Object & ob,
const IndexMask & node_mask )
static

◆ sculpt_cloth_filter_invoke()

static int blender::ed::sculpt_paint::cloth::sculpt_cloth_filter_invoke ( bContext * C,
wmOperator * op,
const wmEvent * event )
static

Definition at line 2359 of file sculpt_cloth.cc.

References blender::ed::sculpt_paint::filter::Cache::active_face_set, blender::ed::sculpt_paint::face_set::active_face_set_get(), SculptSession::active_vert_position(), blender::ed::sculpt_paint::filter::Cache::automasking, BKE_base_is_visible(), BKE_sculpt_update_object_for_edit(), brush_simulation_create(), blender::ed::sculpt_paint::auto_mask::cache_init(), blender::ed::sculpt_paint::filter::cache_init(), CLOTH_FILTER_FORCE_X, CLOTH_FILTER_FORCE_Y, CLOTH_FILTER_FORCE_Z, cloth_filter_is_deformation_filter(), blender::ed::sculpt_paint::filter::Cache::cloth_sim, blender::ed::sculpt_paint::filter::Cache::cloth_sim_pinch_point, CTX_data_active_base(), CTX_data_active_object(), CTX_data_ensure_evaluated_depsgraph(), CTX_data_scene(), CTX_data_tool_settings(), CTX_wm_view3d(), depsgraph, blender::ed::sculpt_paint::filter::Cache::enabled_axis, ensure_nodes_constraints(), SculptSession::filter_cache, float, FLT_MAX, wmEvent::mval, blender::ed::sculpt_paint::filter::Cache::node_mask, OPERATOR_CANCELLED, OPERATOR_RUNNING_MODAL, blender::ed::sculpt_paint::filter::Cache::orientation, blender::ed::sculpt_paint::undo::Position, wmOperator::ptr, blender::ed::sculpt_paint::undo::push_begin(), blender::ed::sculpt_paint::report_if_shape_key_is_locked(), wmOperator::reports, RNA_boolean_get(), RNA_enum_get(), RNA_float_get(), Object::sculpt, ToolSettings::sculpt, SCULPT_cursor_geometry_info_update(), SCULPT_FACE_SET_NONE, and WM_event_add_modal_handler().

Referenced by SCULPT_OT_cloth_filter().

◆ sculpt_cloth_filter_modal()

static int blender::ed::sculpt_paint::cloth::sculpt_cloth_filter_modal ( bContext * C,
wmOperator * op,
const wmEvent * event )
static

Definition at line 2250 of file sculpt_cloth.cc.

References apply_filter_forces_bmesh(), apply_filter_forces_grids(), apply_filter_forces_mesh(), Geometry::attributes, BKE_sculpt_update_object_for_edit(), blender::bke::pbvh::BMesh, brush_store_simulation_state(), blender::ed::sculpt_paint::filter::Cache::cloth_sim, CTX_data_active_object(), CTX_data_depsgraph_pointer(), CTX_data_tool_settings(), depsgraph, do_simulation_step(), blender::bke::Face, SculptSession::filter_cache, blender::bke::pbvh::flush_bounds_to_parents(), blender::ed::sculpt_paint::flush_update_done(), blender::ed::sculpt_paint::flush_update_step(), blender::index_mask::IndexMask::foreach_index(), Sculpt::gravity_factor, Sculpt::gravity_object, blender::bke::pbvh::Grids, KM_RELEASE, LEFTMOUSE, len, blender::threading::EnumerableThreadSpecific< T >::local(), blender::bke::pbvh::Mesh, MOUSEMOVE, blender::ed::sculpt_paint::filter::Cache::node_mask, blender::bke::pbvh::Tree::nodes(), OPERATOR_FINISHED, OPERATOR_RUNNING_MODAL, blender::bke::object::pbvh_get(), blender::ed::sculpt_paint::Position, wmOperator::ptr, blender::ed::sculpt_paint::undo::push_end(), RNA_enum_get(), RNA_float_get(), ToolSettings::sculpt, SCULPT_vertex_random_access_ensure(), sim_activate_nodes(), blender::bke::pbvh::Tree::tag_positions_changed(), blender::bke::pbvh::Tree::type(), wmEvent::type, UI_SCALE_FAC, blender::bke::pbvh::update_node_bounds_bmesh(), blender::bke::pbvh::update_node_bounds_grids(), blender::bke::pbvh::update_node_bounds_mesh(), wmEvent::val, blender::bke::pbvh::vert_normals_eval(), and blender::bke::pbvh::vert_positions_eval().

Referenced by SCULPT_OT_cloth_filter().

◆ SCULPT_OT_cloth_filter()

◆ sim_activate_nodes()

◆ simulation_limits_draw()

◆ solve_verts_simulation()

Variable Documentation

◆ prop_cloth_filter_force_axis_items

EnumPropertyItem blender::ed::sculpt_paint::cloth::prop_cloth_filter_force_axis_items[]
static
Initial value:
= {
{CLOTH_FILTER_FORCE_X, "X", 0, "X", "Apply force in the X axis"},
{CLOTH_FILTER_FORCE_Y, "Y", 0, "Y", "Apply force in the Y axis"},
{CLOTH_FILTER_FORCE_Z, "Z", 0, "Z", "Apply force in the Z axis"},
{0, nullptr, 0, nullptr, nullptr},
}

Definition at line 1982 of file sculpt_cloth.cc.

Referenced by SCULPT_OT_cloth_filter().

◆ prop_cloth_filter_orientation_items

EnumPropertyItem blender::ed::sculpt_paint::cloth::prop_cloth_filter_orientation_items[]
static
Initial value:
= {
{int(filter::FilterOrientation::Local),
"LOCAL",
0,
"Local",
"Use the local axis to limit the force and set the gravity direction"},
{int(filter::FilterOrientation::World),
"WORLD",
0,
"World",
"Use the global axis to limit the force and set the gravity direction"},
{int(filter::FilterOrientation::View),
"VIEW",
0,
"View",
"Use the view axis to limit the force and set the gravity direction"},
{0, nullptr, 0, nullptr, nullptr},
}
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int

Definition at line 1957 of file sculpt_cloth.cc.

Referenced by SCULPT_OT_cloth_filter().

◆ prop_cloth_filter_type

EnumPropertyItem blender::ed::sculpt_paint::cloth::prop_cloth_filter_type[]
static
Initial value:
= {
{int(ClothFilterType::Gravity), "GRAVITY", 0, "Gravity", "Applies gravity to the simulation"},
{int(ClothFilterType::Inflate), "INFLATE", 0, "Inflate", "Inflates the cloth"},
{int(ClothFilterType::Expand), "EXPAND", 0, "Expand", "Expands the cloth's dimensions"},
{int(ClothFilterType::Pinch),
"PINCH",
0,
"Pinch",
"Pulls the cloth to the cursor's start position"},
{int(ClothFilterType::Scale),
"SCALE",
0,
"Scale",
"Scales the mesh as a soft body using the origin of the object as scale"},
{0, nullptr, 0, nullptr, nullptr},
}

Definition at line 1940 of file sculpt_cloth.cc.

Referenced by SCULPT_OT_cloth_filter().