Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorPablo Dobarro <pablodp606@gmail.com>2020-07-28 02:16:31 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-07-29 18:21:41 +0300
commit54a2fcc0f331b8971e8a105382e9a8f67e1859e3 (patch)
tree409089da159f7953c97cdf6a483d33211c8de728 /source
parent6e5278c3dacaf35650fbe0550a87399fc8459f53 (diff)
Fix Cloth Brush global Sculpt gravity applied in the wrong falloff
Previously, gravity was only applied in the real brush radius, not in the whole simulation radius. For most deformation modes, applying gravity to the entire simulation instead of just to the brush radius and scaled by the radius (like a regular sculpt brush) makes more sense. After this fix and with the cloth collisions patch applied, it is possible to do things like this with the cloth grab brush. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8406
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_cloth.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_cloth.c b/source/blender/editors/sculpt_paint/sculpt_cloth.c
index 115d6f665a3..4232be91034 100644
--- a/source/blender/editors/sculpt_paint/sculpt_cloth.c
+++ b/source/blender/editors/sculpt_paint/sculpt_cloth.c
@@ -254,8 +254,7 @@ static void do_cloth_brush_apply_forces_task_cb_ex(void *__restrict userdata,
/* Gravity */
float gravity[3] = {0.0f};
if (ss->cache->supports_gravity) {
- madd_v3_v3fl(
- gravity, ss->cache->gravity_direction, -ss->cache->radius * data->sd->gravity_factor);
+ madd_v3_v3fl(gravity, ss->cache->gravity_direction, -data->sd->gravity_factor);
}
/* Original data for deform brushes. */
@@ -279,6 +278,11 @@ static void do_cloth_brush_apply_forces_task_cb_ex(void *__restrict userdata,
copy_v3_v3(current_vertex_location, vd.co);
}
+ /* Apply gravity in the entire simulation area. */
+ float vertex_gravity[3];
+ mul_v3_v3fl(vertex_gravity, gravity, sim_factor);
+ 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) {
@@ -356,8 +360,6 @@ static void do_cloth_brush_apply_forces_task_cb_ex(void *__restrict userdata,
break;
}
- madd_v3_v3fl(force, gravity, fade);
-
cloth_brush_apply_force_to_vertex(ss, ss->cache->cloth_sim, force, vd.index);
}
}