Sculpt: fix twist brush mirroring

This commit is contained in:
Joseph Eagar 2021-12-03 05:22:49 -08:00
parent a5c3d3476c
commit fbc020c752
2 changed files with 18 additions and 1 deletions

View File

@ -5152,6 +5152,7 @@ static bool brush_uses_commandlist(Brush *brush, int tool)
case SCULPT_TOOL_RELAX:
case SCULPT_TOOL_INFLATE:
case SCULPT_TOOL_PAINT:
case SCULPT_TOOL_TWIST:
case SCULPT_TOOL_SMEAR:
ok = true;
break;

View File

@ -529,8 +529,24 @@ void SCULPT_do_twist_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
add_v3_v3(area_co, temp);
*/
int totbit = 0;
for (int i = 0; i < 3; i++) {
if (ss->cache->mirror_symmetry_pass & (1<<i)) {
totbit++;
}
}
float tan[3];
copy_v3_v3(tan, ss->cache->grab_delta_symmetry);
if (totbit & 1) {
negate_v3(tan);
}
/* Initialize brush local-space matrix. */
cross_v3_v3v3(mat[0], area_no, ss->cache->grab_delta_symmetry);
cross_v3_v3v3(mat[0], area_no, tan);
mat[0][3] = 0.0f;
cross_v3_v3v3(mat[1], area_no, mat[0]);
mat[1][3] = 0.0f;