Commit: 6c4a9b83ffda86a81a7eed7d0a7ebf7c3ec93de1
Author: Pablo Dobarro
Date:   Wed Dec 16 20:59:20 2020 +0100
Branches: sculpt-dev
https://developer.blender.org/rB6c4a9b83ffda86a81a7eed7d0a7ebf7c3ec93de1

Fix elastic drag cloth brush deformation

===================================================================

M       source/blender/editors/sculpt_paint/sculpt_cloth.c

===================================================================

diff --git a/source/blender/editors/sculpt_paint/sculpt_cloth.c 
b/source/blender/editors/sculpt_paint/sculpt_cloth.c
index a70d2d8f04a..3e7a193527e 100644
--- a/source/blender/editors/sculpt_paint/sculpt_cloth.c
+++ b/source/blender/editors/sculpt_paint/sculpt_cloth.c
@@ -516,9 +516,11 @@ static void do_cloth_brush_apply_forces_task_cb_ex(void 
*__restrict userdata,
   const float kv_force = 1.0f;
   const float kv_shear_modulus = 1.0f;
   const float kv_poisson_ratio = 0.4f;
+  bool use_elastic_drag = false;
   if (brush->cloth_deform_type == BRUSH_CLOTH_DEFORM_ELASTIC_DRAG) {
     BKE_kelvinlet_init_params(
         &params, ss->cache->radius, kv_force, kv_shear_modulus, 
kv_poisson_ratio);
+    use_elastic_drag = true;
   }
 
   /* Gravity */
@@ -549,7 +551,9 @@ static void do_cloth_brush_apply_forces_task_cb_ex(void 
*__restrict userdata,
     cloth_brush_apply_force_to_vertex(ss, ss->cache->cloth_sim, 
vertex_gravity, vd.index);
 
     /* When using the plane falloff mode the falloff is not constrained by the 
brush radius. */
-    if (sculpt_brush_test_sq_fn(&test, current_vertex_location) || 
use_falloff_plane) {
+    /* Brushes that use elastic deformation are also not constrained by 
radius. */
+    if (sculpt_brush_test_sq_fn(&test, current_vertex_location) || 
use_falloff_plane ||
+        use_elastic_drag) {
 
       float dist = sqrtf(test.dist);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to