Refactor: Replace Cloth SCULPT_stroke_is_first_brush_step check

Pull Request: https://projects.blender.org/blender/blender/pulls/138950
This commit is contained in:
Sean Kim
2025-05-15 23:04:55 +02:00
committed by Sean Kim
parent f831e211f4
commit 563a00bd3f

View File

@@ -1842,22 +1842,17 @@ void do_cloth_brush(const Depsgraph &depsgraph,
SculptSession &ss = *ob.sculpt;
const Brush *brush = BKE_paint_brush_for_read(&sd.paint);
/* Brushes that use anchored strokes and restore the mesh can't rely on symmetry passes and steps
* count as it is always the first step, so the simulation needs to be created when it does not
* exist for this stroke. */
if (SCULPT_stroke_is_first_brush_step_of_symmetry_pass(*ss.cache) || !ss.cache->cloth_sim) {
/* The simulation structure only needs to be created on the first symmetry pass. */
if (SCULPT_stroke_is_first_brush_step(*ss.cache) || !ss.cache->cloth_sim) {
ss.cache->cloth_sim = brush_simulation_create(depsgraph,
ob,
brush->cloth_mass,
brush->cloth_damping,
brush->cloth_constraint_softbody_strength,
(brush->flag2 & BRUSH_CLOTH_USE_COLLISION),
is_cloth_deform_brush(*brush));
}
if (!ss.cache->cloth_sim) {
ss.cache->cloth_sim = brush_simulation_create(depsgraph,
ob,
brush->cloth_mass,
brush->cloth_damping,
brush->cloth_constraint_softbody_strength,
(brush->flag2 & BRUSH_CLOTH_USE_COLLISION),
is_cloth_deform_brush(*brush));
}
if (SCULPT_stroke_is_first_brush_step_of_symmetry_pass(*ss.cache)) {
if (brush->cloth_simulation_area_type == BRUSH_CLOTH_SIMULATION_AREA_LOCAL) {
/* When using simulation a fixed local simulation area, constraints are created only using
* the initial stroke position and initial radius (per symmetry pass) instead of per node.