Fix Cloth Brush Grab deform types not working with spacing

Even the Cloth Brush grab works like a regular grab brush, it makes
sense to support spacing just in this brush in order to prevent creating
more brush steps that update the simulation. This way, it is possible to
create grab brushes that update the simulation constantly while grabbing
(using the dots stroke mode) or brushes that only update the simulation
when the cursor moves (using spacing).

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D8568
This commit is contained in:
Pablo Dobarro 2020-08-17 18:28:39 +02:00
parent e3eb53a5b3
commit 5aecc4b57b
1 changed files with 13 additions and 1 deletions

View File

@ -997,7 +997,19 @@ static void stroke_done(bContext *C, wmOperator *op)
/* Returns zero if the stroke dots should not be spaced, non-zero otherwise */
bool paint_space_stroke_enabled(Brush *br, ePaintMode mode)
{
return (br->flag & BRUSH_SPACE) && paint_supports_dynamic_size(br, mode);
if ((br->flag & BRUSH_SPACE) == 0) {
return false;
}
if (br->sculpt_tool == SCULPT_TOOL_CLOTH) {
/* 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
* grab brushes. */
return true;
}
return paint_supports_dynamic_size(br, mode);
}
static bool sculpt_is_grab_tool(Brush *br)