Fix Cloth Brush not working with automasking
The cloth brush was not using the automasking values when calculating the mask value on each vertex. Reviewed By: brecht Differential Revision: https://developer.blender.org/D7083
This commit is contained in:
@@ -1470,7 +1470,7 @@ static bool sculpt_automasking_enabled(SculptSession *ss, const Brush *br)
|
||||
return false;
|
||||
}
|
||||
|
||||
static float sculpt_automasking_factor_get(SculptSession *ss, int vert)
|
||||
float SCULPT_automasking_factor_get(SculptSession *ss, int vert)
|
||||
{
|
||||
if (ss->cache->automask) {
|
||||
return ss->cache->automask[vert];
|
||||
@@ -2255,7 +2255,7 @@ float SCULPT_brush_strength_factor(SculptSession *ss,
|
||||
avg *= 1.0f - mask;
|
||||
|
||||
/* Automasking. */
|
||||
avg *= sculpt_automasking_factor_get(ss, vertex_index);
|
||||
avg *= SCULPT_automasking_factor_get(ss, vertex_index);
|
||||
|
||||
return avg;
|
||||
}
|
||||
@@ -4038,7 +4038,7 @@ static void do_elastic_deform_brush_task_cb_ex(void *__restrict userdata,
|
||||
mul_v3_fl(final_disp, 1.0f - *vd.mask);
|
||||
}
|
||||
|
||||
mul_v3_fl(final_disp, sculpt_automasking_factor_get(ss, vd.index));
|
||||
mul_v3_fl(final_disp, SCULPT_automasking_factor_get(ss, vd.index));
|
||||
|
||||
copy_v3_v3(proxy[vd.i], final_disp);
|
||||
|
||||
|
||||
@@ -384,7 +384,8 @@ static void do_cloth_brush_solve_simulation_task_cb_ex(
|
||||
sub_v3_v3v3(pos_diff, cloth_sim->pos[i], cloth_sim->prev_pos[i]);
|
||||
mul_v3_fl(pos_diff, (1.0f - cloth_sim->damping));
|
||||
|
||||
const float mask_v = (1.0f - (vd.mask ? *vd.mask : 0.0f));
|
||||
const float mask_v = (1.0f - (vd.mask ? *vd.mask : 0.0f)) *
|
||||
SCULPT_automasking_factor_get(ss, vd.index);
|
||||
madd_v3_v3fl(cloth_sim->pos[i], pos_diff, mask_v);
|
||||
madd_v3_v3fl(cloth_sim->pos[i], cloth_sim->acceleration[i], mask_v);
|
||||
|
||||
@@ -448,8 +449,10 @@ static void cloth_brush_satisfy_constraints(SculptSession *ss,
|
||||
mul_v3_v3fl(correction_vector, v1_to_v2, 1.0f - (constraint_distance / current_distance));
|
||||
mul_v3_v3fl(correction_vector_half, correction_vector, 0.5f);
|
||||
|
||||
const float mask_v1 = (1.0f - SCULPT_vertex_mask_get(ss, v1));
|
||||
const float mask_v2 = (1.0f - SCULPT_vertex_mask_get(ss, v2));
|
||||
const float mask_v1 = (1.0f - SCULPT_vertex_mask_get(ss, v1)) *
|
||||
SCULPT_automasking_factor_get(ss, v1);
|
||||
const float mask_v2 = (1.0f - SCULPT_vertex_mask_get(ss, v2)) *
|
||||
SCULPT_automasking_factor_get(ss, v2);
|
||||
|
||||
const float sim_factor_v1 = cloth_brush_simulation_falloff_get(
|
||||
brush, ss->cache->radius, ss->cache->initial_location, cloth_sim->init_pos[v1]);
|
||||
|
||||
@@ -203,6 +203,9 @@ void SCULPT_floodfill_execute(
|
||||
void *userdata);
|
||||
void SCULPT_floodfill_free(SculptFloodFill *flood);
|
||||
|
||||
/* Automasking. */
|
||||
float SCULPT_automasking_factor_get(SculptSession *ss, int vert);
|
||||
|
||||
/* Brushes. */
|
||||
|
||||
/* Cloth Brush. */
|
||||
|
||||
Reference in New Issue
Block a user