Fix #123181: Sculpt Transform tools dont keep verts on the symmetry axis #123428

Merged
Philipp Oeser merged 2 commits from lichtwerk/blender:123181 into blender-v4.2-release 2024-06-20 15:41:33 +02:00

View File

@ -138,6 +138,8 @@ static std::array<float4x4, 8> transform_matrices_init(
return mats;
}
static constexpr float transform_mirror_max_distance_eps = 0.00002f;

static constexpr const float transform_mirror_max_distance_eps = 0.00002f;

`static constexpr const float transform_mirror_max_distance_eps = 0.00002f;`

Agreed, but the const is unnecessary

Agreed, but the `const` is unnecessary

Oh, yeah, it seems we can not change constexpr varibles even at compile time...

Oh, yeah, it seems we can not change `constexpr` varibles even at compile time...
static void transform_node(Object &ob,
const std::array<float4x4, 8> &transform_mats,
PBVHNode *node)
@ -149,6 +151,8 @@ static void transform_node(Object &ob,
PBVHVertexIter vd;
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(ob);
undo::push_node(ob, node, undo::Type::Position);
BKE_pbvh_vertex_iter_begin (*ss.pbvh, node, vd, PBVH_ITER_UNIQUE) {
SCULPT_orig_vert_data_update(orig_data, vd);
@ -172,6 +176,17 @@ static void transform_node(Object &ob,
sub_v3_v3v3(disp, transformed_co, start_co);
mul_v3_fl(disp, 1.0f - fade);
add_v3_v3v3(vd.co, start_co, disp);
/* Keep vertices on the mirror axis. */
if ((symm & PAINT_SYMM_X) && (fabs(start_co[0]) < transform_mirror_max_distance_eps)) {
vd.co[0] = 0.0f;
}
if ((symm & PAINT_SYMM_Y) && (fabs(start_co[1]) < transform_mirror_max_distance_eps)) {
vd.co[1] = 0.0f;
}
if ((symm & PAINT_SYMM_Z) && (fabs(start_co[2]) < transform_mirror_max_distance_eps)) {
vd.co[2] = 0.0f;
}
}
BKE_pbvh_vertex_iter_end;