diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-05-19 01:00:21 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-05-26 21:48:46 +0300 |
commit | 18f33f293bfe08e87c50cad4a9d628592d7a3d15 (patch) | |
tree | 54e35573245a6dc0b8f238b5b4e66f739ead011e /source/blender/editors/sculpt_paint/sculpt_intern.h | |
parent | 9aea7dc7c65b94aff0dda299c7269a252bf04b05 (diff) |
Fix Cloth Brush grab deformation mode
The grab mode was not correctly implemented, so the way it was working
was confusing for users.
- Grab delta was calculated in increments from the last stroke position, so it did not match the behavior of a grab brush. I refactored the grab delta calculation to make this change more explicit.
- Grab displacement was not calculated from the original coordinates
- Grab was using an incorrect strength
Grab is now setting the position of the affected vertices directly and
the constraints solve the rest of the cloth. I also tried to implement
an alternative version based on applying forces to move the vertices to
the grab position, but I think this is more controllable and the grab
falloff can be adjusted by tweaking the simulation falloff.
Reviewed By: sergey
Differential Revision: https://developer.blender.org/D7756
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt_intern.h')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_intern.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index 191a6fdd62e..ec7ea1d85f4 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -333,6 +333,13 @@ void SCULPT_cloth_plane_falloff_preview_draw(const uint gpuattr, struct SculptSession *ss, const float outline_col[3], float outline_alpha); + +BLI_INLINE bool SCULPT_is_cloth_deform_brush(const Brush *brush) +{ + return brush->sculpt_tool == SCULPT_TOOL_CLOTH && + brush->cloth_deform_type == BRUSH_CLOTH_DEFORM_GRAB; +} + /* Pose Brush. */ void SCULPT_do_pose_brush(struct Sculpt *sd, struct Object *ob, |