94 if (!ss->
cache || !brush) {
120 .ignore_fully_ineffective =
false,
133 .ignore_fully_ineffective =
false,
145 const float location[3],
171 float p = 1.0f - ((
distance - falloff) / (limit - falloff));
172 return 3.0f * p * p - 2.0f * p * p * p;
175 #define CLOTH_LENGTH_CONSTRAINTS_BLOCK 100000
176 #define CLOTH_SIMULATION_ITERATIONS 5
178 #define CLOTH_SOLVER_DISPLACEMENT_FACTOR 0.6f
179 #define CLOTH_MAX_CONSTRAINTS_PER_VERTEX 1024
180 #define CLOTH_SIMULATION_TIME_STEP 0.01f
181 #define CLOTH_DEFORMATION_SNAKEHOOK_STRENGTH 0.35f
182 #define CLOTH_DEFORMATION_TARGET_STRENGTH 0.01f
183 #define CLOTH_DEFORMATION_GRAB_STRENGTH 0.1f
199 "length constraints");
205 const int node_index,
208 const bool use_persistent)
216 length_constraint->
node = node_index;
223 if (use_persistent) {
243 const int node_index,
245 const float strength)
253 length_constraint->
node = node_index;
260 length_constraint->
length = 0.0f;
261 length_constraint->
strength = strength;
270 const int node_index,
272 const float strength)
280 length_constraint->
node = node_index;
287 length_constraint->
length = 0.0f;
288 length_constraint->
strength = strength;
297 const int node_index,
299 const float strength)
307 length_constraint->
node = node_index;
314 length_constraint->
length = 0.0f;
315 length_constraint->
strength = strength;
339 const bool pin_simulation_boundary = ss->
cache !=
NULL && brush !=
NULL &&
348 const bool cloth_is_deform_brush = ss->
cache !=
NULL && brush !=
NULL &&
353 float radius_squared = 0.0f;
354 if (cloth_is_deform_brush) {
361 data->cloth_sim_radius *
data->cloth_sim_radius :
371 build_indices[tot_indices] = vd.
index;
374 build_indices[tot_indices] = ni.
index;
379 if (
data->cloth_sim->softbody_strength > 0.0f) {
388 for (
int c_i = 0; c_i < tot_indices; c_i++) {
389 for (
int c_j = 0; c_j < tot_indices; c_j++) {
391 data->cloth_sim, build_indices[c_i], build_indices[c_j])) {
407 if (use_falloff_plane) {
429 else if (
data->cloth_sim->deformation_pos) {
437 if (pin_simulation_boundary) {
441 if (sim_falloff < 1.0f) {
453 const float force[3],
454 const int vertex_index)
468 const float *grab_delta =
data->grab_delta;
479 ss, &test,
data->brush->falloff_shape);
483 float x_object_space[3];
484 float z_object_space[3];
491 float deform_plane[4];
492 float plane_normal[3];
493 if (use_falloff_plane) {
499 float gravity[3] = {0.0f};
506 float sim_location[3];
511 float current_vertex_location[3];
520 float vertex_gravity[3];
525 if (!sculpt_brush_test_sq_fn(&test, current_vertex_location) && !use_falloff_plane) {
531 if (use_falloff_plane) {
535 const float fade = sim_factor * bstrength *
538 current_vertex_location,
563 if (use_falloff_plane) {
578 if (use_falloff_plane) {
590 float disp_center[3];
661 MVert *mverts = col_data->
x;
662 float *tri[3], no[3], co[3];
664 tri[0] = mverts[verttri->
tri[0]].
co;
665 tri[1] = mverts[verttri->
tri[1]].
co;
666 tri[2] = mverts[verttri->
tri[2]].
co;
674 if (tri_hit && dist < hit->dist) {
692 float obmat_inv[4][4];
696 collider_cache = collider_cache->
next) {
697 float ray_start[3], ray_normal[3];
698 float pos_world_space[3], prev_pos_world_space[3];
702 sub_v3_v3v3(ray_normal, pos_world_space, prev_pos_world_space);
710 col.col_data = collmd;
722 if (hit.
index == -1) {
726 float collision_disp[3];
727 float movement_disp[3];
729 sub_v3_v3v3(movement_disp, pos_world_space, prev_pos_world_space);
730 float friction_plane[4];
731 float pos_on_friction_plane[3];
756 const float time_step =
data->cloth_time_step;
766 float sim_location[3];
768 const float sim_factor =
772 if (sim_factor <= 0.0f) {
786 const float mask_v = (1.0f - (vd.
mask ? *vd.
mask : 0.0f)) *
835 const float current_distance =
len_v3(v1_to_v2);
836 float correction_vector[3];
837 float correction_vector_half[3];
839 const float constraint_distance = constraint->
length +
843 if (current_distance > 0.0f) {
847 (1.0f - (constraint_distance / current_distance)));
853 mul_v3_v3fl(correction_vector_half, correction_vector, 0.5f);
860 float sim_location[3];
863 const float sim_factor_v1 = ss->
cache ?
869 const float sim_factor_v2 = ss->
cache ?
876 float deformation_strength = 1.0f;
886 correction_vector_half,
887 1.0f * mask_v1 * sim_factor_v1 * constraint->
strength * softbody_plasticity);
889 correction_vector_half,
890 -1.0f * mask_v1 * sim_factor_v1 * constraint->
strength *
891 (1.0f - softbody_plasticity));
895 correction_vector_half,
896 1.0f * mask_v1 * sim_factor_v1 * constraint->
strength * deformation_strength);
899 correction_vector_half,
900 -1.0f * mask_v2 * sim_factor_v2 * constraint->
strength *
901 deformation_strength);
924 .cloth_sim = cloth_sim,
992 apply_forces_data.
area_co = area_co;
993 apply_forces_data.
area_no = area_no;
994 apply_forces_data.
mat = mat;
1006 for (
int i = 0; i < totverts; i++) {
1029 for (
int i = 0; i < totnode; i++) {
1037 const float cloth_mass,
1038 const float cloth_damping,
1039 const float cloth_softbody_strength,
1040 const bool use_collisions,
1041 const bool needs_deform_coords)
1051 "cloth length constraints");
1055 totverts,
sizeof(
float[3]),
"cloth sim acceleration");
1059 totverts,
sizeof(
float[3]),
"cloth sim last iteration pos");
1062 totverts,
sizeof(
float),
"cloth sim length tweak");
1064 if (needs_deform_coords) {
1066 totverts,
sizeof(
float[3]),
"cloth sim deformation positions");
1068 totverts,
sizeof(
float),
"cloth sim deformation strength");
1071 if (cloth_softbody_strength > 0.0f) {
1073 totverts,
sizeof(
float[3]),
"cloth sim softbody pos");
1076 cloth_sim->
mass = cloth_mass;
1077 cloth_sim->
damping = cloth_damping;
1080 if (use_collisions) {
1097 float initial_location[3],
1116 .cloth_sim = cloth_sim,
1117 .cloth_sim_initial_location = initial_location,
1118 .cloth_sim_radius = radius,
1131 for (
int i = 0; i < totverts; i++) {
1135 if (has_deformation_pos) {
1139 if (has_softbody_pos) {
1148 for (
int i = 0; i < totverts; i++) {
1158 for (
int n = 0; n < totnode; n++) {
1173 float sim_location[3];
1176 sd, ob, nodes, totnode, ss->
cache->
cloth_sim, sim_location, limit);
1256 const float location[3],
1259 const float line_width,
1260 const float outline_col[3],
1263 float cursor_trans[4][4], cursor_rot[4][4];
1264 const float z_axis[4] = {0.0f, 0.0f, 1.0f, 0.0f};
1267 translate_m4(cursor_trans, location[0], location[1], location[2]);
1285 const float outline_col[3],
1286 float outline_alpha)
1288 float local_mat[4][4];
1310 immVertex3f(gpuattr, dist - arrow_x, arrow_y, 0.0f);
1311 immVertex3f(gpuattr, dist - arrow_x, -arrow_y, 0.0f);
1314 immVertex3f(gpuattr, -dist + arrow_x, arrow_y, 0.0f);
1315 immVertex3f(gpuattr, -dist + arrow_x, -arrow_y, 0.0f);
1334 {
CLOTH_FILTER_PINCH,
"PINCH", 0,
"Pinch",
"Pulls the cloth to the cursor's start position"},
1339 "Scales the mesh as a soft body using the origin of the object as scale"},
1348 "Use the local axis to limit the force and set the gravity direction"},
1353 "Use the global axis to limit the force and set the gravity direction"},
1358 "Use the view axis to limit the force and set the gravity direction"},
1381 const float disp[3],
1384 float final_disp[3];
1393 const float force[3],
1394 const float gravity[3],
1397 float final_force[3];
1418 float sculpt_gravity[3] = {0.0f};
1423 sculpt_gravity[2] = -1.0f;
1432 float force[3] = {0.0f, 0.0f, 0.0f};
1433 float disp[3], temp[3],
transform[3][3];
1441 switch (filter_type) {
1446 force[1] = -
data->filter_strength *
fade;
1449 force[2] = -
data->filter_strength *
fade;
1478 if (is_deformation_filter) {
1510 const float len =
event->prev_press_xy[0] -
event->xy[0];
1511 filter_strength = filter_strength * -
len * 0.001f *
UI_DPI_FAC;
1519 for (
int i = 0; i < totverts; i++) {
1527 .filter_type = filter_type,
1528 .filter_strength = filter_strength,
1590 float origin[3] = {0.0f, 0.0f, 0.0f};
1600 if (use_face_sets) {
1622 ot->
name =
"Filter Cloth";
1623 ot->
idname =
"SCULPT_OT_cloth_filter";
1624 ot->
description =
"Applies a cloth simulation deformation to the entire mesh";
1639 "Operation that is going to be applied to the mesh");
1641 ot->
srna,
"strength", 1.0f, -10.0f, 10.0f,
"Strength",
"Filter strength", -10.0f, 10.0f);
1647 "Apply the force in the selected axis");
1653 "Orientation of the axis to limit the filter force");
1660 "Mass of each simulation particle",
1669 "How much the applied forces are propagated through the cloth",
1676 "Apply the filter only to the Face Set under the cursor");
1681 "Collide with other collider objects in the scene");
typedef float(TangentPoint)[2]
float BKE_brush_curve_strength(const struct Brush *br, float p, float len)
void BKE_collider_cache_free(struct ListBase **colliders)
void collision_move_object(struct CollisionModifierData *collmd, float step, float prevstep, bool moving_bvh)
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
struct Object * CTX_data_active_object(const bContext *C)
struct Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
struct ToolSettings * CTX_data_tool_settings(const bContext *C)
struct ModifierData * BKE_modifiers_findby_type(const struct Object *ob, ModifierType type)
General operations, lookup, etc. for blender objects.
void BKE_sculpt_update_object_for_edit(struct Depsgraph *depsgraph, struct Object *ob_orig, bool need_pmap, bool need_mask, bool is_paint_tool)
@ SCULPT_CLOTH_NODE_UNINITIALIZED
@ SCULPT_CLOTH_NODE_ACTIVE
@ SCULPT_CLOTH_NODE_INACTIVE
struct Brush * BKE_paint_brush(struct Paint *paint)
#define SCULPT_FACE_SET_NONE
@ SCULPT_CLOTH_CONSTRAINT_DEFORMATION
@ SCULPT_CLOTH_CONSTRAINT_PIN
@ SCULPT_CLOTH_CONSTRAINT_SOFTBODY
@ SCULPT_CLOTH_CONSTRAINT_STRUCTURAL
A BVH for high poly meshes.
void BKE_pbvh_node_mark_update(PBVHNode *node)
#define BKE_pbvh_vertex_iter_begin(pbvh, node, vi, mode)
#define BKE_pbvh_vertex_iter_end
void BKE_pbvh_vert_tag_update_normal(PBVH *pbvh, int index)
void BKE_pbvh_parallel_range_settings(struct TaskParallelSettings *settings, bool use_threading, int totnode)
void BKE_pbvh_search_gather(PBVH *pbvh, BKE_pbvh_SearchCallback scb, void *search_data, PBVHNode ***array, int *tot)
bool BLI_edgeset_haskey(const EdgeSet *es, unsigned int v0, unsigned int v1) ATTR_WARN_UNUSED_RESULT
bool BLI_edgeset_add(EdgeSet *es, unsigned int v0, unsigned int v1)
void BLI_edgeset_free(EdgeSet *es)
EdgeSet * BLI_edgeset_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void * BLI_ghash_lookup(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
void BLI_ghash_insert(GHash *gh, void *key, void *val)
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
GHash * BLI_ghash_ptr_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
#define BVH_RAYCAST_DEFAULT
int BLI_bvhtree_ray_cast_ex(BVHTree *tree, const float co[3], const float dir[3], float radius, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata, int flag)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
MINLINE float clamp_f(float value, float min, float max)
MINLINE float square_f(float a)
void plane_from_point_normal_v3(float r_plane[4], const float plane_co[3], const float plane_no[3])
void isect_ray_tri_watertight_v3_precalc(struct IsectRayPrecalc *isect_precalc, const float ray_direction[3])
float dist_to_plane_v3(const float p[3], const float plane[4])
bool isect_ray_tri_watertight_v3(const float ray_origin[3], const struct IsectRayPrecalc *isect_precalc, const float v0[3], const float v1[3], const float v2[3], float *r_dist, float r_uv[2])
float dist_signed_to_plane_v3(const float p[3], const float plane[4])
void closest_to_plane_v3(float r_close[3], const float plane[4], const float pt[3])
float normal_tri_v3(float n[3], const float v1[3], const float v2[3], const float v3[3])
void mul_m3_v3(const float M[3][3], float r[3])
void unit_m3(float m[3][3])
void scale_m3_fl(float R[3][3], float scale)
void unit_m4(float m[4][4])
void translate_m4(float mat[4][4], float tx, float ty, float tz)
bool invert_m4_m4(float R[4][4], const float A[4][4])
void copy_m4_m4(float m1[4][4], const float m2[4][4])
void mul_v3_m4v3(float r[3], const float M[4][4], const float v[3])
void normalize_m4(float R[4][4]) ATTR_NONNULL()
void rotation_between_vecs_to_quat(float q[4], const float v1[3], const float v2[3])
void quat_to_mat4(float mat[4][4], const float q[4])
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
MINLINE float normalize_v3(float r[3])
MINLINE void mul_v3_v3(float r[3], const float a[3])
MINLINE float len_squared_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE bool is_zero_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE float normalize_v3_v3(float r[3], const float a[3])
MINLINE void copy_v3_fl(float r[3], float f)
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
MINLINE void zero_v3(float r[3])
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
void BLI_task_parallel_range(int start, int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings)
int BLI_task_parallel_thread_id(const TaskParallelTLS *tls)
#define POINTER_FROM_INT(i)
#define POINTER_AS_INT(i)
struct Depsgraph Depsgraph
#define DEG_OBJECT_ITER_END
#define DEG_OBJECT_ITER_BEGIN(graph_, instance_, flag_)
@ DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY
@ DEG_ITER_OBJECT_FLAG_VISIBLE
@ DEG_ITER_OBJECT_FLAG_DUPLI
@ BRUSH_CLOTH_DEFORM_DRAG
@ BRUSH_CLOTH_DEFORM_EXPAND
@ BRUSH_CLOTH_DEFORM_GRAB
@ BRUSH_CLOTH_DEFORM_PINCH_POINT
@ BRUSH_CLOTH_DEFORM_PUSH
@ BRUSH_CLOTH_DEFORM_INFLATE
@ BRUSH_CLOTH_DEFORM_SNAKE_HOOK
@ BRUSH_CLOTH_DEFORM_PINCH_PERPENDICULAR
@ BRUSH_CLOTH_PIN_SIMULATION_BOUNDARY
@ BRUSH_CLOTH_USE_COLLISION
@ BRUSH_CLOTH_FORCE_FALLOFF_PLANE
@ BRUSH_CLOTH_SIMULATION_AREA_LOCAL
@ BRUSH_CLOTH_SIMULATION_AREA_DYNAMIC
@ BRUSH_CLOTH_SIMULATION_AREA_GLOBAL
@ eModifierType_Collision
Object is a sort of wrapper for general info.
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
void GPU_matrix_pop(void)
#define GPU_matrix_mul(x)
void GPU_matrix_push(void)
void GPU_line_width(float width)
Read Guarded memory(de)allocation.
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE btVector3 transform(const btVector3 &point) const
const Depsgraph * depsgraph
IconTextureDrawCall normal
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
void *(* MEM_malloc_arrayN)(size_t len, size_t size, const char *str)
void *(* MEM_calloc_arrayN)(size_t len, size_t size, const char *str)
void *(* MEM_reallocN_id)(void *vmemh, size_t len, const char *str)
void *(* MEM_callocN)(size_t len, const char *str)
ccl_device_inline float len_squared(const float3 a)
T distance(const T &a, const T &b)
thread_local int thread_id
CCL_NAMESPACE_BEGIN ccl_device float fade(float t)
float RNA_float_get(PointerRNA *ptr, const char *name)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_enum_flag(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
const float * SCULPT_vertex_co_get(SculptSession *ss, int index)
int SCULPT_vertex_count_get(SculptSession *ss)
bool SCULPT_cursor_geometry_info_update(bContext *C, SculptCursorGeometryInfo *out, const float mval[2], bool use_sampled_normal)
bool SCULPT_vertex_has_face_set(SculptSession *ss, int index, int face_set)
SculptBrushTestFn SCULPT_brush_test_init_with_falloff_shape(SculptSession *ss, SculptBrushTest *test, char falloff_shape)
float SCULPT_brush_strength_factor(SculptSession *ss, const Brush *br, const float brush_point[3], const float len, const float vno[3], const float fno[3], const float mask, const int vertex_index, const int thread_id)
const float * SCULPT_active_vertex_co_get(SculptSession *ss)
void SCULPT_vertex_random_access_ensure(SculptSession *ss)
void SCULPT_flush_update_done(const bContext *C, Object *ob, SculptUpdateType update_flags)
bool SCULPT_search_sphere_cb(PBVHNode *node, void *data_v)
void SCULPT_flush_update_step(bContext *C, SculptUpdateType update_flags)
void SCULPT_vertex_normal_get(SculptSession *ss, int index, float no[3])
bool SCULPT_mode_poll(bContext *C)
bool SCULPT_stroke_is_first_brush_step_of_symmetry_pass(StrokeCache *cache)
float SCULPT_vertex_mask_get(SculptSession *ss, int index)
void SCULPT_calc_brush_plane(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, float r_area_no[3], float r_area_co[3])
void SCULPT_flush_stroke_deform(Sculpt *sd, Object *ob, bool is_proxy_used)
bool SCULPT_stroke_is_first_brush_step(StrokeCache *cache)
const float * SCULPT_vertex_persistent_co_get(SculptSession *ss, int index)
int SCULPT_active_face_set_get(SculptSession *ss)
float SCULPT_automasking_factor_get(AutomaskingCache *automasking, SculptSession *ss, int vert)
AutomaskingCache * SCULPT_automasking_cache_init(Sculpt *sd, Brush *brush, Object *ob)
AutomaskingCache * SCULPT_automasking_active_cache_get(SculptSession *ss)
static int sculpt_cloth_filter_modal(bContext *C, wmOperator *op, const wmEvent *event)
void SCULPT_cloth_brush_ensure_nodes_constraints(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, SculptClothSimulation *cloth_sim, float initial_location[3], const float radius)
static void cloth_brush_reallocate_constraints(SculptClothSimulation *cloth_sim)
static void cloth_brush_satisfy_constraints(SculptSession *ss, Brush *brush, SculptClothSimulation *cloth_sim)
PBVHNode ** SCULPT_cloth_brush_affected_nodes_gather(SculptSession *ss, Brush *brush, int *r_totnode)
void SCULPT_cloth_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)
static void cloth_brush_add_softbody_constraint(SculptClothSimulation *cloth_sim, const int node_index, const int v, const float strength)
void SCULPT_cloth_sim_activate_nodes(SculptClothSimulation *cloth_sim, PBVHNode **nodes, int totnode)
SculptClothSimulation * SCULPT_cloth_brush_simulation_create(Object *ob, const float cloth_mass, const float cloth_damping, const float cloth_softbody_strength, const bool use_collisions, const bool needs_deform_coords)
static bool cloth_brush_sim_has_length_constraint(SculptClothSimulation *cloth_sim, const int v1, const int v2)
static void cloth_brush_simulation_location_get(SculptSession *ss, const Brush *brush, float r_location[3])
static void do_cloth_brush_apply_forces_task_cb_ex(void *__restrict userdata, const int n, const TaskParallelTLS *__restrict tls)
enum eSculpClothFilterType eSculptClothFilterType
static EnumPropertyItem prop_cloth_filter_force_axis_items[]
static void cloth_brush_add_pin_constraint(SculptClothSimulation *cloth_sim, const int node_index, const int v, const float strength)
static void cloth_filter_apply_forces_to_vertices(const int v_index, const float force[3], const float gravity[3], FilterCache *filter_cache)
static void cloth_brush_collision_cb(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit)
#define CLOTH_SOLVER_DISPLACEMENT_FACTOR
#define CLOTH_MAX_CONSTRAINTS_PER_VERTEX
static void cloth_filter_apply_forces_task_cb(void *__restrict userdata, const int i, const TaskParallelTLS *__restrict UNUSED(tls))
#define CLOTH_LENGTH_CONSTRAINTS_BLOCK
static EnumPropertyItem prop_cloth_filter_type[]
static void do_cloth_brush_solve_simulation_task_cb_ex(void *__restrict userdata, const int n, const TaskParallelTLS *__restrict UNUSED(tls))
#define CLOTH_DEFORMATION_SNAKEHOOK_STRENGTH
static void cloth_brush_solve_collision(Object *object, SculptClothSimulation *cloth_sim, const int i)
void SCULPT_cloth_simulation_free(struct SculptClothSimulation *cloth_sim)
void SCULPT_cloth_brush_store_simulation_state(SculptSession *ss, SculptClothSimulation *cloth_sim)
static int sculpt_cloth_filter_invoke(bContext *C, wmOperator *op, const wmEvent *event)
#define CLOTH_DEFORMATION_GRAB_STRENGTH
static void cloth_sim_initialize_default_node_state(SculptSession *ss, SculptClothSimulation *cloth_sim)
static void cloth_brush_add_deformation_constraint(SculptClothSimulation *cloth_sim, const int node_index, const int v, const float strength)
void SCULPT_cloth_brush_do_simulation_step(Sculpt *sd, Object *ob, SculptClothSimulation *cloth_sim, PBVHNode **nodes, int totnode)
static void cloth_brush_add_length_constraint(SculptSession *ss, SculptClothSimulation *cloth_sim, const int node_index, const int v1, const int v2, const bool use_persistent)
static ListBase * cloth_brush_collider_cache_create(Object *object, Depsgraph *depsgraph)
static bool cloth_filter_is_deformation_filter(eSculptClothFilterType filter_type)
void SCULPT_OT_cloth_filter(struct wmOperatorType *ot)
static EnumPropertyItem prop_cloth_filter_orientation_items[]
static void cloth_filter_apply_displacement_to_deform_co(const int v_index, const float disp[3], FilterCache *filter_cache)
#define CLOTH_DEFORMATION_TARGET_STRENGTH
static void cloth_brush_apply_brush_foces(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
static float cloth_brush_simulation_falloff_get(const Brush *brush, const float radius, const float location[3], const float co[3])
void SCULPT_cloth_brush_simulation_init(SculptSession *ss, SculptClothSimulation *cloth_sim)
void SCULPT_do_cloth_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
void SCULPT_cloth_plane_falloff_preview_draw(const uint gpuattr, SculptSession *ss, const float outline_col[3], float outline_alpha)
#define CLOTH_SIMULATION_ITERATIONS
static void cloth_brush_apply_force_to_vertex(SculptSession *UNUSED(ss), SculptClothSimulation *cloth_sim, const float force[3], const int vertex_index)
static void sculpt_cloth_ensure_constraints_in_simulation_area(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
#define CLOTH_SIMULATION_TIME_STEP
struct ClothBrushCollision ClothBrushCollision
static void do_cloth_brush_build_constraints_task_cb_ex(void *__restrict userdata, const int n, const TaskParallelTLS *__restrict UNUSED(tls))
void SCULPT_filter_zero_disabled_axis_components(float r_v[3], struct FilterCache *filter_cache)
void SCULPT_filter_to_object_space(float r_v[3], struct FilterCache *filter_cache)
void SCULPT_filter_cache_init(bContext *C, Object *ob, Sculpt *sd, const int undo_type)
void SCULPT_filter_cache_free(SculptSession *ss)
void SCULPT_undo_push_begin(struct Object *ob, const char *name)
void SCULPT_undo_push_end(struct Object *ob)
#define SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN(ss, v_index, neighbor_iterator)
BLI_INLINE bool SCULPT_is_cloth_deform_brush(const Brush *brush)
@ SCULPT_FILTER_ORIENTATION_WORLD
@ SCULPT_FILTER_ORIENTATION_VIEW
@ SCULPT_FILTER_ORIENTATION_LOCAL
bool(* SculptBrushTestFn)(SculptBrushTest *test, const float co[3])
#define SCULPT_VERTEX_NEIGHBORS_ITER_END(neighbor_iterator)
struct CurveMapping * curve
int cloth_simulation_area_type
float cloth_constraint_softbody_strength
int cloth_force_falloff_type
CollisionModifierData * col_data
struct IsectRayPrecalc isect_precalc
struct CollisionModifierData * collmd
struct ColliderCache * next
AutomaskingCache * automasking
SculptFilterOrientation orientation
float cloth_sim_pinch_point[3]
SculptClothSimulation * cloth_sim
bool enabled_force_axis[3]
struct SculptSession * sculpt
eSculptClothConstraintType type
float * deformation_strength
struct EdgeSet * created_length_constraints
struct ListBase * collider_list
struct GHash * node_state_index
int capacity_length_constraints
float(* deformation_pos)[3]
int tot_length_constraints
eSculptClothNodeSimState * node_state
SculptClothLengthConstraint * length_constraints
float(* last_iteration_pos)[3]
float * length_constraint_tweak
struct Depsgraph * depsgraph
struct KeyBlock * shapekey_active
struct StrokeCache * cache
struct FilterCache * filter_cache
bool deform_modifiers_active
struct Object * gravity_object
const struct Brush * brush
float initial_location[3]
float sculpt_normal_symm[3]
float grab_delta_symmetry[3]
float stroke_local_mat[4][4]
struct SculptClothSimulation * cloth_sim
float gravity_direction[3]
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)