110 if (!ss->
cache || !brush) {
136 .ignore_fully_ineffective =
false,
149 .ignore_fully_ineffective =
false,
161 const float location[3],
187 float p = 1.0f - ((
distance - falloff) / (limit - falloff));
188 return 3.0f * p * p - 2.0f * p * p * p;
191 #define CLOTH_LENGTH_CONSTRAINTS_BLOCK 100000
192 #define CLOTH_SIMULATION_ITERATIONS 5
194 #define CLOTH_SOLVER_DISPLACEMENT_FACTOR 0.6f
195 #define CLOTH_MAX_CONSTRAINTS_PER_VERTEX 1024
196 #define CLOTH_SIMULATION_TIME_STEP 0.01f
197 #define CLOTH_DEFORMATION_SNAKEHOOK_STRENGTH 0.35f
198 #define CLOTH_DEFORMATION_TARGET_STRENGTH 0.01f
199 #define CLOTH_DEFORMATION_GRAB_STRENGTH 0.1f
215 "length constraints");
221 const int node_index,
224 const bool use_persistent)
232 length_constraint->
node = node_index;
239 if (use_persistent) {
259 const int node_index,
261 const float strength)
269 length_constraint->
node = node_index;
276 length_constraint->
length = 0.0f;
277 length_constraint->
strength = strength;
286 const int node_index,
288 const float strength)
296 length_constraint->
node = node_index;
303 length_constraint->
length = 0.0f;
304 length_constraint->
strength = strength;
313 const int node_index,
315 const float strength)
323 length_constraint->
node = node_index;
330 length_constraint->
length = 0.0f;
331 length_constraint->
strength = strength;
355 const bool pin_simulation_boundary = ss->
cache !=
NULL && brush !=
NULL &&
364 const bool cloth_is_deform_brush = ss->
cache !=
NULL && brush !=
NULL &&
369 float radius_squared = 0.0f;
370 if (cloth_is_deform_brush) {
377 data->cloth_sim_radius *
data->cloth_sim_radius :
387 build_indices[tot_indices] = vd.
index;
390 build_indices[tot_indices] = ni.
index;
395 if (
data->cloth_sim->softbody_strength > 0.0f) {
404 for (
int c_i = 0; c_i < tot_indices; c_i++) {
405 for (
int c_j = 0; c_j < tot_indices; c_j++) {
407 data->cloth_sim, build_indices[c_i], build_indices[c_j])) {
423 if (use_falloff_plane) {
445 else if (
data->cloth_sim->deformation_pos) {
453 if (pin_simulation_boundary) {
457 if (sim_falloff < 1.0f) {
469 const float force[3],
470 const int vertex_index)
483 const float *offset =
data->offset;
484 const float *grab_delta =
data->grab_delta;
495 ss, &test,
data->brush->falloff_shape);
499 float x_object_space[3];
500 float z_object_space[3];
507 float deform_plane[4];
508 float plane_normal[3];
509 if (use_falloff_plane) {
515 float gravity[3] = {0.0f};
522 float sim_location[3];
527 float current_vertex_location[3];
536 float vertex_gravity[3];
541 if (!sculpt_brush_test_sq_fn(&test, current_vertex_location) && !use_falloff_plane) {
547 if (use_falloff_plane) {
551 const float fade = sim_factor * bstrength *
554 current_vertex_location,
586 if (use_falloff_plane) {
601 if (use_falloff_plane) {
613 float disp_center[3];
680 MVert *mverts = col_data->
x;
681 float *tri[3], no[3], co[3];
683 tri[0] = mverts[verttri->
tri[0]].
co;
684 tri[1] = mverts[verttri->
tri[1]].
co;
685 tri[2] = mverts[verttri->
tri[2]].
co;
693 if (tri_hit && dist < hit->dist) {
711 float obmat_inv[4][4];
715 collider_cache = collider_cache->
next) {
716 float ray_start[3], ray_normal[3];
717 float pos_world_space[3], prev_pos_world_space[3];
721 sub_v3_v3v3(ray_normal, pos_world_space, prev_pos_world_space);
729 col.col_data = collmd;
741 if (hit.
index == -1) {
745 float collision_disp[3];
746 float movement_disp[3];
748 sub_v3_v3v3(movement_disp, pos_world_space, prev_pos_world_space);
749 float friction_plane[4];
750 float pos_on_friction_plane[3];
775 const float time_step =
data->cloth_time_step;
785 float sim_location[3];
787 const float sim_factor =
791 if (sim_factor <= 0.0f) {
805 const float mask_v = (1.0f - (vd.
mask ? *vd.
mask : 0.0f)) *
854 const float current_distance =
len_v3(v1_to_v2);
855 float correction_vector[3];
856 float correction_vector_half[3];
858 const float constraint_distance = constraint->
length +
862 if (current_distance > 0.0f) {
866 (1.0f - (constraint_distance / current_distance)));
872 mul_v3_v3fl(correction_vector_half, correction_vector, 0.5f);
879 float sim_location[3];
882 const float sim_factor_v1 = ss->
cache ?
888 const float sim_factor_v2 = ss->
cache ?
895 float deformation_strength = 1.0f;
905 correction_vector_half,
906 1.0f * mask_v1 * sim_factor_v1 * constraint->
strength * softbody_plasticity);
908 correction_vector_half,
909 -1.0f * mask_v1 * sim_factor_v1 * constraint->
strength *
910 (1.0f - softbody_plasticity));
914 correction_vector_half,
915 1.0f * mask_v1 * sim_factor_v1 * constraint->
strength * deformation_strength);
918 correction_vector_half,
919 -1.0f * mask_v2 * sim_factor_v2 * constraint->
strength *
920 deformation_strength);
943 .cloth_sim = cloth_sim,
993 apply_forces_data.
offset = offset;
1011 apply_forces_data.
area_co = area_co;
1012 apply_forces_data.
area_no = area_no;
1013 apply_forces_data.
mat = mat;
1025 for (
int i = 0; i < totverts; i++) {
1048 for (
int i = 0; i < totnode; i++) {
1057 const float cloth_mass,
1058 const float cloth_damping,
1059 const float cloth_softbody_strength,
1060 const bool use_collisions,
1061 const bool needs_deform_coords)
1070 "cloth length constraints");
1074 totverts,
sizeof(
float[3]),
"cloth sim acceleration");
1078 totverts,
sizeof(
float[3]),
"cloth sim last iteration pos");
1081 totverts,
sizeof(
float),
"cloth sim length tweak");
1083 if (needs_deform_coords) {
1085 totverts,
sizeof(
float[3]),
"cloth sim deformation positions");
1087 totverts,
sizeof(
float),
"cloth sim deformation strength");
1090 if (cloth_softbody_strength > 0.0f) {
1092 totverts,
sizeof(
float[3]),
"cloth sim softbody pos");
1095 cloth_sim->
mass = cloth_mass;
1096 cloth_sim->
damping = cloth_damping;
1099 if (use_collisions) {
1116 float initial_location[3],
1135 .cloth_sim = cloth_sim,
1136 .cloth_sim_initial_location = initial_location,
1137 .cloth_sim_radius = radius,
1150 for (
int i = 0; i < totverts; i++) {
1154 if (has_deformation_pos) {
1158 if (has_softbody_pos) {
1167 for (
int i = 0; i < totverts; i++) {
1177 for (
int n = 0; n < totnode; n++) {
1192 float sim_location[3];
1195 sd, ob, nodes, totnode, ss->
cache->
cloth_sim, sim_location, limit);
1277 const float location[3],
1280 const float line_width,
1281 const float outline_col[3],
1284 float cursor_trans[4][4], cursor_rot[4][4];
1285 const float z_axis[4] = {0.0f, 0.0f, 1.0f, 0.0f};
1288 translate_m4(cursor_trans, location[0], location[1], location[2]);
1306 const float outline_col[3],
1307 float outline_alpha)
1309 float local_mat[4][4];
1331 immVertex3f(gpuattr, dist - arrow_x, arrow_y, 0.0f);
1332 immVertex3f(gpuattr, dist - arrow_x, -arrow_y, 0.0f);
1335 immVertex3f(gpuattr, -dist + arrow_x, arrow_y, 0.0f);
1336 immVertex3f(gpuattr, -dist + arrow_x, -arrow_y, 0.0f);
1355 {
CLOTH_FILTER_PINCH,
"PINCH", 0,
"Pinch",
"Pulls the cloth to the cursor's start position"},
1360 "Scales the mesh as a soft body using the origin of the object as scale"},
1369 "Use the local axis to limit the force and set the gravity direction"},
1374 "Use the global axis to limit the force and set the gravity direction"},
1379 "Use the view axis to limit the force and set the gravity direction"},
1402 const float disp[3],
1405 float final_disp[3];
1414 const float force[3],
1415 const float gravity[3],
1418 float final_force[3];
1439 float sculpt_gravity[3] = {0.0f};
1444 sculpt_gravity[2] = -1.0f;
1453 float force[3] = {0.0f, 0.0f, 0.0f};
1454 float disp[3], temp[3],
transform[3][3];
1462 switch (filter_type) {
1467 force[1] = -
data->filter_strength *
fade;
1470 force[2] = -
data->filter_strength *
fade;
1499 if (is_deformation_filter) {
1531 const float len =
event->prevclickx -
event->x;
1532 filter_strength = filter_strength * -
len * 0.001f *
UI_DPI_FAC;
1540 for (
int i = 0; i < totverts; i++) {
1548 .filter_type = filter_type,
1549 .filter_strength = filter_strength,
1584 mouse[0] =
event->mval[0];
1585 mouse[1] =
event->mval[1];
1613 float origin[3] = {0.0f, 0.0f, 0.0f};
1623 if (use_face_sets) {
1645 ot->
name =
"Filter Cloth";
1646 ot->
idname =
"SCULPT_OT_cloth_filter";
1647 ot->
description =
"Applies a cloth simulation deformation to the entire mesh";
1662 "Operation that is going to be applied to the mesh");
1664 ot->
srna,
"strength", 1.0f, -10.0f, 10.0f,
"Strength",
"Filter strength", -10.0f, 10.0f);
1670 "Apply the force in the selected axis");
1676 "Orientation of the axis to limit the filter force");
1683 "Mass of each simulation particle",
1692 "How much the applied forces are propagated through the cloth",
1699 "Apply the filter only to the Face Set under the cursor");
1704 "Collide with other collider objects in the scene");
typedef float(TangentPoint)[2]
float BKE_brush_curve_strength(const struct Brush *br, float p, const float len)
void collision_move_object(struct CollisionModifierData *collmd, const float step, const float prevstep, const bool moving_bvh)
void BKE_collider_cache_free(struct ListBase **colliders)
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 need_colors)
@ 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_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_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
bool BLI_edgeset_haskey(EdgeSet *es, unsigned int v0, unsigned int v1) 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
void * BLI_ghash_lookup(GHash *gh, const void *key) 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 normal_short_to_float_v3(float r[3], const short n[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(const int start, const 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
static CCL_NAMESPACE_BEGIN const double alpha
IconTextureDrawCall normal
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)
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 mouse[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)
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)
float SCULPT_brush_strength_factor(SculptSession *ss, const Brush *br, const float brush_point[3], const float len, const short vno[3], const float fno[3], const float mask, const int vertex_index, const int thread_id)
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)
static ListBase * cloth_brush_collider_cache_create(Depsgraph *depsgraph)
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)
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))
SculptClothSimulation * SCULPT_cloth_brush_simulation_create(SculptSession *ss, const float cloth_mass, const float cloth_damping, const float cloth_softbody_strength, const bool use_collisions, const bool needs_deform_coords)
#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 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)
#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)
void SCULPT_undo_push_end(void)
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
CCL_NAMESPACE_BEGIN ccl_device float fade(float t)
ccl_device_inline float distance(const float2 &a, const float2 &b)
ccl_device_inline float len_squared(const float3 a)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)