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
diff options
context:
space:
mode:
authorPablo Dobarro <pablodp606@gmail.com>2020-08-18 22:37:39 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-08-20 18:00:12 +0300
commitd74c495838355abb32a299adc145975bf7b148b1 (patch)
tree877b164f0b7f0796a28a8f7f58c2a315702bd70e /source/blender/editors/sculpt_paint
parentb3bd121dd4c6910d7ca8bb08253ab66972cfe54f (diff)
Fix variable simulation steps with cloth deform brushes
Cloth deform brushes (both in cloth brush or other tools with cloth simulation targets) should not have their spacing as a value relative the brush radius to avoid affecting the simulation speed when changing the brush radius. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8620
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index 52cdebf3fd5..e709224f370 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -691,6 +691,14 @@ static float paint_space_stroke_spacing(bContext *C,
spacing = spacing * (1.5f - spacing_pressure);
}
+ if (SCULPT_is_cloth_deform_brush(brush)) {
+ /* The spacing in tools that use the cloth solver should not be affected by the brush radius to
+ * avoid affecting the simulation update rate when changing the radius of the brush.
+ With a value of 100 and the brush default of 10 for spacing, a simulation step runs every 2
+ pixels movement of the cursor. */
+ size_clamp = 100.0f;
+ }
+
/* stroke system is used for 2d paint too, so we need to account for
* the fact that brush can be scaled there. */
spacing *= stroke->zoom_2d;
@@ -1001,7 +1009,7 @@ bool paint_space_stroke_enabled(Brush *br, ePaintMode mode)
return false;
}
- if (br->sculpt_tool == SCULPT_TOOL_CLOTH) {
+ if (br->sculpt_tool == SCULPT_TOOL_CLOTH || SCULPT_is_cloth_deform_brush(br)) {
/* The Cloth Brush is a special case for stroke spacing. Even if it has grab modes which do
* not support dynamic size, stroke spacing needs to be enabled so it is possible to control
* whether the simulation runs constantly or only when the brush moves when using the cloth